Преглед на файлове

N.656 Allow DB writes during a backup

git-svn-id: http://svn.code.sf.net/p/itop/code/trunk@4794 a333f486-631f-4898-b8df-5754b55c2be0
romainq преди 8 години
родител
ревизия
8f43112e83
променени са 1 файла, в които са добавени 5 реда и са изтрити 3 реда
  1. 5 3
      setup/backup.class.inc.php

+ 5 - 3
setup/backup.class.inc.php

@@ -1,5 +1,5 @@
 <?php
 <?php
-// Copyright (C) 2010-2016 Combodo SARL
+// Copyright (C) 2010-2017 Combodo SARL
 //
 //
 //   This file is part of iTop.
 //   This file is part of iTop.
 //
 //
@@ -284,8 +284,10 @@ if (class_exists('ZipArchive')) // The setup must be able to start even if the "
 			}
 			}
 			// Delete the file created by tempnam() so that the spawned process can write into it (Windows/IIS)
 			// Delete the file created by tempnam() so that the spawned process can write into it (Windows/IIS)
 			unlink($sBackupFileName);
 			unlink($sBackupFileName);
-			$sCommand = "$sMySQLDump --opt --default-character-set=utf8 --add-drop-database --single-transaction --host=$sHost $sPortOption --user=$sUser --password=$sPwd --result-file=$sTmpFileName $sDBName $sTables 2>&1";
-			$sCommandDisplay = "$sMySQLDump --opt --default-character-set=utf8 --add-drop-database --single-transaction --host=$sHost $sPortOption --user=xxxxx --password=xxxxx --result-file=$sTmpFileName $sDBName $sTables";
+			// Note: opt implicitely sets lock-tables... which cancels the benefit of single-transaction!
+			//       skip-lock-tables compensates and allows for writes during a backup
+			$sCommand = "$sMySQLDump --opt --skip-lock-tables --default-character-set=utf8 --add-drop-database --single-transaction --host=$sHost $sPortOption --user=$sUser --password=$sPwd --result-file=$sTmpFileName $sDBName $sTables 2>&1";
+			$sCommandDisplay = "$sMySQLDump --opt --skip-lock-tables --default-character-set=utf8 --add-drop-database --single-transaction --host=$sHost $sPortOption --user=xxxxx --password=xxxxx --result-file=$sTmpFileName $sDBName $sTables";
 	
 	
 			// Now run the command for real
 			// Now run the command for real
 			$this->LogInfo("Executing command: $sCommandDisplay");
 			$this->LogInfo("Executing command: $sCommandDisplay");