aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs
diff options
context:
space:
mode:
authorTeravus Ovares2008-05-21 21:22:56 +0000
committerTeravus Ovares2008-05-21 21:22:56 +0000
commit5af108a029e5382f6a2f6d4d10b3d4de3a8f5245 (patch)
tree171813c4182af2849052281c1e941dec434e6815 /OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs
parentimplement in memory appearance cache for sqlite. This (diff)
downloadopensim-SC-5af108a029e5382f6a2f6d4d10b3d4de3a8f5245.zip
opensim-SC-5af108a029e5382f6a2f6d4d10b3d4de3a8f5245.tar.gz
opensim-SC-5af108a029e5382f6a2f6d4d10b3d4de3a8f5245.tar.bz2
opensim-SC-5af108a029e5382f6a2f6d4d10b3d4de3a8f5245.tar.xz
* 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.
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs65
1 files changed, 44 insertions, 21 deletions
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs
index 44e4c81..4b82bf9 100644
--- a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs
@@ -1085,13 +1085,24 @@ namespace OpenSim.Region.Environment.Scenes
1085 /// <param name="datastore"></param> 1085 /// <param name="datastore"></param>
1086 public void ProcessBackup(IRegionDataStore datastore) 1086 public void ProcessBackup(IRegionDataStore datastore)
1087 { 1087 {
1088 if (HasGroupChanged) 1088 // don't backup while it's selected or you're asking for changes mid stream.
1089 if (HasGroupChanged && !IsSelected)
1089 { 1090 {
1090 datastore.StoreObject(this, m_scene.RegionInfo.RegionID); 1091 m_log.Info("STORING");
1092 SceneObjectGroup backup_group = Copy(OwnerID, GroupID, false);
1093
1094 datastore.StoreObject(backup_group, m_scene.RegionInfo.RegionID);
1091 HasGroupChanged = false; 1095 HasGroupChanged = false;
1096
1097 backup_group.ForEachPart(delegate(SceneObjectPart part) { part.ProcessInventoryBackup(datastore); });
1098
1099 backup_group = null;
1092 } 1100 }
1101
1102 // Why is storing the inventory outside of HasGroupChanged?
1093 1103
1094 ForEachPart(delegate(SceneObjectPart part) { part.ProcessInventoryBackup(datastore); }); 1104
1105 //ForEachPart(delegate(SceneObjectPart part) { part.ProcessInventoryBackup(datastore); });
1095 } 1106 }
1096 1107
1097 #endregion 1108 #endregion
@@ -1165,7 +1176,7 @@ namespace OpenSim.Region.Environment.Scenes
1165 /// Duplicates this object, including operations such as physics set up and attaching to the backup event. 1176 /// Duplicates this object, including operations such as physics set up and attaching to the backup event.
1166 /// </summary> 1177 /// </summary>
1167 /// <returns></returns> 1178 /// <returns></returns>
1168 public SceneObjectGroup Copy(LLUUID cAgentID, LLUUID cGroupID) 1179 public SceneObjectGroup Copy(LLUUID cAgentID, LLUUID cGroupID, bool userExposed)
1169 { 1180 {
1170 SceneObjectGroup dupe = (SceneObjectGroup) MemberwiseClone(); 1181 SceneObjectGroup dupe = (SceneObjectGroup) MemberwiseClone();
1171 dupe.m_parts = new Dictionary<LLUUID, SceneObjectPart>(); 1182 dupe.m_parts = new Dictionary<LLUUID, SceneObjectPart>();
@@ -1176,11 +1187,13 @@ namespace OpenSim.Region.Environment.Scenes
1176 dupe.m_scene = m_scene; 1187 dupe.m_scene = m_scene;
1177 dupe.m_regionHandle = m_regionHandle; 1188 dupe.m_regionHandle = m_regionHandle;
1178 1189
1179 dupe.CopyRootPart(m_rootPart, OwnerID, GroupID); 1190 dupe.CopyRootPart(m_rootPart, OwnerID, GroupID, userExposed);
1180 dupe.m_rootPart.TrimPermissions(); 1191
1192 if (userExposed)
1193 dupe.m_rootPart.TrimPermissions();
1181 1194
1182 /// may need to create a new Physics actor. 1195 /// may need to create a new Physics actor.
1183 if (dupe.RootPart.PhysActor != null) 1196 if (dupe.RootPart.PhysActor != null && userExposed)
1184 { 1197 {
1185 PrimitiveBaseShape pbs = dupe.RootPart.Shape; 1198 PrimitiveBaseShape pbs = dupe.RootPart.Shape;
1186 1199
@@ -1202,26 +1215,36 @@ namespace OpenSim.Region.Environment.Scenes
1202 // switch the owner to the person who did the copying 1215 // switch the owner to the person who did the copying
1203 // Second Life copies an object and duplicates the first one in it's place 1216 // Second Life copies an object and duplicates the first one in it's place
1204 // So, we have to make a copy of this one, set it in it's place then set the owner on this one 1217 // So, we have to make a copy of this one, set it in it's place then set the owner on this one
1218 if (userExposed)
1219 {
1220 SetRootPartOwner(m_rootPart, cAgentID, cGroupID);
1221 m_rootPart.ScheduleFullUpdate();
1222 }
1205 1223
1206 SetRootPartOwner(m_rootPart, cAgentID, cGroupID); 1224
1207
1208
1209 m_rootPart.ScheduleFullUpdate();
1210 1225
1211 List<SceneObjectPart> partList = new List<SceneObjectPart>(m_parts.Values); 1226 List<SceneObjectPart> partList = new List<SceneObjectPart>(m_parts.Values);
1212 foreach (SceneObjectPart part in partList) 1227 foreach (SceneObjectPart part in partList)
1213 { 1228 {
1214 if (part.UUID != m_rootPart.UUID) 1229 if (part.UUID != m_rootPart.UUID)
1215 { 1230 {
1216 dupe.CopyPart(part, OwnerID, GroupID); 1231 dupe.CopyPart(part, OwnerID, GroupID, userExposed);
1217 SetPartOwner(part, cAgentID, cGroupID); 1232
1218 part.ScheduleFullUpdate(); 1233 if (userExposed)
1234 {
1235 SetPartOwner(part, cAgentID, cGroupID);
1236 part.ScheduleFullUpdate();
1237 }
1219 } 1238 }
1220 } 1239 }
1221 dupe.UpdateParentIDs();
1222 1240
1223 dupe.AttachToBackup(); 1241 if (userExposed)
1224 ScheduleGroupForFullUpdate(); 1242 {
1243 dupe.UpdateParentIDs();
1244
1245 dupe.AttachToBackup();
1246 ScheduleGroupForFullUpdate();
1247 }
1225 1248
1226 return dupe; 1249 return dupe;
1227 } 1250 }
@@ -1232,9 +1255,9 @@ namespace OpenSim.Region.Environment.Scenes
1232 /// <param name="part"></param> 1255 /// <param name="part"></param>
1233 /// <param name="cAgentID"></param> 1256 /// <param name="cAgentID"></param>
1234 /// <param name="cGroupID"></param> 1257 /// <param name="cGroupID"></param>
1235 public void CopyRootPart(SceneObjectPart part, LLUUID cAgentID, LLUUID cGroupID) 1258 public void CopyRootPart(SceneObjectPart part, LLUUID cAgentID, LLUUID cGroupID, bool userExposed)
1236 { 1259 {
1237 SceneObjectPart newPart = part.Copy(m_scene.PrimIDAllocate(), OwnerID, GroupID, m_parts.Count); 1260 SceneObjectPart newPart = part.Copy(m_scene.PrimIDAllocate(), OwnerID, GroupID, m_parts.Count, userExposed);
1238 newPart.SetParent(this); 1261 newPart.SetParent(this);
1239 1262
1240 lock (m_parts) 1263 lock (m_parts)
@@ -1364,9 +1387,9 @@ namespace OpenSim.Region.Environment.Scenes
1364 /// <param name="part"></param> 1387 /// <param name="part"></param>
1365 /// <param name="cAgentID"></param> 1388 /// <param name="cAgentID"></param>
1366 /// <param name="cGroupID"></param> 1389 /// <param name="cGroupID"></param>
1367 public void CopyPart(SceneObjectPart part, LLUUID cAgentID, LLUUID cGroupID) 1390 public void CopyPart(SceneObjectPart part, LLUUID cAgentID, LLUUID cGroupID, bool userExposed)
1368 { 1391 {
1369 SceneObjectPart newPart = part.Copy(m_scene.PrimIDAllocate(), OwnerID, GroupID, m_parts.Count); 1392 SceneObjectPart newPart = part.Copy(m_scene.PrimIDAllocate(), OwnerID, GroupID, m_parts.Count, userExposed);
1370 newPart.SetParent(this); 1393 newPart.SetParent(this);
1371 1394
1372 lock (m_parts) 1395 lock (m_parts)