From 701ca1e4b8b3d54e1e93baf54aada3867d403075 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Thu, 10 Jan 2013 22:38:48 +0000
Subject: 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/Framework/Scenes/Scene.cs | 39 ++++++++++++++++++++++++--------
1 file changed, 30 insertions(+), 9 deletions(-)
(limited to 'OpenSim/Region/Framework/Scenes')
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 11b63b7..d0a2115 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();
--
cgit v1.1
From 983e458bb67defd79c48d6ee66682f8f86e2029c Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Thu, 10 Jan 2013 22:59:40 +0000
Subject: refactor: route the final scene backup through the same code that
handles periodic backup
This is rather than making unnecessary duplicate checks that the SOG later performs again.
---
OpenSim/Region/Framework/Scenes/Scene.cs | 11 +----------
1 file changed, 1 insertion(+), 10 deletions(-)
(limited to 'OpenSim/Region/Framework/Scenes')
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index d0a2115..515184c 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -1322,16 +1322,7 @@ namespace OpenSim.Region.Framework.Scenes
m_log.Debug("[SCENE]: Persisting changed objects");
EventManager.TriggerSceneShuttingDown(this);
-
- EntityBase[] entities = GetEntities();
- foreach (EntityBase entity in entities)
- {
- if (!entity.IsDeleted && entity is SceneObjectGroup && ((SceneObjectGroup)entity).HasGroupChanged)
- {
- ((SceneObjectGroup)entity).ProcessBackup(SimulationDataService, false);
- }
- }
-
+ Backup(false);
m_sceneGraph.Close();
if (!GridService.DeregisterRegion(RegionInfo.RegionID))
--
cgit v1.1
From a16ae5d7e3e687fdcdae39f848f66087f16433a2 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Thu, 10 Jan 2013 23:49:48 +0000
Subject: Move scene debug commands into separate module. Command changes from
"debug scene " to "debug scene set " to accomodate
future settings
---
OpenSim/Region/Framework/Scenes/Scene.cs | 153 ++++++++++++-------------------
1 file changed, 59 insertions(+), 94 deletions(-)
(limited to 'OpenSim/Region/Framework/Scenes')
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 515184c..4859dff 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -70,12 +70,12 @@ namespace OpenSim.Region.Framework.Scenes
///
/// Show debug information about teleports.
///
- public bool DebugTeleporting { get; private set; }
+ public bool DebugTeleporting { get; set; }
///
/// Show debug information about the scene loop.
///
- public bool DebugUpdates { get; private set; }
+ public bool DebugUpdates { get; set; }
///
/// If true then the scene is saved to persistent storage periodically, every m_update_backup frames and
@@ -86,13 +86,61 @@ namespace OpenSim.Region.Framework.Scenes
/// 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; }
+ public bool PeriodicBackup { get; 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 bool UseBackup { get; set; }
+
+ ///
+ /// If false then physical objects are disabled, though collisions will continue as normal.
+ ///
+ public bool PhysicsEnabled { get; set; }
+
+ ///
+ /// If false then scripts are not enabled on the smiulator
+ ///
+ public bool ScriptsEnabled
+ {
+ get { return m_scripts_enabled; }
+ set
+ {
+ if (m_scripts_enabled != value)
+ {
+ if (!value)
+ {
+ m_log.Info("Stopping all Scripts in Scene");
+
+ EntityBase[] entities = Entities.GetEntities();
+ foreach (EntityBase ent in entities)
+ {
+ if (ent is SceneObjectGroup)
+ ((SceneObjectGroup)ent).RemoveScriptInstances(false);
+ }
+ }
+ else
+ {
+ m_log.Info("Starting all Scripts in Scene");
+
+ EntityBase[] entities = Entities.GetEntities();
+ foreach (EntityBase ent in entities)
+ {
+ if (ent is SceneObjectGroup)
+ {
+ SceneObjectGroup sog = (SceneObjectGroup)ent;
+ sog.CreateScriptInstances(0, false, DefaultScriptEngine, 0);
+ sog.ResumeScripts();
+ }
+ }
+ }
+
+ m_scripts_enabled = value;
+ }
+ }
+ }
+ private bool m_scripts_enabled;
public SynchronizeSceneHandler SynchronizeScene;
@@ -299,8 +347,6 @@ namespace OpenSim.Region.Framework.Scenes
private Dictionary m_returns = new Dictionary();
private Dictionary m_groupsWithTargets = new Dictionary();
- private bool m_physics_enabled = true;
- private bool m_scripts_enabled = true;
private string m_defaultScriptEngine;
///
@@ -762,9 +808,11 @@ namespace OpenSim.Region.Framework.Scenes
DumpAssetsToFile = dumpAssetsToFile;
+ // XXX: Don't set the public property since we don't want to activate here. This needs to be handled
+ // better in the future.
m_scripts_enabled = !RegionInfo.RegionSettings.DisableScripts;
- m_physics_enabled = !RegionInfo.RegionSettings.DisablePhysics;
+ PhysicsEnabled = !RegionInfo.RegionSettings.DisablePhysics;
m_simulatorVersion = simulatorVersion + " (" + Util.GetRuntimeInformation() + ")";
@@ -948,6 +996,8 @@ namespace OpenSim.Region.Framework.Scenes
{
PhysicalPrims = true;
CollidablePrims = true;
+ PhysicsEnabled = true;
+
PeriodicBackup = true;
UseBackup = true;
@@ -1192,91 +1242,6 @@ namespace OpenSim.Region.Framework.Scenes
}
}
- public void SetSceneCoreDebug(Dictionary options)
- {
- if (options.ContainsKey("active"))
- {
- bool active;
-
- if (bool.TryParse(options["active"], out active))
- Active = active;
- }
-
- if (options.ContainsKey("pbackup"))
- {
- bool active;
-
- if (bool.TryParse(options["pbackup"], out active))
- PeriodicBackup = active;
- }
-
- if (options.ContainsKey("scripting"))
- {
- bool enableScripts = true;
- if (bool.TryParse(options["scripting"], out enableScripts) && m_scripts_enabled != enableScripts)
- {
- if (!enableScripts)
- {
- m_log.Info("Stopping all Scripts in Scene");
-
- EntityBase[] entities = Entities.GetEntities();
- foreach (EntityBase ent in entities)
- {
- if (ent is SceneObjectGroup)
- ((SceneObjectGroup)ent).RemoveScriptInstances(false);
- }
- }
- else
- {
- m_log.Info("Starting all Scripts in Scene");
-
- EntityBase[] entities = Entities.GetEntities();
- foreach (EntityBase ent in entities)
- {
- if (ent is SceneObjectGroup)
- {
- SceneObjectGroup sog = (SceneObjectGroup)ent;
- sog.CreateScriptInstances(0, false, DefaultScriptEngine, 0);
- sog.ResumeScripts();
- }
- }
- }
-
- m_scripts_enabled = enableScripts;
- }
- }
-
- if (options.ContainsKey("physics"))
- {
- bool enablePhysics;
- if (bool.TryParse(options["physics"], out enablePhysics))
- m_physics_enabled = enablePhysics;
- }
-
-// if (options.ContainsKey("collisions"))
-// {
-// // TODO: Implement. If false, should stop objects colliding, though possibly should still allow
-// // the avatar themselves to collide with the ground.
-// }
-
- if (options.ContainsKey("teleport"))
- {
- bool enableTeleportDebugging;
- if (bool.TryParse(options["teleport"], out enableTeleportDebugging))
- DebugTeleporting = enableTeleportDebugging;
- }
-
- if (options.ContainsKey("updates"))
- {
- bool enableUpdateDebugging;
- if (bool.TryParse(options["updates"], out enableUpdateDebugging))
- {
- DebugUpdates = enableUpdateDebugging;
- GcNotify.Enabled = DebugUpdates;
- }
- }
- }
-
public int GetInaccurateNeighborCount()
{
return m_neighbours.Count;
@@ -1526,7 +1491,7 @@ namespace OpenSim.Region.Framework.Scenes
}
tmpMS = Util.EnvironmentTickCount();
- if ((Frame % m_update_physics == 0) && m_physics_enabled)
+ if (PhysicsEnabled && Frame % m_update_physics == 0)
m_sceneGraph.UpdatePreparePhysics();
physicsMS2 = Util.EnvironmentTickCountSubtract(tmpMS);
@@ -1541,7 +1506,7 @@ namespace OpenSim.Region.Framework.Scenes
tmpMS = Util.EnvironmentTickCount();
if (Frame % m_update_physics == 0)
{
- if (m_physics_enabled)
+ if (PhysicsEnabled)
physicsFPS = m_sceneGraph.UpdatePhysics(MinFrameTime);
if (SynchronizeScene != null)
--
cgit v1.1