From 069e2d6443b6bae3be970131b9dd327b41bc9f59 Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Thu, 10 Jan 2013 22:38:48 +0000 Subject: [PATCH] Add "debug scene pbackup true|false" console command. This enables or disable periodic scene backup. For debug purposes. If false, scene is still saved on shutdown. --- OpenSim/Region/Application/OpenSim.cs | 10 +++--- OpenSim/Region/Framework/Scenes/Scene.cs | 39 ++++++++++++++++++------ 2 files changed, 36 insertions(+), 13 deletions(-) diff --git a/OpenSim/Region/Application/OpenSim.cs b/OpenSim/Region/Application/OpenSim.cs index cffbb3b101..492ee4af6b 100644 --- a/OpenSim/Region/Application/OpenSim.cs +++ b/OpenSim/Region/Application/OpenSim.cs @@ -239,13 +239,15 @@ namespace OpenSim m_console.Commands.AddCommand("Debug", false, "debug teleport", "debug teleport", "Toggle teleport route debugging", Debug); m_console.Commands.AddCommand("Debug", false, "debug scene", - "debug scene active|collisions|physics|scripting|teleport true|false", - "Turn on scene debugging.", + "debug scene active|collisions|pbackup|physics|scripting|teleport|updates true|false", + "Turn on scene debugging options.", "If active is false then main scene update and maintenance loops are suspended.\n" + "If collisions is false then collisions with other objects are turned off.\n" + + "If pbackup is false then periodic scene backup is turned off.\n" + "If physics is false then all physics objects are non-physical.\n" + "If scripting is false then no scripting operations happen.\n" - + "If teleport is true then some extra teleport debug information is logged.", + + "If teleport is true then some extra teleport debug information is logged." + + "If updates is true then any frame which exceeds double the maximum desired frame time is logged.", Debug); m_console.Commands.AddCommand("General", false, "change region", @@ -764,7 +766,7 @@ namespace OpenSim else { MainConsole.Instance.Output( - "Usage: debug scene active|scripting|collisions|physics|teleport true|false"); + "Usage: debug scene active|collisions|pbackup|physics|scripting|teleport|updates true|false"); } break; diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index cca295cf7d..5c3521cd4f 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -77,6 +77,23 @@ namespace OpenSim.Region.Framework.Scenes /// public bool DebugUpdates { get; private set; } + /// + /// If true then the scene is saved to persistent storage periodically, every m_update_backup frames and + /// if objects meet required conditions (m_dontPersistBefore and m_dontPersistAfter). + /// + /// + /// Even if false, the scene will still be saved on clean shutdown. + /// FIXME: Currently, setting this to false will mean that objects are not periodically returned from parcels. + /// This needs to be fixed. + /// + public bool PeriodicBackup { get; private set; } + + /// + /// If false then the scene is never saved to persistence storage even if PeriodicBackup == true and even + /// if the scene is being shut down for the final time. + /// + public bool UseBackup { get; private set; } + public SynchronizeSceneHandler SynchronizeScene; /// @@ -341,7 +358,6 @@ namespace OpenSim.Region.Framework.Scenes private Timer m_mapGenerationTimer = new Timer(); private bool m_generateMaptiles; - private bool m_useBackup = true; #endregion Fields @@ -594,11 +610,6 @@ namespace OpenSim.Region.Framework.Scenes get { return m_authenticateHandler; } } - public bool UseBackup - { - get { return m_useBackup; } - } - // an instance to the physics plugin's Scene object. public PhysicsScene PhysicsScene { @@ -768,8 +779,8 @@ namespace OpenSim.Region.Framework.Scenes StartDisabled = startupConfig.GetBoolean("StartDisabled", false); m_defaultDrawDistance = startupConfig.GetFloat("DefaultDrawDistance", m_defaultDrawDistance); - m_useBackup = startupConfig.GetBoolean("UseSceneBackup", m_useBackup); - if (!m_useBackup) + UseBackup = startupConfig.GetBoolean("UseSceneBackup", UseBackup); + if (!UseBackup) m_log.InfoFormat("[SCENE]: Backup has been disabled for {0}", RegionInfo.RegionName); //Animation states @@ -937,6 +948,8 @@ namespace OpenSim.Region.Framework.Scenes { PhysicalPrims = true; CollidablePrims = true; + PeriodicBackup = true; + UseBackup = true; BordersLocked = true; Border northBorder = new Border(); @@ -1189,6 +1202,14 @@ namespace OpenSim.Region.Framework.Scenes Active = active; } + if (options.ContainsKey("pbackup")) + { + bool active; + + if (bool.TryParse(options["pbackup"], out active)) + PeriodicBackup = active; + } + if (options.ContainsKey("scripting")) { bool enableScripts = true; @@ -1570,7 +1591,7 @@ namespace OpenSim.Region.Framework.Scenes eventMS = Util.EnvironmentTickCountSubtract(tmpMS); } - if (Frame % m_update_backup == 0) + if (PeriodicBackup && Frame % m_update_backup == 0) { tmpMS = Util.EnvironmentTickCount(); UpdateStorageBackup();