aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--OpenSim/Framework/Data.MySQL/MySQLDataStore.cs53
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)