Author: ralfbecker
New Revision: 55339
URL: http://svn.stylite.de/viewvc/egroupware?rev=55339&view=rev
Log:
if there is no primary key lock table on backup to be able to query rows in chunks to limit memory usage
Modified:
trunk/egroupware/api/src/Db/Backup.php
— trunk/egroupware/api/src/Db/Backup.php (original)
+++ trunk/egroupware/api/src/Db/Backup.php Wed Mar 9 21:25:22 2016
@@ -892,10 +892,12 @@
/**
* Backup all data in the form of a (compressed) csv file
*
-
-
@param f resource file opened with fopen for writing
-
- */
- function backup($f)
-
-
@param resource $f file opened with fopen for writing
-
-
@param boolean $lock_table =null true: allways, false: never, null: if no primary key
-
- default of null limits memory usage if there is no primary key, by locking table and use ROW_CHUCK
-
-
*/
-
function backup($f, $lock_table=null)
{
//echo “function backup($f)
”; // !
@set_time_limit(0);
@@ -947,6 +949,10 @@
// backups don’t restore because of doublicate keys
$pk = $schema[‘pk’] && count($schema[‘pk’]) == 1 ? $schema[‘pk’][0] : null;
-
if ($lock_table || empty($pk) && is_null($lock_table))
-
{
-
$this->db->Link_ID->RowLock($table);
-
}
$total = $max = 0;
do {
$num_rows = 0;
@@ -955,8 +961,10 @@
// limit by maximum primary key already received
empty($pk) || !$max ? false : $pk.’ > '.$this->db->quote($max, $schema[‘fd’][$pk][‘type’]),
LINE, FILE,
-
empty($pk) ? false : 0, // if no primary key, query all rows
-
empty($pk) ? '' : 'ORDER BY '.$this->db->name_quote($pk).' ASC', // order by primary key
-
// if no primary key, either lock table, or query all rows
-
empty($pk) ? ($lock_table !== false ? $total : false) : 0,
-
// if we have a primary key, order by it to ensure rows are not read double
-
empty($pk) ? '' : 'ORDER BY '.$this->db->name_quote($pk).' ASC',
false, self::ROW_CHUNK) as $row)
{
if (!empty($pk)) $max = $row[$pk];
@@ -968,7 +976,9 @@
++$num_rows;
}
}
Transform Data into Opportunity.
Accelerate data analysis in your applications with
Intel Data Analytics Acceleration Library.
Click to learn more.
http://pubads.g.doubleclick.net/gampad/clk?id=278785111&iu=/4140
eGroupWare-cvs mailing list
eGroupWare-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/egroupware-cvs