diff options
author | Justin Clark-Casey (justincc) | 2010-08-26 00:17:26 +0100 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2010-08-26 00:17:26 +0100 |
commit | 692cf3c657aaa74645722491c997f23b4d6f8f76 (patch) | |
tree | 9eeceadc2e326f718ee1aed04e5547fa53a4ca31 /OpenSim/Data/MSSQL | |
parent | replace m_parts.Count linknum with 0 in CopyRootPart since m_parts.Count is a... (diff) | |
download | opensim-SC_OLD-692cf3c657aaa74645722491c997f23b4d6f8f76.zip opensim-SC_OLD-692cf3c657aaa74645722491c997f23b4d6f8f76.tar.gz opensim-SC_OLD-692cf3c657aaa74645722491c997f23b4d6f8f76.tar.bz2 opensim-SC_OLD-692cf3c657aaa74645722491c997f23b4d6f8f76.tar.xz |
Remove parts locking from data classes since these are using a copy of the scene object
Diffstat (limited to 'OpenSim/Data/MSSQL')
-rw-r--r-- | OpenSim/Data/MSSQL/MSSQLLegacyRegionData.cs | 94 |
1 files changed, 45 insertions, 49 deletions
diff --git a/OpenSim/Data/MSSQL/MSSQLLegacyRegionData.cs b/OpenSim/Data/MSSQL/MSSQLLegacyRegionData.cs index 4ce93e5..7ff8737 100644 --- a/OpenSim/Data/MSSQL/MSSQLLegacyRegionData.cs +++ b/OpenSim/Data/MSSQL/MSSQLLegacyRegionData.cs | |||
@@ -89,7 +89,6 @@ namespace OpenSim.Data.MSSQL | |||
89 | Dictionary<UUID, SceneObjectGroup> objects = new Dictionary<UUID, SceneObjectGroup>(); | 89 | Dictionary<UUID, SceneObjectGroup> objects = new Dictionary<UUID, SceneObjectGroup>(); |
90 | SceneObjectGroup grp = null; | 90 | SceneObjectGroup grp = null; |
91 | 91 | ||
92 | |||
93 | string sql = "SELECT *, " + | 92 | string sql = "SELECT *, " + |
94 | "sort = CASE WHEN prims.UUID = prims.SceneGroupID THEN 0 ELSE 1 END " + | 93 | "sort = CASE WHEN prims.UUID = prims.SceneGroupID THEN 0 ELSE 1 END " + |
95 | "FROM prims " + | 94 | "FROM prims " + |
@@ -232,66 +231,63 @@ namespace OpenSim.Data.MSSQL | |||
232 | /// <param name="regionUUID"></param> | 231 | /// <param name="regionUUID"></param> |
233 | public void StoreObject(SceneObjectGroup obj, UUID regionUUID) | 232 | public void StoreObject(SceneObjectGroup obj, UUID regionUUID) |
234 | { | 233 | { |
235 | lock (obj.Children) | 234 | _Log.DebugFormat("[MSSQL]: Adding/Changing SceneObjectGroup: {0} to region: {1}, object has {2} prims.", obj.UUID, regionUUID, obj.Children.Count); |
235 | |||
236 | using (SqlConnection conn = new SqlConnection(m_connectionString)) | ||
236 | { | 237 | { |
237 | _Log.DebugFormat("[MSSQL]: Adding/Changing SceneObjectGroup: {0} to region: {1}, object has {2} prims.", obj.UUID, regionUUID, obj.Children.Count); | 238 | conn.Open(); |
238 | 239 | SqlTransaction transaction = conn.BeginTransaction(); | |
239 | using (SqlConnection conn = new SqlConnection(m_connectionString)) | 240 | |
241 | try | ||
240 | { | 242 | { |
241 | conn.Open(); | 243 | foreach (SceneObjectPart sceneObjectPart in obj.Children.Values) |
242 | SqlTransaction transaction = conn.BeginTransaction(); | ||
243 | |||
244 | try | ||
245 | { | 244 | { |
246 | foreach (SceneObjectPart sceneObjectPart in obj.Children.Values) | 245 | //Update prim |
246 | using (SqlCommand sqlCommand = conn.CreateCommand()) | ||
247 | { | 247 | { |
248 | //Update prim | 248 | sqlCommand.Transaction = transaction; |
249 | using (SqlCommand sqlCommand = conn.CreateCommand()) | 249 | try |
250 | { | 250 | { |
251 | sqlCommand.Transaction = transaction; | 251 | StoreSceneObjectPrim(sceneObjectPart, sqlCommand, obj.UUID, regionUUID); |
252 | try | ||
253 | { | ||
254 | StoreSceneObjectPrim(sceneObjectPart, sqlCommand, obj.UUID, regionUUID); | ||
255 | } | ||
256 | catch (SqlException sqlEx) | ||
257 | { | ||
258 | _Log.ErrorFormat("[REGION DB]: Store SceneObjectPrim SQL error: {0} at line {1}", sqlEx.Message, sqlEx.LineNumber); | ||
259 | throw; | ||
260 | } | ||
261 | } | 252 | } |
262 | 253 | catch (SqlException sqlEx) | |
263 | //Update primshapes | ||
264 | using (SqlCommand sqlCommand = conn.CreateCommand()) | ||
265 | { | 254 | { |
266 | sqlCommand.Transaction = transaction; | 255 | _Log.ErrorFormat("[REGION DB]: Store SceneObjectPrim SQL error: {0} at line {1}", sqlEx.Message, sqlEx.LineNumber); |
267 | try | 256 | throw; |
268 | { | ||
269 | StoreSceneObjectPrimShapes(sceneObjectPart, sqlCommand, obj.UUID, regionUUID); | ||
270 | } | ||
271 | catch (SqlException sqlEx) | ||
272 | { | ||
273 | _Log.ErrorFormat("[REGION DB]: Store SceneObjectPrimShapes SQL error: {0} at line {1}", sqlEx.Message, sqlEx.LineNumber); | ||
274 | throw; | ||
275 | } | ||
276 | } | 257 | } |
277 | } | 258 | } |
278 | 259 | ||
279 | transaction.Commit(); | 260 | //Update primshapes |
280 | } | 261 | using (SqlCommand sqlCommand = conn.CreateCommand()) |
281 | catch (Exception ex) | ||
282 | { | ||
283 | _Log.ErrorFormat("[REGION DB]: Store SceneObjectGroup error: {0}, Rolling back...", ex.Message); | ||
284 | try | ||
285 | { | ||
286 | transaction.Rollback(); | ||
287 | } | ||
288 | catch (Exception ex2) | ||
289 | { | 262 | { |
290 | //Show error | 263 | sqlCommand.Transaction = transaction; |
291 | _Log.InfoFormat("[REGION DB]: Rollback of SceneObjectGroup store transaction failed with error: {0}", ex2.Message); | 264 | try |
292 | 265 | { | |
266 | StoreSceneObjectPrimShapes(sceneObjectPart, sqlCommand, obj.UUID, regionUUID); | ||
267 | } | ||
268 | catch (SqlException sqlEx) | ||
269 | { | ||
270 | _Log.ErrorFormat("[REGION DB]: Store SceneObjectPrimShapes SQL error: {0} at line {1}", sqlEx.Message, sqlEx.LineNumber); | ||
271 | throw; | ||
272 | } | ||
293 | } | 273 | } |
294 | } | 274 | } |
275 | |||
276 | transaction.Commit(); | ||
277 | } | ||
278 | catch (Exception ex) | ||
279 | { | ||
280 | _Log.ErrorFormat("[REGION DB]: Store SceneObjectGroup error: {0}, Rolling back...", ex.Message); | ||
281 | try | ||
282 | { | ||
283 | transaction.Rollback(); | ||
284 | } | ||
285 | catch (Exception ex2) | ||
286 | { | ||
287 | //Show error | ||
288 | _Log.InfoFormat("[REGION DB]: Rollback of SceneObjectGroup store transaction failed with error: {0}", ex2.Message); | ||
289 | |||
290 | } | ||
295 | } | 291 | } |
296 | } | 292 | } |
297 | } | 293 | } |