* Synchronize asset storage operations to mysql as well as reads

* This may help with asset server mysql problems, since both the previous osgrid failures occurred when both a read and write were attempted in the same second
ThreadPoolClientBranch
Justin Clarke Casey 2008-02-04 17:30:53 +00:00
parent cd658ea845
commit bde363b572
1 changed files with 36 additions and 32 deletions

View File

@ -76,6 +76,7 @@ namespace OpenSim.Framework.Data.MySQL
_dbConnection.Connection); _dbConnection.Connection);
MySqlParameter p = cmd.Parameters.Add("?id", MySqlDbType.Binary, 16); MySqlParameter p = cmd.Parameters.Add("?id", MySqlDbType.Binary, 16);
p.Value = assetID.GetBytes(); p.Value = assetID.GetBytes();
try try
{ {
using (MySqlDataReader dbReader = cmd.ExecuteReader(CommandBehavior.SingleRow)) using (MySqlDataReader dbReader = cmd.ExecuteReader(CommandBehavior.SingleRow))
@ -107,6 +108,8 @@ namespace OpenSim.Framework.Data.MySQL
} }
public void CreateAsset(AssetBase asset) public void CreateAsset(AssetBase asset)
{
lock (_dbConnection)
{ {
MySqlCommand cmd = MySqlCommand cmd =
new MySqlCommand( new MySqlCommand(
@ -141,6 +144,7 @@ namespace OpenSim.Framework.Data.MySQL
_dbConnection.Reconnect(); _dbConnection.Reconnect();
} }
} }
}
public void UpdateAsset(AssetBase asset) public void UpdateAsset(AssetBase asset)
{ {