aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Data
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2010-08-26 00:17:26 +0100
committerJustin Clark-Casey (justincc)2010-08-26 00:17:26 +0100
commit692cf3c657aaa74645722491c997f23b4d6f8f76 (patch)
tree9eeceadc2e326f718ee1aed04e5547fa53a4ca31 /OpenSim/Data
parentreplace m_parts.Count linknum with 0 in CopyRootPart since m_parts.Count is a... (diff)
downloadopensim-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')
-rw-r--r--OpenSim/Data/MSSQL/MSSQLLegacyRegionData.cs94
-rw-r--r--OpenSim/Data/MySQL/MySQLLegacyRegionData.cs211
-rw-r--r--OpenSim/Data/SQLite/SQLiteRegionData.cs9
-rw-r--r--OpenSim/Data/SQLiteLegacy/SQLiteRegionData.cs9
4 files changed, 155 insertions, 168 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 }
diff --git a/OpenSim/Data/MySQL/MySQLLegacyRegionData.cs b/OpenSim/Data/MySQL/MySQLLegacyRegionData.cs
index b756b4f..37d7a88 100644
--- a/OpenSim/Data/MySQL/MySQLLegacyRegionData.cs
+++ b/OpenSim/Data/MySQL/MySQLLegacyRegionData.cs
@@ -135,115 +135,112 @@ namespace OpenSim.Data.MySQL
135 dbcon.Open(); 135 dbcon.Open();
136 MySqlCommand cmd = dbcon.CreateCommand(); 136 MySqlCommand cmd = dbcon.CreateCommand();
137 137
138 lock (obj.Children) 138 foreach (SceneObjectPart prim in obj.Children.Values)
139 { 139 {
140 foreach (SceneObjectPart prim in obj.Children.Values) 140 cmd.Parameters.Clear();
141 { 141
142 cmd.Parameters.Clear(); 142 cmd.CommandText = "replace into prims (" +
143 143 "UUID, CreationDate, " +
144 cmd.CommandText = "replace into prims (" + 144 "Name, Text, Description, " +
145 "UUID, CreationDate, " + 145 "SitName, TouchName, ObjectFlags, " +
146 "Name, Text, Description, " + 146 "OwnerMask, NextOwnerMask, GroupMask, " +
147 "SitName, TouchName, ObjectFlags, " + 147 "EveryoneMask, BaseMask, PositionX, " +
148 "OwnerMask, NextOwnerMask, GroupMask, " + 148 "PositionY, PositionZ, GroupPositionX, " +
149 "EveryoneMask, BaseMask, PositionX, " + 149 "GroupPositionY, GroupPositionZ, VelocityX, " +
150 "PositionY, PositionZ, GroupPositionX, " + 150 "VelocityY, VelocityZ, AngularVelocityX, " +
151 "GroupPositionY, GroupPositionZ, VelocityX, " + 151 "AngularVelocityY, AngularVelocityZ, " +
152 "VelocityY, VelocityZ, AngularVelocityX, " + 152 "AccelerationX, AccelerationY, " +
153 "AngularVelocityY, AngularVelocityZ, " + 153 "AccelerationZ, RotationX, " +
154 "AccelerationX, AccelerationY, " + 154 "RotationY, RotationZ, " +
155 "AccelerationZ, RotationX, " + 155 "RotationW, SitTargetOffsetX, " +
156 "RotationY, RotationZ, " + 156 "SitTargetOffsetY, SitTargetOffsetZ, " +
157 "RotationW, SitTargetOffsetX, " + 157 "SitTargetOrientW, SitTargetOrientX, " +
158 "SitTargetOffsetY, SitTargetOffsetZ, " + 158 "SitTargetOrientY, SitTargetOrientZ, " +
159 "SitTargetOrientW, SitTargetOrientX, " + 159 "RegionUUID, CreatorID, " +
160 "SitTargetOrientY, SitTargetOrientZ, " + 160 "OwnerID, GroupID, " +
161 "RegionUUID, CreatorID, " + 161 "LastOwnerID, SceneGroupID, " +
162 "OwnerID, GroupID, " + 162 "PayPrice, PayButton1, " +
163 "LastOwnerID, SceneGroupID, " + 163 "PayButton2, PayButton3, " +
164 "PayPrice, PayButton1, " + 164 "PayButton4, LoopedSound, " +
165 "PayButton2, PayButton3, " + 165 "LoopedSoundGain, TextureAnimation, " +
166 "PayButton4, LoopedSound, " + 166 "OmegaX, OmegaY, OmegaZ, " +
167 "LoopedSoundGain, TextureAnimation, " + 167 "CameraEyeOffsetX, CameraEyeOffsetY, " +
168 "OmegaX, OmegaY, OmegaZ, " + 168 "CameraEyeOffsetZ, CameraAtOffsetX, " +
169 "CameraEyeOffsetX, CameraEyeOffsetY, " + 169 "CameraAtOffsetY, CameraAtOffsetZ, " +
170 "CameraEyeOffsetZ, CameraAtOffsetX, " + 170 "ForceMouselook, ScriptAccessPin, " +
171 "CameraAtOffsetY, CameraAtOffsetZ, " + 171 "AllowedDrop, DieAtEdge, " +
172 "ForceMouselook, ScriptAccessPin, " + 172 "SalePrice, SaleType, " +
173 "AllowedDrop, DieAtEdge, " + 173 "ColorR, ColorG, ColorB, ColorA, " +
174 "SalePrice, SaleType, " + 174 "ParticleSystem, ClickAction, Material, " +
175 "ColorR, ColorG, ColorB, ColorA, " + 175 "CollisionSound, CollisionSoundVolume, " +
176 "ParticleSystem, ClickAction, Material, " + 176 "PassTouches, " +
177 "CollisionSound, CollisionSoundVolume, " + 177 "LinkNumber, MediaURL) values (" + "?UUID, " +
178 "PassTouches, " + 178 "?CreationDate, ?Name, ?Text, " +
179 "LinkNumber, MediaURL) values (" + "?UUID, " + 179 "?Description, ?SitName, ?TouchName, " +
180 "?CreationDate, ?Name, ?Text, " + 180 "?ObjectFlags, ?OwnerMask, ?NextOwnerMask, " +
181 "?Description, ?SitName, ?TouchName, " + 181 "?GroupMask, ?EveryoneMask, ?BaseMask, " +
182 "?ObjectFlags, ?OwnerMask, ?NextOwnerMask, " + 182 "?PositionX, ?PositionY, ?PositionZ, " +
183 "?GroupMask, ?EveryoneMask, ?BaseMask, " + 183 "?GroupPositionX, ?GroupPositionY, " +
184 "?PositionX, ?PositionY, ?PositionZ, " + 184 "?GroupPositionZ, ?VelocityX, " +
185 "?GroupPositionX, ?GroupPositionY, " + 185 "?VelocityY, ?VelocityZ, ?AngularVelocityX, " +
186 "?GroupPositionZ, ?VelocityX, " + 186 "?AngularVelocityY, ?AngularVelocityZ, " +
187 "?VelocityY, ?VelocityZ, ?AngularVelocityX, " + 187 "?AccelerationX, ?AccelerationY, " +
188 "?AngularVelocityY, ?AngularVelocityZ, " + 188 "?AccelerationZ, ?RotationX, " +
189 "?AccelerationX, ?AccelerationY, " + 189 "?RotationY, ?RotationZ, " +
190 "?AccelerationZ, ?RotationX, " + 190 "?RotationW, ?SitTargetOffsetX, " +
191 "?RotationY, ?RotationZ, " + 191 "?SitTargetOffsetY, ?SitTargetOffsetZ, " +
192 "?RotationW, ?SitTargetOffsetX, " + 192 "?SitTargetOrientW, ?SitTargetOrientX, " +
193 "?SitTargetOffsetY, ?SitTargetOffsetZ, " + 193 "?SitTargetOrientY, ?SitTargetOrientZ, " +
194 "?SitTargetOrientW, ?SitTargetOrientX, " + 194 "?RegionUUID, ?CreatorID, ?OwnerID, " +
195 "?SitTargetOrientY, ?SitTargetOrientZ, " + 195 "?GroupID, ?LastOwnerID, ?SceneGroupID, " +
196 "?RegionUUID, ?CreatorID, ?OwnerID, " + 196 "?PayPrice, ?PayButton1, ?PayButton2, " +
197 "?GroupID, ?LastOwnerID, ?SceneGroupID, " + 197 "?PayButton3, ?PayButton4, ?LoopedSound, " +
198 "?PayPrice, ?PayButton1, ?PayButton2, " + 198 "?LoopedSoundGain, ?TextureAnimation, " +
199 "?PayButton3, ?PayButton4, ?LoopedSound, " + 199 "?OmegaX, ?OmegaY, ?OmegaZ, " +
200 "?LoopedSoundGain, ?TextureAnimation, " + 200 "?CameraEyeOffsetX, ?CameraEyeOffsetY, " +
201 "?OmegaX, ?OmegaY, ?OmegaZ, " + 201 "?CameraEyeOffsetZ, ?CameraAtOffsetX, " +
202 "?CameraEyeOffsetX, ?CameraEyeOffsetY, " + 202 "?CameraAtOffsetY, ?CameraAtOffsetZ, " +
203 "?CameraEyeOffsetZ, ?CameraAtOffsetX, " + 203 "?ForceMouselook, ?ScriptAccessPin, " +
204 "?CameraAtOffsetY, ?CameraAtOffsetZ, " + 204 "?AllowedDrop, ?DieAtEdge, ?SalePrice, " +
205 "?ForceMouselook, ?ScriptAccessPin, " + 205 "?SaleType, ?ColorR, ?ColorG, " +
206 "?AllowedDrop, ?DieAtEdge, ?SalePrice, " + 206 "?ColorB, ?ColorA, ?ParticleSystem, " +
207 "?SaleType, ?ColorR, ?ColorG, " + 207 "?ClickAction, ?Material, ?CollisionSound, " +
208 "?ColorB, ?ColorA, ?ParticleSystem, " + 208 "?CollisionSoundVolume, ?PassTouches, ?LinkNumber, ?MediaURL)";
209 "?ClickAction, ?Material, ?CollisionSound, " + 209
210 "?CollisionSoundVolume, ?PassTouches, ?LinkNumber, ?MediaURL)"; 210 FillPrimCommand(cmd, prim, obj.UUID, regionUUID);
211 211
212 FillPrimCommand(cmd, prim, obj.UUID, regionUUID); 212 ExecuteNonQuery(cmd);
213 213
214 ExecuteNonQuery(cmd); 214 cmd.Parameters.Clear();
215 215
216 cmd.Parameters.Clear(); 216 cmd.CommandText = "replace into primshapes (" +
217 217 "UUID, Shape, ScaleX, ScaleY, " +
218 cmd.CommandText = "replace into primshapes (" + 218 "ScaleZ, PCode, PathBegin, PathEnd, " +
219 "UUID, Shape, ScaleX, ScaleY, " + 219 "PathScaleX, PathScaleY, PathShearX, " +
220 "ScaleZ, PCode, PathBegin, PathEnd, " + 220 "PathShearY, PathSkew, PathCurve, " +
221 "PathScaleX, PathScaleY, PathShearX, " + 221 "PathRadiusOffset, PathRevolutions, " +
222 "PathShearY, PathSkew, PathCurve, " + 222 "PathTaperX, PathTaperY, PathTwist, " +
223 "PathRadiusOffset, PathRevolutions, " + 223 "PathTwistBegin, ProfileBegin, ProfileEnd, " +
224 "PathTaperX, PathTaperY, PathTwist, " + 224 "ProfileCurve, ProfileHollow, Texture, " +
225 "PathTwistBegin, ProfileBegin, ProfileEnd, " + 225 "ExtraParams, State, Media) values (?UUID, " +
226 "ProfileCurve, ProfileHollow, Texture, " + 226 "?Shape, ?ScaleX, ?ScaleY, ?ScaleZ, " +
227 "ExtraParams, State, Media) values (?UUID, " + 227 "?PCode, ?PathBegin, ?PathEnd, " +
228 "?Shape, ?ScaleX, ?ScaleY, ?ScaleZ, " + 228 "?PathScaleX, ?PathScaleY, " +
229 "?PCode, ?PathBegin, ?PathEnd, " + 229 "?PathShearX, ?PathShearY, " +
230 "?PathScaleX, ?PathScaleY, " + 230 "?PathSkew, ?PathCurve, ?PathRadiusOffset, " +
231 "?PathShearX, ?PathShearY, " + 231 "?PathRevolutions, ?PathTaperX, " +
232 "?PathSkew, ?PathCurve, ?PathRadiusOffset, " + 232 "?PathTaperY, ?PathTwist, " +
233 "?PathRevolutions, ?PathTaperX, " + 233 "?PathTwistBegin, ?ProfileBegin, " +
234 "?PathTaperY, ?PathTwist, " + 234 "?ProfileEnd, ?ProfileCurve, " +
235 "?PathTwistBegin, ?ProfileBegin, " + 235 "?ProfileHollow, ?Texture, ?ExtraParams, " +
236 "?ProfileEnd, ?ProfileCurve, " + 236 "?State, ?Media)";
237 "?ProfileHollow, ?Texture, ?ExtraParams, " + 237
238 "?State, ?Media)"; 238 FillShapeCommand(cmd, prim);
239 239
240 FillShapeCommand(cmd, prim); 240 ExecuteNonQuery(cmd);
241
242 ExecuteNonQuery(cmd);
243 }
244
245 cmd.Dispose();
246 } 241 }
242
243 cmd.Dispose();
247 } 244 }
248 } 245 }
249 } 246 }
diff --git a/OpenSim/Data/SQLite/SQLiteRegionData.cs b/OpenSim/Data/SQLite/SQLiteRegionData.cs
index bfd8279..4208050 100644
--- a/OpenSim/Data/SQLite/SQLiteRegionData.cs
+++ b/OpenSim/Data/SQLite/SQLiteRegionData.cs
@@ -360,13 +360,10 @@ namespace OpenSim.Data.SQLite
360 360
361 lock (ds) 361 lock (ds)
362 { 362 {
363 lock (obj.Children) 363 foreach (SceneObjectPart prim in obj.Children.Values)
364 { 364 {
365 foreach (SceneObjectPart prim in obj.Children.Values) 365// m_log.Info("[REGION DB]: Adding obj: " + obj.UUID + " to region: " + regionUUID);
366 { 366 addPrim(prim, obj.UUID, regionUUID);
367 // m_log.Info("[REGION DB]: Adding obj: " + obj.UUID + " to region: " + regionUUID);
368 addPrim(prim, obj.UUID, regionUUID);
369 }
370 } 367 }
371 } 368 }
372 369
diff --git a/OpenSim/Data/SQLiteLegacy/SQLiteRegionData.cs b/OpenSim/Data/SQLiteLegacy/SQLiteRegionData.cs
index 779b2ed..289fd94 100644
--- a/OpenSim/Data/SQLiteLegacy/SQLiteRegionData.cs
+++ b/OpenSim/Data/SQLiteLegacy/SQLiteRegionData.cs
@@ -327,13 +327,10 @@ namespace OpenSim.Data.SQLiteLegacy
327 327
328 lock (ds) 328 lock (ds)
329 { 329 {
330 lock (obj.Children) 330 foreach (SceneObjectPart prim in obj.Children.Values)
331 { 331 {
332 foreach (SceneObjectPart prim in obj.Children.Values) 332// m_log.Info("[REGION DB]: Adding obj: " + obj.UUID + " to region: " + regionUUID);
333 { 333 addPrim(prim, obj.UUID, regionUUID);
334 // m_log.Info("[REGION DB]: Adding obj: " + obj.UUID + " to region: " + regionUUID);
335 addPrim(prim, obj.UUID, regionUUID);
336 }
337 } 334 }
338 } 335 }
339 336