BUG-13342: Performance Issue SOLVED
- Al realizar workspace-restore de un backup el tiempo que toma para restaurarlo es demasiado. - Al estar realizando el restore se van ejecuantado los scripts de llenado de datos en la funcion "executeSQLScript" no se hacia un adecuado insert de los registros. - se utiliza la funcion de mysql "START TRANSACTION" y "COMMIT" que son compatibles para MyISAM y InnoDB, y se van insertando los registros "Insert" por lotes.
This commit is contained in:
@@ -474,7 +474,7 @@ class workspaceTools
|
|||||||
$RBAC->initRBAC();
|
$RBAC->initRBAC();
|
||||||
$result = $RBAC->verifyPermissions();
|
$result = $RBAC->verifyPermissions();
|
||||||
if (count($result) > 1) {
|
if (count($result) > 1) {
|
||||||
foreach($result as $item) {
|
foreach ($result as $item) {
|
||||||
CLI::logging(" $item... \n");
|
CLI::logging(" $item... \n");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -1077,7 +1077,6 @@ class workspaceTools
|
|||||||
. ' --default_character_set utf8'
|
. ' --default_character_set utf8'
|
||||||
. ' --execute="SOURCE '.$filename.'"';
|
. ' --execute="SOURCE '.$filename.'"';
|
||||||
shell_exec($command);
|
shell_exec($command);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
//If the safe mode of the server is actived
|
//If the safe mode of the server is actived
|
||||||
try {
|
try {
|
||||||
@@ -1100,6 +1099,7 @@ class workspaceTools
|
|||||||
$line = $previous . " " . $line;
|
$line = $previous . " " . $line;
|
||||||
}
|
}
|
||||||
$previous = null;
|
$previous = null;
|
||||||
|
|
||||||
// If the current line doesnt end with ; then put this line together
|
// If the current line doesnt end with ; then put this line together
|
||||||
// with the next one, thus supporting multi-line statements.
|
// with the next one, thus supporting multi-line statements.
|
||||||
if (strrpos($line, ";") != strlen($line) - 1) {
|
if (strrpos($line, ";") != strlen($line) - 1) {
|
||||||
@@ -1107,18 +1107,33 @@ class workspaceTools
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
$line = substr($line, 0, strrpos($line, ";"));
|
$line = substr($line, 0, strrpos($line, ";"));
|
||||||
|
|
||||||
|
if (strrpos($line, "INSERT INTO") !== false) {
|
||||||
|
if ($insert) {
|
||||||
|
$result = mysql_query("START TRANSACTION");
|
||||||
|
$insert = false;
|
||||||
|
}
|
||||||
|
$result = mysql_query($line);
|
||||||
|
continue;
|
||||||
|
} else {
|
||||||
|
if (!$insert) {
|
||||||
|
$result = mysql_query("COMMIT");
|
||||||
|
$insert = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$result = mysql_query($line);
|
$result = mysql_query($line);
|
||||||
if ($result === false) {
|
if ($result === false) {
|
||||||
throw new Exception("Error when running script '$filename', line $j, query '$line': " . mysql_error());
|
throw new Exception("Error when running script '$filename', line $j, query '$line': " . mysql_error());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (!$insert) {
|
||||||
|
$result = mysql_query("COMMIT");
|
||||||
|
}
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
CLI::logging(CLI::error("Error:" . "There are problems running script '$filename': " . $e));
|
CLI::logging(CLI::error("Error:" . "There are problems running script '$filename': " . $e));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static public function restoreLegacy($directory)
|
static public function restoreLegacy($directory)
|
||||||
@@ -1268,10 +1283,10 @@ class workspaceTools
|
|||||||
foreach ($metadata->directories as $dir) {
|
foreach ($metadata->directories as $dir) {
|
||||||
CLI::logging("+> Restoring directory '$dir'\n");
|
CLI::logging("+> Restoring directory '$dir'\n");
|
||||||
|
|
||||||
if(file_exists("$tempDirectory/$dir" . "/ee")) {
|
if (file_exists("$tempDirectory/$dir" . "/ee")) {
|
||||||
G::rm_dir("$tempDirectory/$dir" . "/ee");
|
G::rm_dir("$tempDirectory/$dir" . "/ee");
|
||||||
}
|
}
|
||||||
if(file_exists("$tempDirectory/$dir" . "/plugin.singleton")) {
|
if (file_exists("$tempDirectory/$dir" . "/plugin.singleton")) {
|
||||||
G::rm_dir("$tempDirectory/$dir" . "/plugin.singleton");
|
G::rm_dir("$tempDirectory/$dir" . "/plugin.singleton");
|
||||||
}
|
}
|
||||||
if (!rename("$tempDirectory/$dir", $workspace->path)) {
|
if (!rename("$tempDirectory/$dir", $workspace->path)) {
|
||||||
|
|||||||
Reference in New Issue
Block a user