diff options
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/Scene.cs')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Scene.cs | 37 |
1 files changed, 24 insertions, 13 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 94a9dab..6b71426 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs | |||
@@ -1562,18 +1562,22 @@ namespace OpenSim.Region.Framework.Scenes | |||
1562 | /// </summary> | 1562 | /// </summary> |
1563 | private void BackupWaitCallback(object o) | 1563 | private void BackupWaitCallback(object o) |
1564 | { | 1564 | { |
1565 | Backup(); | 1565 | Backup(false); |
1566 | } | 1566 | } |
1567 | 1567 | ||
1568 | /// <summary> | 1568 | /// <summary> |
1569 | /// Backup the scene. This acts as the main method of the backup thread. | 1569 | /// Backup the scene. This acts as the main method of the backup thread. |
1570 | /// </summary> | 1570 | /// </summary> |
1571 | /// <param name="forced"> | ||
1572 | /// If true, then any changes that have not yet been persisted are persisted. If false, | ||
1573 | /// then the persistence decision is left to the backup code (in some situations, such as object persistence, | ||
1574 | /// it's much more efficient to backup multiple changes at once rather than every single one). | ||
1571 | /// <returns></returns> | 1575 | /// <returns></returns> |
1572 | public void Backup() | 1576 | public void Backup(bool forced) |
1573 | { | 1577 | { |
1574 | lock (m_returns) | 1578 | lock (m_returns) |
1575 | { | 1579 | { |
1576 | EventManager.TriggerOnBackup(m_storageManager.DataStore); | 1580 | EventManager.TriggerOnBackup(m_storageManager.DataStore, forced); |
1577 | m_backingup = false; | 1581 | m_backingup = false; |
1578 | 1582 | ||
1579 | foreach (KeyValuePair<UUID, ReturnInfo> ret in m_returns) | 1583 | foreach (KeyValuePair<UUID, ReturnInfo> ret in m_returns) |
@@ -2155,7 +2159,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2155 | // rootPart.PhysActor = null; | 2159 | // rootPart.PhysActor = null; |
2156 | // } | 2160 | // } |
2157 | 2161 | ||
2158 | if (UnlinkSceneObject(group.UUID, false)) | 2162 | if (UnlinkSceneObject(group, false)) |
2159 | { | 2163 | { |
2160 | EventManager.TriggerObjectBeingRemovedFromScene(group); | 2164 | EventManager.TriggerObjectBeingRemovedFromScene(group); |
2161 | EventManager.TriggerParcelPrimCountTainted(); | 2165 | EventManager.TriggerParcelPrimCountTainted(); |
@@ -2170,18 +2174,25 @@ namespace OpenSim.Region.Framework.Scenes | |||
2170 | /// Unlink the given object from the scene. Unlike delete, this just removes the record of the object - the | 2174 | /// Unlink the given object from the scene. Unlike delete, this just removes the record of the object - the |
2171 | /// object itself is not destroyed. | 2175 | /// object itself is not destroyed. |
2172 | /// </summary> | 2176 | /// </summary> |
2173 | /// <param name="uuid">Id of object.</param> | 2177 | /// <param name="so">The scene object.</param> |
2178 | /// <param name="softDelete">If true, only deletes from scene, but keeps the object in the database.</param> | ||
2174 | /// <returns>true if the object was in the scene, false if it was not</returns> | 2179 | /// <returns>true if the object was in the scene, false if it was not</returns> |
2175 | /// <param name="softDelete">If true, only deletes from scene, but keeps object in database.</param> | 2180 | public bool UnlinkSceneObject(SceneObjectGroup so, bool softDelete) |
2176 | public bool UnlinkSceneObject(UUID uuid, bool softDelete) | ||
2177 | { | 2181 | { |
2178 | if (m_sceneGraph.DeleteSceneObject(uuid, softDelete)) | 2182 | if (m_sceneGraph.DeleteSceneObject(so.UUID, softDelete)) |
2179 | { | 2183 | { |
2180 | if (!softDelete) | 2184 | if (!softDelete) |
2181 | { | 2185 | { |
2182 | m_storageManager.DataStore.RemoveObject(uuid, | 2186 | // Force a database update so that the scene object group ID is accurate. It's possible that the |
2183 | m_regInfo.RegionID); | 2187 | // group has recently been delinked from another group but that this change has not been persisted |
2188 | // to the DB. | ||
2189 | ForceSceneObjectBackup(so); | ||
2190 | so.DetachFromBackup(); | ||
2191 | m_storageManager.DataStore.RemoveObject(so.UUID, m_regInfo.RegionID); | ||
2184 | } | 2192 | } |
2193 | |||
2194 | // We need to keep track of this state in case this group is still queued for further backup. | ||
2195 | so.IsDeleted = true; | ||
2185 | 2196 | ||
2186 | return true; | 2197 | return true; |
2187 | } | 2198 | } |
@@ -2212,7 +2223,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2212 | } | 2223 | } |
2213 | catch (Exception) | 2224 | catch (Exception) |
2214 | { | 2225 | { |
2215 | m_log.Warn("[DATABASE]: exception when trying to remove the prim that crossed the border."); | 2226 | m_log.Warn("[SCENE]: exception when trying to remove the prim that crossed the border."); |
2216 | } | 2227 | } |
2217 | return; | 2228 | return; |
2218 | } | 2229 | } |
@@ -2229,7 +2240,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2229 | } | 2240 | } |
2230 | catch (Exception) | 2241 | catch (Exception) |
2231 | { | 2242 | { |
2232 | m_log.Warn("[DATABASE]: exception when trying to return the prim that crossed the border."); | 2243 | m_log.Warn("[SCENE]: exception when trying to return the prim that crossed the border."); |
2233 | } | 2244 | } |
2234 | return; | 2245 | return; |
2235 | } | 2246 | } |