diff options
author | Justin Clarke Casey | 2009-01-29 20:08:04 +0000 |
---|---|---|
committer | Justin Clarke Casey | 2009-01-29 20:08:04 +0000 |
commit | 13f069b945b10ccdcb7ffd26392a0c9166914852 (patch) | |
tree | 89cfec025d3c41b3f94d4c93e3dcbfb53d225924 /OpenSim/Data | |
parent | Complete the implementation of llSHA1String. (diff) | |
download | opensim-SC-13f069b945b10ccdcb7ffd26392a0c9166914852.zip opensim-SC-13f069b945b10ccdcb7ffd26392a0c9166914852.tar.gz opensim-SC-13f069b945b10ccdcb7ffd26392a0c9166914852.tar.bz2 opensim-SC-13f069b945b10ccdcb7ffd26392a0c9166914852.tar.xz |
* If an orphaned group is found in the mysql or mssql databases (i.e. there is no prim where UUID = SceneGroupID), then force one prim to have UUID = SceneGroupID.
* A warning is posted about this on startup giving the location of the object
* This should allow one class of persistently undeletable prims to be removed
* This change should not cause any issues, but I still suggest that you backup your database beforehand
* If this doesn't work for previously linked objects, then you could also try the workaround in http://opensimulator.org/mantis/view.php?id=3059
* This change has been made to mysql and mssql, but sqlite appears to work in a different way
Diffstat (limited to 'OpenSim/Data')
-rw-r--r-- | OpenSim/Data/MSSQL/MSSQLRegionData.cs | 33 | ||||
-rw-r--r-- | OpenSim/Data/MySQL/MySQLRegionData.cs | 16 | ||||
-rw-r--r-- | OpenSim/Data/SQLite/SQLiteRegionData.cs | 5 |
3 files changed, 40 insertions, 14 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 |
diff --git a/OpenSim/Data/MySQL/MySQLRegionData.cs b/OpenSim/Data/MySQL/MySQLRegionData.cs index a06dbb3..e1ddb54 100644 --- a/OpenSim/Data/MySQL/MySQLRegionData.cs +++ b/OpenSim/Data/MySQL/MySQLRegionData.cs | |||
@@ -455,6 +455,20 @@ namespace OpenSim.Data.MySQL | |||
455 | objects.Add(grp); | 455 | objects.Add(grp); |
456 | 456 | ||
457 | lastGroupID = groupID; | 457 | lastGroupID = groupID; |
458 | |||
459 | // There sometimes exist OpenSim bugs that 'orphan groups' so that none of the prims are | ||
460 | // recorded as the root prim (for which the UUID must equal the persisted group UUID). In | ||
461 | // this case, force the UUID to be the same as the group UUID so that at least these can be | ||
462 | // deleted (we need to change the UUID so that any other prims in the linkset can also be | ||
463 | // deleted). | ||
464 | if (prim.UUID != groupID && groupID != UUID.Zero) | ||
465 | { | ||
466 | m_log.WarnFormat( | ||
467 | "[REGION DB]: Found root prim {0} {1} at {2} where group was actually {3}. Forcing UUID to group UUID", | ||
468 | prim.Name, prim.UUID, prim.GroupPosition, groupID); | ||
469 | |||
470 | prim.UUID = groupID; | ||
471 | } | ||
458 | 472 | ||
459 | grp = new SceneObjectGroup(prim); | 473 | grp = new SceneObjectGroup(prim); |
460 | } | 474 | } |
@@ -484,7 +498,7 @@ namespace OpenSim.Data.MySQL | |||
484 | foreach (SceneObjectPart part in prims) | 498 | foreach (SceneObjectPart part in prims) |
485 | LoadItems(part); | 499 | LoadItems(part); |
486 | 500 | ||
487 | m_log.DebugFormat("[DATABASE] Loaded {0} objects using {1} prims", objects.Count, prims.Count); | 501 | m_log.DebugFormat("[REGION DB]: Loaded {0} objects using {1} prims", objects.Count, prims.Count); |
488 | 502 | ||
489 | return objects; | 503 | return objects; |
490 | } | 504 | } |
diff --git a/OpenSim/Data/SQLite/SQLiteRegionData.cs b/OpenSim/Data/SQLite/SQLiteRegionData.cs index fce98a2..306dcb8 100644 --- a/OpenSim/Data/SQLite/SQLiteRegionData.cs +++ b/OpenSim/Data/SQLite/SQLiteRegionData.cs | |||
@@ -419,6 +419,7 @@ namespace OpenSim.Data.SQLite | |||
419 | 419 | ||
420 | string uuid = (string) primRow["UUID"]; | 420 | string uuid = (string) primRow["UUID"]; |
421 | string objID = (string) primRow["SceneGroupID"]; | 421 | string objID = (string) primRow["SceneGroupID"]; |
422 | |||
422 | if (uuid == objID) //is new SceneObjectGroup ? | 423 | if (uuid == objID) //is new SceneObjectGroup ? |
423 | { | 424 | { |
424 | SceneObjectGroup group = new SceneObjectGroup(); | 425 | SceneObjectGroup group = new SceneObjectGroup(); |
@@ -451,6 +452,7 @@ namespace OpenSim.Data.SQLite | |||
451 | } | 452 | } |
452 | } | 453 | } |
453 | } | 454 | } |
455 | |||
454 | // Now fill the groups with part data | 456 | // Now fill the groups with part data |
455 | foreach (DataRow primRow in primsForRegion) | 457 | foreach (DataRow primRow in primsForRegion) |
456 | { | 458 | { |
@@ -470,10 +472,11 @@ namespace OpenSim.Data.SQLite | |||
470 | } | 472 | } |
471 | else | 473 | else |
472 | { | 474 | { |
473 | m_log.Info( | 475 | m_log.Warn( |
474 | "[REGION DB]: No shape found for prim in storage, so setting default box shape"); | 476 | "[REGION DB]: No shape found for prim in storage, so setting default box shape"); |
475 | prim.Shape = PrimitiveBaseShape.Default; | 477 | prim.Shape = PrimitiveBaseShape.Default; |
476 | } | 478 | } |
479 | |||
477 | createdObjects[new UUID(objID)].AddPart(prim); | 480 | createdObjects[new UUID(objID)].AddPart(prim); |
478 | LoadItems(prim); | 481 | LoadItems(prim); |
479 | } | 482 | } |