diff options
Diffstat (limited to 'OpenSim/Data/MSSQL')
-rw-r--r-- | OpenSim/Data/MSSQL/MSSQLRegionData.cs | 33 |
1 files changed, 21 insertions, 12 deletions
diff --git a/OpenSim/Data/MSSQL/MSSQLRegionData.cs b/OpenSim/Data/MSSQL/MSSQLRegionData.cs index 5ab29ff..2388207 100644 --- a/OpenSim/Data/MSSQL/MSSQLRegionData.cs +++ b/OpenSim/Data/MSSQL/MSSQLRegionData.cs | |||
@@ -79,7 +79,6 @@ namespace OpenSim.Data.MSSQL | |||
79 | 79 | ||
80 | //Migration settings | 80 | //Migration settings |
81 | _Database.CheckMigration(_migrationStore); | 81 | _Database.CheckMigration(_migrationStore); |
82 | |||
83 | } | 82 | } |
84 | 83 | ||
85 | /// <summary> | 84 | /// <summary> |
@@ -124,10 +123,9 @@ namespace OpenSim.Data.MSSQL | |||
124 | else | 123 | else |
125 | sceneObjectPart.Shape = BuildShape(reader); | 124 | sceneObjectPart.Shape = BuildShape(reader); |
126 | 125 | ||
127 | sceneObjectPart.FolderID = sceneObjectPart.UUID; // A relic from when we | 126 | // A relic from when we we thought that prims contained folder objects. In |
128 | // we thought prims contained | 127 | // reality, prim == folder |
129 | // folder objects. In | 128 | sceneObjectPart.FolderID = sceneObjectPart.UUID; |
130 | // reality, prim == folder | ||
131 | sceneObjectParts.Add(sceneObjectPart); | 129 | sceneObjectParts.Add(sceneObjectPart); |
132 | 130 | ||
133 | UUID groupID = new UUID(reader["SceneGroupID"].ToString()); | 131 | UUID groupID = new UUID(reader["SceneGroupID"].ToString()); |
@@ -138,6 +136,20 @@ namespace OpenSim.Data.MSSQL | |||
138 | sceneObjectGroups.Add(grp); | 136 | sceneObjectGroups.Add(grp); |
139 | 137 | ||
140 | lastGroupID = groupID; | 138 | lastGroupID = groupID; |
139 | |||
140 | // There sometimes exist OpenSim bugs that 'orphan groups' so that none of the prims are | ||
141 | // recorded as the root prim (for which the UUID must equal the persisted group UUID). In | ||
142 | // this case, force the UUID to be the same as the group UUID so that at least these can be | ||
143 | // deleted (we need to change the UUID so that any other prims in the linkset can also be | ||
144 | // deleted). | ||
145 | if (sceneObjectPart.UUID != groupID && groupID != UUID.Zero) | ||
146 | { | ||
147 | _Log.WarnFormat( | ||
148 | "[REGION DB]: Found root prim {0} {1} at {2} where group was actually {3}. Forcing UUID to group UUID", | ||
149 | sceneObjectPart.Name, sceneObjectPart.UUID, sceneObjectPart.GroupPosition, groupID); | ||
150 | |||
151 | sceneObjectPart.UUID = groupID; | ||
152 | } | ||
141 | 153 | ||
142 | grp = new SceneObjectGroup(sceneObjectPart); | 154 | grp = new SceneObjectGroup(sceneObjectPart); |
143 | } | 155 | } |
@@ -162,10 +174,9 @@ namespace OpenSim.Data.MSSQL | |||
162 | //Load the inventory off all sceneobjects within the region | 174 | //Load the inventory off all sceneobjects within the region |
163 | LoadItems(sceneObjectParts); | 175 | LoadItems(sceneObjectParts); |
164 | 176 | ||
165 | _Log.DebugFormat("[DATABASE] Loaded {0} objects using {1} prims", sceneObjectGroups.Count, sceneObjectParts.Count); | 177 | _Log.DebugFormat("[REGION DB]: Loaded {0} objects using {1} prims", sceneObjectGroups.Count, sceneObjectParts.Count); |
166 | 178 | ||
167 | return sceneObjectGroups; | 179 | return sceneObjectGroups; |
168 | |||
169 | } | 180 | } |
170 | 181 | ||
171 | /// <summary> | 182 | /// <summary> |
@@ -216,7 +227,7 @@ namespace OpenSim.Data.MSSQL | |||
216 | /// <param name="regionUUID"></param> | 227 | /// <param name="regionUUID"></param> |
217 | public void StoreObject(SceneObjectGroup obj, UUID regionUUID) | 228 | public void StoreObject(SceneObjectGroup obj, UUID regionUUID) |
218 | { | 229 | { |
219 | _Log.InfoFormat("[REGION DB]: Adding/Changing SceneObjectGroup: {0} to region: {1}, object has {2} prims.", obj.UUID, regionUUID, obj.Children.Count); | 230 | _Log.InfoFormat("[MSSQL]: Adding/Changing SceneObjectGroup: {0} to region: {1}, object has {2} prims.", obj.UUID, regionUUID, obj.Children.Count); |
220 | 231 | ||
221 | using (SqlConnection conn = _Database.DatabaseConnection()) | 232 | using (SqlConnection conn = _Database.DatabaseConnection()) |
222 | { | 233 | { |
@@ -404,7 +415,7 @@ ELSE | |||
404 | /// <param name="regionUUID">regionUUID (is this used anyway</param> | 415 | /// <param name="regionUUID">regionUUID (is this used anyway</param> |
405 | public void RemoveObject(UUID objectID, UUID regionUUID) | 416 | public void RemoveObject(UUID objectID, UUID regionUUID) |
406 | { | 417 | { |
407 | _Log.InfoFormat("[REGION DB]: Removing obj: {0} from region: {1}", objectID, regionUUID); | 418 | _Log.InfoFormat("[MSSQL]: Removing obj: {0} from region: {1}", objectID, regionUUID); |
408 | 419 | ||
409 | //Remove from prims and primsitem table | 420 | //Remove from prims and primsitem table |
410 | string sqlPrims = string.Format("DELETE FROM PRIMS WHERE SceneGroupID = '{0}'", objectID); | 421 | string sqlPrims = string.Format("DELETE FROM PRIMS WHERE SceneGroupID = '{0}'", objectID); |
@@ -1482,9 +1493,7 @@ VALUES | |||
1482 | 1493 | ||
1483 | return parameters.ToArray(); | 1494 | return parameters.ToArray(); |
1484 | } | 1495 | } |
1485 | 1496 | ||
1486 | |||
1487 | |||
1488 | #endregion | 1497 | #endregion |
1489 | 1498 | ||
1490 | #endregion | 1499 | #endregion |