* 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
0.6.3-post-fixes
Justin Clarke Casey 2009-01-29 20:08:04 +00:00
parent ea6e4a95ce
commit 13f069b945
3 changed files with 40 additions and 14 deletions

View File

@ -79,7 +79,6 @@ namespace OpenSim.Data.MSSQL
//Migration settings //Migration settings
_Database.CheckMigration(_migrationStore); _Database.CheckMigration(_migrationStore);
} }
/// <summary> /// <summary>
@ -124,10 +123,9 @@ namespace OpenSim.Data.MSSQL
else else
sceneObjectPart.Shape = BuildShape(reader); sceneObjectPart.Shape = BuildShape(reader);
sceneObjectPart.FolderID = sceneObjectPart.UUID; // A relic from when we // A relic from when we we thought that prims contained folder objects. In
// we thought prims contained // reality, prim == folder
// folder objects. In sceneObjectPart.FolderID = sceneObjectPart.UUID;
// reality, prim == folder
sceneObjectParts.Add(sceneObjectPart); sceneObjectParts.Add(sceneObjectPart);
UUID groupID = new UUID(reader["SceneGroupID"].ToString()); UUID groupID = new UUID(reader["SceneGroupID"].ToString());
@ -138,6 +136,20 @@ namespace OpenSim.Data.MSSQL
sceneObjectGroups.Add(grp); sceneObjectGroups.Add(grp);
lastGroupID = groupID; lastGroupID = groupID;
// There sometimes exist OpenSim bugs that 'orphan groups' so that none of the prims are
// recorded as the root prim (for which the UUID must equal the persisted group UUID). In
// this case, force the UUID to be the same as the group UUID so that at least these can be
// deleted (we need to change the UUID so that any other prims in the linkset can also be
// deleted).
if (sceneObjectPart.UUID != groupID && groupID != UUID.Zero)
{
_Log.WarnFormat(
"[REGION DB]: Found root prim {0} {1} at {2} where group was actually {3}. Forcing UUID to group UUID",
sceneObjectPart.Name, sceneObjectPart.UUID, sceneObjectPart.GroupPosition, groupID);
sceneObjectPart.UUID = groupID;
}
grp = new SceneObjectGroup(sceneObjectPart); grp = new SceneObjectGroup(sceneObjectPart);
} }
@ -162,10 +174,9 @@ namespace OpenSim.Data.MSSQL
//Load the inventory off all sceneobjects within the region //Load the inventory off all sceneobjects within the region
LoadItems(sceneObjectParts); LoadItems(sceneObjectParts);
_Log.DebugFormat("[DATABASE] Loaded {0} objects using {1} prims", sceneObjectGroups.Count, sceneObjectParts.Count); _Log.DebugFormat("[REGION DB]: Loaded {0} objects using {1} prims", sceneObjectGroups.Count, sceneObjectParts.Count);
return sceneObjectGroups; return sceneObjectGroups;
} }
/// <summary> /// <summary>
@ -216,7 +227,7 @@ namespace OpenSim.Data.MSSQL
/// <param name="regionUUID"></param> /// <param name="regionUUID"></param>
public void StoreObject(SceneObjectGroup obj, UUID regionUUID) public void StoreObject(SceneObjectGroup obj, UUID regionUUID)
{ {
_Log.InfoFormat("[REGION DB]: Adding/Changing SceneObjectGroup: {0} to region: {1}, object has {2} prims.", obj.UUID, regionUUID, obj.Children.Count); _Log.InfoFormat("[MSSQL]: Adding/Changing SceneObjectGroup: {0} to region: {1}, object has {2} prims.", obj.UUID, regionUUID, obj.Children.Count);
using (SqlConnection conn = _Database.DatabaseConnection()) using (SqlConnection conn = _Database.DatabaseConnection())
{ {
@ -404,7 +415,7 @@ ELSE
/// <param name="regionUUID">regionUUID (is this used anyway</param> /// <param name="regionUUID">regionUUID (is this used anyway</param>
public void RemoveObject(UUID objectID, UUID regionUUID) public void RemoveObject(UUID objectID, UUID regionUUID)
{ {
_Log.InfoFormat("[REGION DB]: Removing obj: {0} from region: {1}", objectID, regionUUID); _Log.InfoFormat("[MSSQL]: Removing obj: {0} from region: {1}", objectID, regionUUID);
//Remove from prims and primsitem table //Remove from prims and primsitem table
string sqlPrims = string.Format("DELETE FROM PRIMS WHERE SceneGroupID = '{0}'", objectID); string sqlPrims = string.Format("DELETE FROM PRIMS WHERE SceneGroupID = '{0}'", objectID);
@ -1482,9 +1493,7 @@ VALUES
return parameters.ToArray(); return parameters.ToArray();
} }
#endregion #endregion
#endregion #endregion

View File

@ -455,6 +455,20 @@ namespace OpenSim.Data.MySQL
objects.Add(grp); objects.Add(grp);
lastGroupID = groupID; lastGroupID = groupID;
// There sometimes exist OpenSim bugs that 'orphan groups' so that none of the prims are
// recorded as the root prim (for which the UUID must equal the persisted group UUID). In
// this case, force the UUID to be the same as the group UUID so that at least these can be
// deleted (we need to change the UUID so that any other prims in the linkset can also be
// deleted).
if (prim.UUID != groupID && groupID != UUID.Zero)
{
m_log.WarnFormat(
"[REGION DB]: Found root prim {0} {1} at {2} where group was actually {3}. Forcing UUID to group UUID",
prim.Name, prim.UUID, prim.GroupPosition, groupID);
prim.UUID = groupID;
}
grp = new SceneObjectGroup(prim); grp = new SceneObjectGroup(prim);
} }
@ -484,7 +498,7 @@ namespace OpenSim.Data.MySQL
foreach (SceneObjectPart part in prims) foreach (SceneObjectPart part in prims)
LoadItems(part); LoadItems(part);
m_log.DebugFormat("[DATABASE] Loaded {0} objects using {1} prims", objects.Count, prims.Count); m_log.DebugFormat("[REGION DB]: Loaded {0} objects using {1} prims", objects.Count, prims.Count);
return objects; return objects;
} }

View File

@ -419,6 +419,7 @@ namespace OpenSim.Data.SQLite
string uuid = (string) primRow["UUID"]; string uuid = (string) primRow["UUID"];
string objID = (string) primRow["SceneGroupID"]; string objID = (string) primRow["SceneGroupID"];
if (uuid == objID) //is new SceneObjectGroup ? if (uuid == objID) //is new SceneObjectGroup ?
{ {
SceneObjectGroup group = new SceneObjectGroup(); SceneObjectGroup group = new SceneObjectGroup();
@ -451,6 +452,7 @@ namespace OpenSim.Data.SQLite
} }
} }
} }
// Now fill the groups with part data // Now fill the groups with part data
foreach (DataRow primRow in primsForRegion) foreach (DataRow primRow in primsForRegion)
{ {
@ -470,10 +472,11 @@ namespace OpenSim.Data.SQLite
} }
else else
{ {
m_log.Info( m_log.Warn(
"[REGION DB]: No shape found for prim in storage, so setting default box shape"); "[REGION DB]: No shape found for prim in storage, so setting default box shape");
prim.Shape = PrimitiveBaseShape.Default; prim.Shape = PrimitiveBaseShape.Default;
} }
createdObjects[new UUID(objID)].AddPart(prim); createdObjects[new UUID(objID)].AddPart(prim);
LoadItems(prim); LoadItems(prim);
} }