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.
0.7.4-extended
Justin Clark-Casey (justincc) 2013-01-10 22:38:48 +00:00
parent d43863af78
commit 44adf909b0
2 changed files with 36 additions and 13 deletions

View File

@ -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 teleport", "debug teleport", "Toggle teleport route debugging", Debug);
m_console.Commands.AddCommand("Debug", false, "debug scene", m_console.Commands.AddCommand("Debug", false, "debug scene",
"debug scene active|collisions|physics|scripting|teleport true|false", "debug scene active|collisions|pbackup|physics|scripting|teleport|updates true|false",
"Turn on scene debugging.", "Turn on scene debugging options.",
"If active is false then main scene update and maintenance loops are suspended.\n" "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 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 physics is false then all physics objects are non-physical.\n"
+ "If scripting is false then no scripting operations happen.\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); Debug);
m_console.Commands.AddCommand("General", false, "change region", m_console.Commands.AddCommand("General", false, "change region",
@ -782,7 +784,7 @@ namespace OpenSim
else else
{ {
MainConsole.Instance.Output( 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; break;

View File

@ -77,6 +77,23 @@ namespace OpenSim.Region.Framework.Scenes
/// </summary> /// </summary>
public bool DebugUpdates { get; private set; } public bool DebugUpdates { get; private set; }
/// <summary>
/// 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).
/// </summary>
/// <remarks>
/// 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.
/// </remarks>
public bool PeriodicBackup { get; private set; }
/// <summary>
/// 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.
/// </summary>
public bool UseBackup { get; private set; }
public SynchronizeSceneHandler SynchronizeScene; public SynchronizeSceneHandler SynchronizeScene;
/// <summary> /// <summary>
@ -317,7 +334,6 @@ namespace OpenSim.Region.Framework.Scenes
private Timer m_mapGenerationTimer = new Timer(); private Timer m_mapGenerationTimer = new Timer();
private bool m_generateMaptiles; private bool m_generateMaptiles;
private bool m_useBackup = true;
#endregion Fields #endregion Fields
@ -570,11 +586,6 @@ namespace OpenSim.Region.Framework.Scenes
get { return m_authenticateHandler; } get { return m_authenticateHandler; }
} }
public bool UseBackup
{
get { return m_useBackup; }
}
// an instance to the physics plugin's Scene object. // an instance to the physics plugin's Scene object.
public PhysicsScene PhysicsScene public PhysicsScene PhysicsScene
{ {
@ -743,8 +754,8 @@ namespace OpenSim.Region.Framework.Scenes
StartDisabled = startupConfig.GetBoolean("StartDisabled", false); StartDisabled = startupConfig.GetBoolean("StartDisabled", false);
m_defaultDrawDistance = startupConfig.GetFloat("DefaultDrawDistance", m_defaultDrawDistance); m_defaultDrawDistance = startupConfig.GetFloat("DefaultDrawDistance", m_defaultDrawDistance);
m_useBackup = startupConfig.GetBoolean("UseSceneBackup", m_useBackup); UseBackup = startupConfig.GetBoolean("UseSceneBackup", UseBackup);
if (!m_useBackup) if (!UseBackup)
m_log.InfoFormat("[SCENE]: Backup has been disabled for {0}", RegionInfo.RegionName); m_log.InfoFormat("[SCENE]: Backup has been disabled for {0}", RegionInfo.RegionName);
//Animation states //Animation states
@ -895,6 +906,8 @@ namespace OpenSim.Region.Framework.Scenes
{ {
PhysicalPrims = true; PhysicalPrims = true;
CollidablePrims = true; CollidablePrims = true;
PeriodicBackup = true;
UseBackup = true;
BordersLocked = true; BordersLocked = true;
Border northBorder = new Border(); Border northBorder = new Border();
@ -1147,6 +1160,14 @@ namespace OpenSim.Region.Framework.Scenes
Active = active; Active = active;
} }
if (options.ContainsKey("pbackup"))
{
bool active;
if (bool.TryParse(options["pbackup"], out active))
PeriodicBackup = active;
}
if (options.ContainsKey("scripting")) if (options.ContainsKey("scripting"))
{ {
bool enableScripts = true; bool enableScripts = true;
@ -1528,7 +1549,7 @@ namespace OpenSim.Region.Framework.Scenes
eventMS = Util.EnvironmentTickCountSubtract(tmpMS); eventMS = Util.EnvironmentTickCountSubtract(tmpMS);
} }
if (Frame % m_update_backup == 0) if (PeriodicBackup && Frame % m_update_backup == 0)
{ {
tmpMS = Util.EnvironmentTickCount(); tmpMS = Util.EnvironmentTickCount();
UpdateStorageBackup(); UpdateStorageBackup();