diff options
author | Sean Dague | 2008-03-13 17:42:07 +0000 |
---|---|---|
committer | Sean Dague | 2008-03-13 17:42:07 +0000 |
commit | 1ad041707a49105598fca7a15c62a02faf9154b3 (patch) | |
tree | 88f89b0f38c6c85cb19018371eb98ce4a2e2d153 /OpenSim/Framework | |
parent | * Very minor comment change to reflect the fact that eliminating spurious del... (diff) | |
download | opensim-SC_OLD-1ad041707a49105598fca7a15c62a02faf9154b3.zip opensim-SC_OLD-1ad041707a49105598fca7a15c62a02faf9154b3.tar.gz opensim-SC_OLD-1ad041707a49105598fca7a15c62a02faf9154b3.tar.bz2 opensim-SC_OLD-1ad041707a49105598fca7a15c62a02faf9154b3.tar.xz |
this is a believed fix for some of the MySQL races. Testing would
be appreciated.
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Framework/Data.MySQL/MySQLDataStore.cs | 53 |
1 files changed, 24 insertions, 29 deletions
diff --git a/OpenSim/Framework/Data.MySQL/MySQLDataStore.cs b/OpenSim/Framework/Data.MySQL/MySQLDataStore.cs index e0dce8e..7a43edf 100644 --- a/OpenSim/Framework/Data.MySQL/MySQLDataStore.cs +++ b/OpenSim/Framework/Data.MySQL/MySQLDataStore.cs | |||
@@ -158,9 +158,8 @@ namespace OpenSim.Framework.Data.MySQL | |||
158 | // m_log.Info("[DATASTORE]: Ignoring Physical obj: " + obj.UUID + " in region: " + regionUUID); | 158 | // m_log.Info("[DATASTORE]: Ignoring Physical obj: " + obj.UUID + " in region: " + regionUUID); |
159 | } | 159 | } |
160 | } | 160 | } |
161 | Commit(); | ||
161 | } | 162 | } |
162 | |||
163 | Commit(); | ||
164 | } | 163 | } |
165 | 164 | ||
166 | public void RemoveObject(LLUUID obj, LLUUID regionUUID) | 165 | public void RemoveObject(LLUUID obj, LLUUID regionUUID) |
@@ -192,9 +191,8 @@ namespace OpenSim.Framework.Data.MySQL | |||
192 | // Remove prim row | 191 | // Remove prim row |
193 | row.Delete(); | 192 | row.Delete(); |
194 | } | 193 | } |
194 | Commit(); | ||
195 | } | 195 | } |
196 | |||
197 | Commit(); | ||
198 | } | 196 | } |
199 | 197 | ||
200 | /// <summary> | 198 | /// <summary> |
@@ -368,32 +366,34 @@ namespace OpenSim.Framework.Data.MySQL | |||
368 | { | 366 | { |
369 | m_connection.Open(); | 367 | m_connection.Open(); |
370 | } | 368 | } |
371 | 369 | ||
372 | using (MySqlDataReader row = cmd.ExecuteReader()) | 370 | lock (m_dataSet) |
373 | { | 371 | { |
374 | int rev = 0; | 372 | using (MySqlDataReader row = cmd.ExecuteReader()) |
375 | if (row.Read()) | ||
376 | { | 373 | { |
377 | MemoryStream str = new MemoryStream((byte[]) row["Heightfield"]); | 374 | int rev = 0; |
378 | BinaryReader br = new BinaryReader(str); | 375 | if (row.Read()) |
379 | for (int x = 0; x < 256; x++) | ||
380 | { | 376 | { |
381 | for (int y = 0; y < 256; y++) | 377 | MemoryStream str = new MemoryStream((byte[]) row["Heightfield"]); |
378 | BinaryReader br = new BinaryReader(str); | ||
379 | for (int x = 0; x < 256; x++) | ||
382 | { | 380 | { |
383 | terret[x, y] = br.ReadDouble(); | 381 | for (int y = 0; y < 256; y++) |
382 | { | ||
383 | terret[x, y] = br.ReadDouble(); | ||
384 | } | ||
384 | } | 385 | } |
386 | rev = (int) row["Revision"]; | ||
385 | } | 387 | } |
386 | rev = (int) row["Revision"]; | 388 | else |
387 | } | 389 | { |
388 | else | 390 | m_log.Info("[DATASTORE]: No terrain found for region"); |
389 | { | 391 | return null; |
390 | m_log.Info("[DATASTORE]: No terrain found for region"); | 392 | } |
391 | return null; | 393 | |
394 | m_log.Info("[DATASTORE]: Loaded terrain revision r" + rev.ToString()); | ||
392 | } | 395 | } |
393 | |||
394 | m_log.Info("[DATASTORE]: Loaded terrain revision r" + rev.ToString()); | ||
395 | } | 396 | } |
396 | |||
397 | return terret; | 397 | return terret; |
398 | } | 398 | } |
399 | 399 | ||
@@ -417,13 +417,8 @@ namespace OpenSim.Framework.Data.MySQL | |||
417 | } | 417 | } |
418 | } | 418 | } |
419 | 419 | ||
420 | static Random rnd = new Random(); | ||
421 | public void StoreLandObject(Land parcel, LLUUID regionUUID) | 420 | public void StoreLandObject(Land parcel, LLUUID regionUUID) |
422 | { | 421 | { |
423 | // Does the new locking fix it? | ||
424 | m_log.Info("[DATASTORE]: Tedds temp fix: Waiting 3 seconds to avoid others writing to table while we hold a dataset of it. (Someone please fix! :))"); | ||
425 | System.Threading.Thread.Sleep(2500 + rnd.Next(0, 1000)); | ||
426 | |||
427 | lock (m_dataSet) | 422 | lock (m_dataSet) |
428 | { | 423 | { |
429 | DataTable land = m_landTable; | 424 | DataTable land = m_landTable; |
@@ -455,9 +450,9 @@ namespace OpenSim.Framework.Data.MySQL | |||
455 | fillLandAccessRow(newAccessRow, entry, parcel.landData.globalID); | 450 | fillLandAccessRow(newAccessRow, entry, parcel.landData.globalID); |
456 | landaccesslist.Rows.Add(newAccessRow); | 451 | landaccesslist.Rows.Add(newAccessRow); |
457 | } | 452 | } |
458 | 453 | ||
454 | Commit(); | ||
459 | } | 455 | } |
460 | Commit(); | ||
461 | } | 456 | } |
462 | 457 | ||
463 | public List<LandData> LoadLandObjects(LLUUID regionUUID) | 458 | public List<LandData> LoadLandObjects(LLUUID regionUUID) |