* Potential fix for Mantis#167, 332 - MySQL Thread collision.

0.6.0-stable
Adam Frisby 2008-05-26 21:53:32 +00:00
parent de06c85259
commit 77281ed85c
1 changed files with 79 additions and 64 deletions

View File

@ -409,6 +409,8 @@ namespace OpenSim.Data.MySQL
/// </summary> /// </summary>
/// <param name="prim"></param> /// <param name="prim"></param>
private void LoadItems(SceneObjectPart prim) private void LoadItems(SceneObjectPart prim)
{
lock (m_dataSet)
{ {
//m_log.InfoFormat("[DATASTORE]: Loading inventory for {0}, {1}", prim.Name, prim.UUID); //m_log.InfoFormat("[DATASTORE]: Loading inventory for {0}, {1}", prim.Name, prim.UUID);
@ -436,15 +438,17 @@ namespace OpenSim.Data.MySQL
prim.FolderID = inventory[0].ParentID; prim.FolderID = inventory[0].ParentID;
} }
} }
}
public void StoreTerrain(double[,] ter, LLUUID regionID) public void StoreTerrain(double[,] ter, LLUUID regionID)
{ {
int revision = Util.UnixTimeSinceEpoch(); int revision = Util.UnixTimeSinceEpoch();
m_log.Info("[REGION DB]: Storing terrain revision r" + revision.ToString()); m_log.Info("[REGION DB]: Storing terrain revision r" + revision.ToString());
DataTable terrain = m_dataSet.Tables["terrain"];
lock (m_dataSet) lock (m_dataSet)
{ {
DataTable terrain = m_dataSet.Tables["terrain"];
MySqlCommand cmd = new MySqlCommand("insert into terrain(RegionUUID, Revision, Heightfield)" + MySqlCommand cmd = new MySqlCommand("insert into terrain(RegionUUID, Revision, Heightfield)" +
" values(?RegionUUID, ?Revision, ?Heightfield)", m_connection); " values(?RegionUUID, ?Revision, ?Heightfield)", m_connection);
using (cmd) using (cmd)
@ -921,6 +925,8 @@ namespace OpenSim.Data.MySQL
{ {
// Database table was created before we got here and needs to be created! :P // Database table was created before we got here and needs to be created! :P
lock (m_dataSet)
{
using ( using (
MySqlCommand cmd = MySqlCommand cmd =
new MySqlCommand( new MySqlCommand(
@ -930,6 +936,7 @@ namespace OpenSim.Data.MySQL
cmd.ExecuteNonQuery(); cmd.ExecuteNonQuery();
} }
} }
}
return prim; return prim;
} }
@ -1230,7 +1237,8 @@ namespace OpenSim.Data.MySQL
catch (InvalidCastException) catch (InvalidCastException)
{ {
// Database table was created before we got here and needs to be created! :P // Database table was created before we got here and needs to be created! :P
lock (m_dataSet)
{
using ( using (
MySqlCommand cmd = MySqlCommand cmd =
new MySqlCommand( new MySqlCommand(
@ -1240,6 +1248,7 @@ namespace OpenSim.Data.MySQL
cmd.ExecuteNonQuery(); cmd.ExecuteNonQuery();
} }
} }
}
return s; return s;
} }
@ -1282,6 +1291,8 @@ namespace OpenSim.Data.MySQL
row["State"] = s.State; row["State"] = s.State;
} }
catch (MySqlException) catch (MySqlException)
{
lock (m_dataSet)
{ {
// Database table was created before we got here and needs to be created! :P // Database table was created before we got here and needs to be created! :P
using ( using (
@ -1294,8 +1305,11 @@ namespace OpenSim.Data.MySQL
} }
} }
} }
}
private void addPrim(SceneObjectPart prim, LLUUID sceneGroupID, LLUUID regionUUID) private void addPrim(SceneObjectPart prim, LLUUID sceneGroupID, LLUUID regionUUID)
{
lock (m_dataSet)
{ {
DataTable prims = m_dataSet.Tables["prims"]; DataTable prims = m_dataSet.Tables["prims"];
DataTable shapes = m_dataSet.Tables["primshapes"]; DataTable shapes = m_dataSet.Tables["primshapes"];
@ -1324,6 +1338,7 @@ namespace OpenSim.Data.MySQL
fillShapeRow(shapeRow, prim); fillShapeRow(shapeRow, prim);
} }
} }
}
// see IRegionDatastore // see IRegionDatastore
public void StorePrimInventory(LLUUID primID, ICollection<TaskInventoryItem> items) public void StorePrimInventory(LLUUID primID, ICollection<TaskInventoryItem> items)