aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorHomer Horwitz2008-11-15 17:52:00 +0000
committerHomer Horwitz2008-11-15 17:52:00 +0000
commit21b69ac5158f8902a2abb1d240d2b8fe15f7f22b (patch)
tree6762c93cb099d74ea92c92a755d18d3d34d0ff5a /OpenSim
parentPrevent NRE if you do a llSetStatus(STATUS_ROTATION...) on an object that isn... (diff)
downloadopensim-SC_OLD-21b69ac5158f8902a2abb1d240d2b8fe15f7f22b.zip
opensim-SC_OLD-21b69ac5158f8902a2abb1d240d2b8fe15f7f22b.tar.gz
opensim-SC_OLD-21b69ac5158f8902a2abb1d240d2b8fe15f7f22b.tar.bz2
opensim-SC_OLD-21b69ac5158f8902a2abb1d240d2b8fe15f7f22b.tar.xz
Mantis #2621: Thanks idb, for a patch that will persist regularily changed objects better.
Objects will be persisted now MinimumTimeBeforePersistenceConsidered seconds after the last change, but latest MaximumTimeBeforePersistenceConsidered after the first change (both are configurable in OpenSim.ini.example and are set to 60 and 600 as default).
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.cs19
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs71
2 files changed, 72 insertions, 18 deletions
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs
index f606018..eb9d509 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.cs
@@ -62,6 +62,9 @@ namespace OpenSim.Region.Environment.Scenes
62 public SynchronizeSceneHandler SynchronizeScene = null; 62 public SynchronizeSceneHandler SynchronizeScene = null;
63 public int splitID = 0; 63 public int splitID = 0;
64 64
65 private const long DEFAULT_MIN_TIME_FOR_PERSISTENCE = 60L;
66 private const long DEFAULT_MAX_TIME_FOR_PERSISTENCE = 600L;
67
65 #region Fields 68 #region Fields
66 69
67 protected Timer m_restartWaitTimer = new Timer(); 70 protected Timer m_restartWaitTimer = new Timer();
@@ -171,6 +174,11 @@ namespace OpenSim.Region.Environment.Scenes
171 174
172 private object m_deleting_scene_object = new object(); 175 private object m_deleting_scene_object = new object();
173 176
177 // the minimum time that must elapse before a changed object will be considered for persisted
178 public long m_dontPersistBefore = DEFAULT_MIN_TIME_FOR_PERSISTENCE * 10000000L;
179 // the maximum time that must elapse before a changed object will be considered for persisted
180 public long m_persistAfter = DEFAULT_MAX_TIME_FOR_PERSISTENCE * 10000000L;
181
174 #endregion 182 #endregion
175 183
176 #region Properties 184 #region Properties
@@ -335,6 +343,12 @@ namespace OpenSim.Region.Environment.Scenes
335 m_maxNonphys = startupConfig.GetFloat("NonPhysicalPrimMax", 65536.0f); 343 m_maxNonphys = startupConfig.GetFloat("NonPhysicalPrimMax", 65536.0f);
336 m_maxPhys = startupConfig.GetFloat("PhysicalPrimMax", 10.0f); 344 m_maxPhys = startupConfig.GetFloat("PhysicalPrimMax", 10.0f);
337 m_clampPrimSize = startupConfig.GetBoolean("ClampPrimSize", false); 345 m_clampPrimSize = startupConfig.GetBoolean("ClampPrimSize", false);
346 m_dontPersistBefore =
347 startupConfig.GetInt("MinimumTimeBeforePersistenceConsidered", DEFAULT_MIN_TIME_FOR_PERSISTENCE);
348 m_dontPersistBefore *= 10000000;
349 m_persistAfter =
350 startupConfig.GetInt("MaximumTimeBeforePersistenceConsidered", DEFAULT_MAX_TIME_FOR_PERSISTENCE);
351 m_persistAfter *= 10000000;
338 352
339 m_defaultScriptEngine = startupConfig.GetString("DefaultScriptEngine", "DotNetEngine"); 353 m_defaultScriptEngine = startupConfig.GetString("DefaultScriptEngine", "DotNetEngine");
340 } 354 }
@@ -348,6 +362,11 @@ namespace OpenSim.Region.Environment.Scenes
348 362
349 #region Startup / Close Methods 363 #region Startup / Close Methods
350 364
365 public bool ShuttingDown
366 {
367 get { return shuttingdown; }
368 }
369
351 protected virtual void RegisterDefaultSceneEvents() 370 protected virtual void RegisterDefaultSceneEvents()
352 { 371 {
353 m_eventManager.OnPermissionError += SendPermissionAlert; 372 m_eventManager.OnPermissionError += SendPermissionAlert;
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs
index c51f235..d929be2 100644
--- a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs
@@ -92,7 +92,39 @@ namespace OpenSim.Region.Environment.Scenes
92 /// Signal whether the non-inventory attributes of any prims in the group have changed 92 /// Signal whether the non-inventory attributes of any prims in the group have changed
93 /// since the group's last persistent backup 93 /// since the group's last persistent backup
94 /// </summary> 94 /// </summary>
95 public bool HasGroupChanged = false; 95 private bool m_hasGroupChanged = false;
96 private long timeFirstChanged;
97 private long timeLastChanged;
98
99 public bool HasGroupChanged
100 {
101 set
102 {
103 if (value)
104 {
105 timeLastChanged = DateTime.Now.Ticks;
106 if (!m_hasGroupChanged)
107 timeFirstChanged = DateTime.Now.Ticks;
108 }
109 m_hasGroupChanged = value;
110 }
111
112 get { return m_hasGroupChanged; }
113 }
114
115 private bool isTimeToPersist()
116 {
117 if (IsSelected || IsDeleted || IsAttachment)
118 return false;
119 if (!m_hasGroupChanged)
120 return false;
121 if (m_scene.ShuttingDown)
122 return true;
123 long currentTime = DateTime.Now.Ticks;
124 if (currentTime - timeLastChanged > m_scene.m_dontPersistBefore || currentTime - timeFirstChanged > m_scene.m_persistAfter)
125 return true;
126 return false;
127 }
96 128
97 /// <value> 129 /// <value>
98 /// Is this scene object acting as an attachment? 130 /// Is this scene object acting as an attachment?
@@ -1190,25 +1222,28 @@ namespace OpenSim.Region.Environment.Scenes
1190 1222
1191 try 1223 try
1192 { 1224 {
1193 ILandObject parcel = m_scene.LandChannel.GetLandObject( 1225 if (!m_scene.ShuttingDown) // if shutting down then there will be nothing to handle the return so leave till next restart
1194 m_rootPart.GroupPosition.X, m_rootPart.GroupPosition.Y);
1195
1196 if (parcel != null && parcel.landData != null &&
1197 parcel.landData.OtherCleanTime != 0)
1198 { 1226 {
1199 if (parcel.landData.OwnerID != OwnerID && 1227 ILandObject parcel = m_scene.LandChannel.GetLandObject(
1200 (parcel.landData.GroupID != GroupID || 1228 m_rootPart.GroupPosition.X, m_rootPart.GroupPosition.Y);
1201 parcel.landData.GroupID == UUID.Zero)) 1229
1230 if (parcel != null && parcel.landData != null &&
1231 parcel.landData.OtherCleanTime != 0)
1202 { 1232 {
1203 if ((DateTime.Now - RootPart.Rezzed).TotalMinutes > 1233 if (parcel.landData.OwnerID != OwnerID &&
1204 parcel.landData.OtherCleanTime) 1234 (parcel.landData.GroupID != GroupID ||
1235 parcel.landData.GroupID == UUID.Zero))
1205 { 1236 {
1206 m_log.InfoFormat("[SCENE] Returning object {0} due to parcel auto return", RootPart.UUID.ToString()); 1237 if ((DateTime.Now - RootPart.Rezzed).TotalMinutes >
1207 m_scene.AddReturn(OwnerID, Name, AbsolutePosition); 1238 parcel.landData.OtherCleanTime)
1208 m_scene.DeRezObject(null, RootPart.LocalId, 1239 {
1209 RootPart.GroupID, 9, UUID.Zero); 1240 m_log.InfoFormat("[SCENE] Returning object {0} due to parcel auto return", RootPart.UUID.ToString());
1241 m_scene.AddReturn(OwnerID, Name, AbsolutePosition);
1242 m_scene.DeRezObject(null, RootPart.LocalId,
1243 RootPart.GroupID, 9, UUID.Zero);
1210 1244
1211 return; 1245 return;
1246 }
1212 } 1247 }
1213 } 1248 }
1214 } 1249 }
@@ -1216,7 +1251,7 @@ namespace OpenSim.Region.Environment.Scenes
1216 if (HasGroupChanged) 1251 if (HasGroupChanged)
1217 { 1252 {
1218 // don't backup while it's selected or you're asking for changes mid stream. 1253 // don't backup while it's selected or you're asking for changes mid stream.
1219 if (!(IsSelected || IsDeleted || IsAttachment)) 1254 if (isTimeToPersist())
1220 { 1255 {
1221 m_log.DebugFormat( 1256 m_log.DebugFormat(
1222 "[SCENE]: Storing {0}, {1} in {2}", 1257 "[SCENE]: Storing {0}, {1} in {2}",
@@ -1227,9 +1262,9 @@ namespace OpenSim.Region.Environment.Scenes
1227 backup_group.RootPart.Acceleration = RootPart.Acceleration; 1262 backup_group.RootPart.Acceleration = RootPart.Acceleration;
1228 backup_group.RootPart.AngularVelocity = RootPart.AngularVelocity; 1263 backup_group.RootPart.AngularVelocity = RootPart.AngularVelocity;
1229 backup_group.RootPart.ParticleSystem = RootPart.ParticleSystem; 1264 backup_group.RootPart.ParticleSystem = RootPart.ParticleSystem;
1265 HasGroupChanged = false;
1230 1266
1231 datastore.StoreObject(backup_group, m_scene.RegionInfo.RegionID); 1267 datastore.StoreObject(backup_group, m_scene.RegionInfo.RegionID);
1232 HasGroupChanged = false;
1233 1268
1234 backup_group.ForEachPart(delegate(SceneObjectPart part) { part.ProcessInventoryBackup(datastore); }); 1269 backup_group.ForEachPart(delegate(SceneObjectPart part) { part.ProcessInventoryBackup(datastore); });
1235 1270