aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorJustin Clarke Casey2008-07-13 00:18:29 +0000
committerJustin Clarke Casey2008-07-13 00:18:29 +0000
commiteb63b9bbc10ee9d794c273dc01111de8ce8c8a0c (patch)
treee744381547466429d3001955b62dd4f2e28c7983 /OpenSim
parent* Elminate most of the debugging log output from the archive commands (diff)
downloadopensim-SC_OLD-eb63b9bbc10ee9d794c273dc01111de8ce8c8a0c.zip
opensim-SC_OLD-eb63b9bbc10ee9d794c273dc01111de8ce8c8a0c.tar.gz
opensim-SC_OLD-eb63b9bbc10ee9d794c273dc01111de8ce8c8a0c.tar.bz2
opensim-SC_OLD-eb63b9bbc10ee9d794c273dc01111de8ce8c8a0c.tar.xz
* Actually persist restored archives to the database - wasn't actually doing this before (doh)
* Not quite perfect yet
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Region/Environment/Modules/World/Archiver/ArchiveReadRequest.cs23
-rw-r--r--OpenSim/Region/Environment/Modules/World/Archiver/ArchiveWriteRequestPreparation.cs2
-rw-r--r--OpenSim/Region/Environment/Modules/World/Serialiser/SceneXmlLoader.cs2
-rw-r--r--OpenSim/Region/Environment/Scenes/InnerScene.cs13
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.cs18
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneObjectGroup.Inventory.cs17
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs2
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneObjectPart.Inventory.cs14
8 files changed, 74 insertions, 17 deletions
diff --git a/OpenSim/Region/Environment/Modules/World/Archiver/ArchiveReadRequest.cs b/OpenSim/Region/Environment/Modules/World/Archiver/ArchiveReadRequest.cs
index 0522372..40c7a69 100644
--- a/OpenSim/Region/Environment/Modules/World/Archiver/ArchiveReadRequest.cs
+++ b/OpenSim/Region/Environment/Modules/World/Archiver/ArchiveReadRequest.cs
@@ -71,6 +71,9 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver
71 71
72 List<string> serialisedSceneObjects = new List<string>(); 72 List<string> serialisedSceneObjects = new List<string>();
73 string filePath = "ERROR"; 73 string filePath = "ERROR";
74
75 int successfulAssetRestores = 0;
76 int failedAssetRestores = 0;
74 77
75 byte[] data; 78 byte[] data;
76 while ((data = archive.ReadEntry(out filePath)) != null) 79 while ((data = archive.ReadEntry(out filePath)) != null)
@@ -89,7 +92,10 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver
89// } 92// }
90 else if (filePath.StartsWith(ArchiveConstants.ASSETS_PATH)) 93 else if (filePath.StartsWith(ArchiveConstants.ASSETS_PATH))
91 { 94 {
92 LoadAsset(filePath, data); 95 if (LoadAsset(filePath, data))
96 successfulAssetRestores++;
97 else
98 failedAssetRestores++;
93 } 99 }
94 else if (filePath.StartsWith(ArchiveConstants.TERRAINS_PATH)) 100 else if (filePath.StartsWith(ArchiveConstants.TERRAINS_PATH))
95 { 101 {
@@ -100,9 +106,14 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver
100 //m_log.Debug("[ARCHIVER]: Reached end of archive"); 106 //m_log.Debug("[ARCHIVER]: Reached end of archive");
101 107
102 archive.Close(); 108 archive.Close();
109
110 m_log.InfoFormat("[ARCHIVER]: Restored {0} assets", successfulAssetRestores);
111
112 if (failedAssetRestores > 0)
113 m_log.ErrorFormat("[ARCHIVER]: Failed to load {0} assets", failedAssetRestores);
103 114
104 // Reload serialized prims 115 // Reload serialized prims
105 m_log.InfoFormat("[ARCHIVER]: Loading {0} scene objects", serialisedSceneObjects.Count); 116 m_log.InfoFormat("[ARCHIVER]: Loading {0} scene objects. Please wait.", serialisedSceneObjects.Count);
106 117
107 IRegionSerialiser serialiser = m_scene.RequestModuleInterface<IRegionSerialiser>(); 118 IRegionSerialiser serialiser = m_scene.RequestModuleInterface<IRegionSerialiser>();
108 ICollection<SceneObjectGroup> sceneObjects = new List<SceneObjectGroup>(); 119 ICollection<SceneObjectGroup> sceneObjects = new List<SceneObjectGroup>();
@@ -115,12 +126,12 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver
115 sceneObjects.Add(sceneObject); 126 sceneObjects.Add(sceneObject);
116 } 127 }
117 128
118 m_log.InfoFormat("[ARCHIVER]: Restored {0} objects to the scene", sceneObjects.Count); 129 m_log.InfoFormat("[ARCHIVER]: Restored {0} scene objects to the scene", sceneObjects.Count);
119 130
120 int ignoredObjects = serialisedSceneObjects.Count - sceneObjects.Count; 131 int ignoredObjects = serialisedSceneObjects.Count - sceneObjects.Count;
121 132
122 if (ignoredObjects > 0) 133 if (ignoredObjects > 0)
123 m_log.WarnFormat("[ARCHIVER]: Ignored {0} objects that already existed in the scene", ignoredObjects); 134 m_log.WarnFormat("[ARCHIVER]: Ignored {0} scene objects that already existed in the scene", ignoredObjects);
124 135
125 m_log.InfoFormat("[ARCHIVER]: Successfully loaded archive"); 136 m_log.InfoFormat("[ARCHIVER]: Successfully loaded archive");
126 137
@@ -149,7 +160,7 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver
149 { 160 {
150 sbyte assetType = ArchiveConstants.EXTENSION_TO_ASSET_TYPE[extension]; 161 sbyte assetType = ArchiveConstants.EXTENSION_TO_ASSET_TYPE[extension];
151 162
152 m_log.DebugFormat("[ARCHIVER]: Importing asset {0}, type {1}", uuid, assetType); 163 //m_log.DebugFormat("[ARCHIVER]: Importing asset {0}, type {1}", uuid, assetType);
153 164
154 AssetBase asset = new AssetBase(new LLUUID(uuid), String.Empty); 165 AssetBase asset = new AssetBase(new LLUUID(uuid), String.Empty);
155 asset.Type = assetType; 166 asset.Type = assetType;
@@ -185,7 +196,7 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver
185 terrainModule.LoadFromStream(terrainPath, ms); 196 terrainModule.LoadFromStream(terrainPath, ms);
186 ms.Close(); 197 ms.Close();
187 198
188 m_log.DebugFormat("[ARCHIVER]: Successfully loaded terrain {0}", terrainPath); 199 m_log.DebugFormat("[ARCHIVER]: Restored terrain {0}", terrainPath);
189 200
190 return true; 201 return true;
191 } 202 }
diff --git a/OpenSim/Region/Environment/Modules/World/Archiver/ArchiveWriteRequestPreparation.cs b/OpenSim/Region/Environment/Modules/World/Archiver/ArchiveWriteRequestPreparation.cs
index a0a579c..8236b6c 100644
--- a/OpenSim/Region/Environment/Modules/World/Archiver/ArchiveWriteRequestPreparation.cs
+++ b/OpenSim/Region/Environment/Modules/World/Archiver/ArchiveWriteRequestPreparation.cs
@@ -215,7 +215,7 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver
215 215
216 // XXX: Not a great way to iterate through face textures, but there's no 216 // XXX: Not a great way to iterate through face textures, but there's no
217 // other method available to tell how many faces there actually are 217 // other method available to tell how many faces there actually are
218 int i = 0; 218 //int i = 0;
219 foreach (LLObject.TextureEntryFace texture in textureEntry.FaceTextures) 219 foreach (LLObject.TextureEntryFace texture in textureEntry.FaceTextures)
220 { 220 {
221 if (texture != null) 221 if (texture != null)
diff --git a/OpenSim/Region/Environment/Modules/World/Serialiser/SceneXmlLoader.cs b/OpenSim/Region/Environment/Modules/World/Serialiser/SceneXmlLoader.cs
index bd19a7e..6327d65 100644
--- a/OpenSim/Region/Environment/Modules/World/Serialiser/SceneXmlLoader.cs
+++ b/OpenSim/Region/Environment/Modules/World/Serialiser/SceneXmlLoader.cs
@@ -185,7 +185,7 @@ namespace OpenSim.Region.Environment.Scenes
185 { 185 {
186 SceneObjectGroup obj = new SceneObjectGroup(xmlData); 186 SceneObjectGroup obj = new SceneObjectGroup(xmlData);
187 187
188 if (scene.AddRestoredSceneObject(obj, true)) 188 if (scene.AddRestoredSceneObject(obj, true, false))
189 return obj; 189 return obj;
190 else 190 else
191 return null; 191 return null;
diff --git a/OpenSim/Region/Environment/Scenes/InnerScene.cs b/OpenSim/Region/Environment/Scenes/InnerScene.cs
index abd3387..7e8259f 100644
--- a/OpenSim/Region/Environment/Scenes/InnerScene.cs
+++ b/OpenSim/Region/Environment/Scenes/InnerScene.cs
@@ -196,10 +196,15 @@ namespace OpenSim.Region.Environment.Scenes
196 /// If true, changes to the object will be reflected in its persisted data 196 /// If true, changes to the object will be reflected in its persisted data
197 /// If false, the persisted data will not be changed even if the object in the scene is changed 197 /// If false, the persisted data will not be changed even if the object in the scene is changed
198 /// </param> 198 /// </param>
199 /// <param name="alreadyPersisted">
200 /// If true, we won't persist this object until it changes
201 /// If false, we'll persist this object immediately
202 /// </param>
199 /// <returns> 203 /// <returns>
200 /// true if the object was added, false if an object with the same uuid was already in the scene 204 /// true if the object was added, false if an object with the same uuid was already in the scene
201 /// </returns> 205 /// </returns>
202 protected internal bool AddRestoredSceneObject(SceneObjectGroup sceneObject, bool attachToBackup) 206 protected internal bool AddRestoredSceneObject(
207 SceneObjectGroup sceneObject, bool attachToBackup, bool alreadyPersisted)
203 { 208 {
204 sceneObject.RegionHandle = m_regInfo.RegionHandle; 209 sceneObject.RegionHandle = m_regInfo.RegionHandle;
205 sceneObject.SetScene(m_parentScene); 210 sceneObject.SetScene(m_parentScene);
@@ -211,6 +216,12 @@ namespace OpenSim.Region.Environment.Scenes
211 216
212 sceneObject.UpdateParentIDs(); 217 sceneObject.UpdateParentIDs();
213 218
219 if (!alreadyPersisted)
220 {
221 sceneObject.ForceInventoryPersistence();
222 sceneObject.HasGroupChanged = true;
223 }
224
214 return AddSceneObject(sceneObject, attachToBackup); 225 return AddSceneObject(sceneObject, attachToBackup);
215 } 226 }
216 227
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs
index 1564556..fb931f4 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.cs
@@ -1485,7 +1485,7 @@ namespace OpenSim.Region.Environment.Scenes
1485 List<SceneObjectGroup> PrimsFromDB = m_storageManager.DataStore.LoadObjects(regionID); 1485 List<SceneObjectGroup> PrimsFromDB = m_storageManager.DataStore.LoadObjects(regionID);
1486 foreach (SceneObjectGroup group in PrimsFromDB) 1486 foreach (SceneObjectGroup group in PrimsFromDB)
1487 { 1487 {
1488 AddRestoredSceneObject(group, true); 1488 AddRestoredSceneObject(group, true, true);
1489 SceneObjectPart rootPart = group.GetChildPart(group.UUID); 1489 SceneObjectPart rootPart = group.GetChildPart(group.UUID);
1490 rootPart.ObjectFlags &= ~(uint)LLObject.ObjectFlags.Scripted; 1490 rootPart.ObjectFlags &= ~(uint)LLObject.ObjectFlags.Scripted;
1491 rootPart.TrimPermissions(); 1491 rootPart.TrimPermissions();
@@ -1665,9 +1665,21 @@ namespace OpenSim.Region.Environment.Scenes
1665 /// Add an object into the scene that has come from storage 1665 /// Add an object into the scene that has come from storage
1666 /// </summary> 1666 /// </summary>
1667 /// <param name="sceneObject"></param> 1667 /// <param name="sceneObject"></param>
1668 public bool AddRestoredSceneObject(SceneObjectGroup sceneObject, bool attachToBackup) 1668 /// <param name="attachToBackup">
1669 /// If true, changes to the object will be reflected in its persisted data
1670 /// If false, the persisted data will not be changed even if the object in the scene is changed
1671 /// </param>
1672 /// <param name="alreadyPersisted">
1673 /// If true, we won't persist this object until it changes
1674 /// If false, we'll persist this object immediately
1675 /// </param>
1676 /// <returns>
1677 /// true if the object was added, false if an object with the same uuid was already in the scene
1678 /// </returns>
1679 public bool AddRestoredSceneObject(
1680 SceneObjectGroup sceneObject, bool attachToBackup, bool alreadyPersisted)
1669 { 1681 {
1670 return m_innerScene.AddRestoredSceneObject(sceneObject, attachToBackup); 1682 return m_innerScene.AddRestoredSceneObject(sceneObject, attachToBackup, alreadyPersisted);
1671 } 1683 }
1672 1684
1673 /// <summary> 1685 /// <summary>
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.Inventory.cs b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.Inventory.cs
index 799cb41..8feb852 100644
--- a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.Inventory.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.Inventory.cs
@@ -39,6 +39,20 @@ namespace OpenSim.Region.Environment.Scenes
39 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 39 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
40 40
41 /// <summary> 41 /// <summary>
42 /// Force all task inventories of prims in the scene object to persist
43 /// </summary>
44 public void ForceInventoryPersistence()
45 {
46 lock (m_parts)
47 {
48 foreach (SceneObjectPart part in m_parts.Values)
49 {
50 part.ForceInventoryPersistence();
51 }
52 }
53 }
54
55 /// <summary>
42 /// Start the scripts contained in all the prims in this group. 56 /// Start the scripts contained in all the prims in this group.
43 /// </summary> 57 /// </summary>
44 public void CreateScriptInstances(int startParam, bool postOnRez) 58 public void CreateScriptInstances(int startParam, bool postOnRez)
@@ -53,6 +67,9 @@ namespace OpenSim.Region.Environment.Scenes
53 } 67 }
54 } 68 }
55 69
70 /// <summary>
71 /// Stop the scripts contained in all the prims in this group
72 /// </summary>
56 public void RemoveScriptInstances() 73 public void RemoveScriptInstances()
57 { 74 {
58 lock (m_parts) 75 lock (m_parts)
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs
index 1b3d942..86e0caa 100644
--- a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs
@@ -1396,7 +1396,7 @@ namespace OpenSim.Region.Environment.Scenes
1396 } 1396 }
1397 1397
1398 /// <summary> 1398 /// <summary>
1399 /// 1399 /// Make a copy of the given part.
1400 /// </summary> 1400 /// </summary>
1401 /// <param name="part"></param> 1401 /// <param name="part"></param>
1402 /// <param name="cAgentID"></param> 1402 /// <param name="cAgentID"></param>
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectPart.Inventory.cs b/OpenSim/Region/Environment/Scenes/SceneObjectPart.Inventory.cs
index 005d872..d407392 100644
--- a/OpenSim/Region/Environment/Scenes/SceneObjectPart.Inventory.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneObjectPart.Inventory.cs
@@ -58,7 +58,15 @@ namespace OpenSim.Region.Environment.Scenes
58 /// <summary> 58 /// <summary>
59 /// Tracks whether inventory has changed since the last persistent backup 59 /// Tracks whether inventory has changed since the last persistent backup
60 /// </summary> 60 /// </summary>
61 private bool HasInventoryChanged; 61 protected bool HasInventoryChanged;
62
63 /// <summary>
64 /// Force the task inventory of this prim to persist at the next update sweep
65 /// </summary>
66 public void ForceInventoryPersistence()
67 {
68 HasInventoryChanged = true;
69 }
62 70
63 /// <summary> 71 /// <summary>
64 /// Reset LLUUIDs for all the items in the prim's inventory. This involves either generating 72 /// Reset LLUUIDs for all the items in the prim's inventory. This involves either generating
@@ -72,9 +80,7 @@ namespace OpenSim.Region.Environment.Scenes
72 lock (TaskInventory) 80 lock (TaskInventory)
73 { 81 {
74 if (0 == TaskInventory.Count) 82 if (0 == TaskInventory.Count)
75 {
76 return; 83 return;
77 }
78 84
79 HasInventoryChanged = true; 85 HasInventoryChanged = true;
80 ParentGroup.HasGroupChanged = true; 86 ParentGroup.HasGroupChanged = true;
@@ -597,7 +603,7 @@ namespace OpenSim.Region.Environment.Scenes
597 public void ProcessInventoryBackup(IRegionDataStore datastore) 603 public void ProcessInventoryBackup(IRegionDataStore datastore)
598 { 604 {
599 if (HasInventoryChanged) 605 if (HasInventoryChanged)
600 { 606 {
601 lock (TaskInventory) 607 lock (TaskInventory)
602 { 608 {
603 datastore.StorePrimInventory(UUID, TaskInventory.Values); 609 datastore.StorePrimInventory(UUID, TaskInventory.Values);