From 5af108a029e5382f6a2f6d4d10b3d4de3a8f5245 Mon Sep 17 00:00:00 2001 From: Teravus Ovares Date: Wed, 21 May 2008 21:22:56 +0000 Subject: * This update causes the backup process to run in a separate thread. * Concurrency issues are resolved because each object makes a memory-only copy of itself and backs up the copy. * Because of the way this is done, the latest at the time of the backup gets backed up (no functionality change) * You can move *thousands of objects at a time* and the sim doesn't freeze and wait for the backup to complete. * This can be enhanced more by dedicating the thread as opposed to starting it when the backup process starts. --- OpenSim/Region/Environment/Scenes/Scene.cs | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'OpenSim/Region/Environment/Scenes/Scene.cs') diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index 56d114c..280e09a 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs @@ -58,6 +58,7 @@ namespace OpenSim.Region.Environment.Scenes public SynchronizeSceneHandler SynchronizeScene = null; public int splitID = 0; + #region Fields protected Timer m_heartbeatTimer = new Timer(); @@ -83,6 +84,7 @@ namespace OpenSim.Region.Environment.Scenes private int m_RestartTimerCounter; private readonly Timer m_restartTimer = new Timer(15000); // Wait before firing private int m_incrementsof15seconds = 0; + private bool m_backingup = false; public string m_simulatorVersion = "OpenSimulator 0.5"; @@ -842,7 +844,14 @@ namespace OpenSim.Region.Environment.Scenes private void UpdateStorageBackup() { - Backup(); + if (!m_backingup) + { + m_backingup = true; + Thread backupthread = new Thread(Backup); + backupthread.Name = "BackupWriter"; + backupthread.IsBackground = true; + backupthread.Start(); + } } private void UpdateEvents() @@ -863,10 +872,11 @@ namespace OpenSim.Region.Environment.Scenes /// /// /// - public bool Backup() + public void Backup() { EventManager.TriggerOnBackup(m_storageManager.DataStore); - return true; + m_backingup = false; + //return true; } #endregion -- cgit v1.1