From 611b56070b793343614e411d28203965f3aea418 Mon Sep 17 00:00:00 2001
From: Sean Dague
Date: Fri, 18 Jul 2008 15:34:32 +0000
Subject: add some locks back into the sqlite asset path, as something changed
that is causing a lot of out of order execution on asset fetches on multi
region sims.
---
OpenSim/Data/SQLite/SQLiteAssetData.cs | 105 ++++++++++++++++++---------------
1 file changed, 56 insertions(+), 49 deletions(-)
(limited to 'OpenSim/Data')
diff --git a/OpenSim/Data/SQLite/SQLiteAssetData.cs b/OpenSim/Data/SQLite/SQLiteAssetData.cs
index dde05bd..823b81b 100644
--- a/OpenSim/Data/SQLite/SQLiteAssetData.cs
+++ b/OpenSim/Data/SQLite/SQLiteAssetData.cs
@@ -94,22 +94,24 @@ namespace OpenSim.Data.SQLite
/// Asset base
override public AssetBase FetchAsset(LLUUID uuid)
{
-
- using (SqliteCommand cmd = new SqliteCommand(SelectAssetSQL, m_conn))
+ lock(this)
{
- cmd.Parameters.Add(new SqliteParameter(":UUID", Util.ToRawUuidString(uuid)));
- using (IDataReader reader = cmd.ExecuteReader())
+ using (SqliteCommand cmd = new SqliteCommand(SelectAssetSQL, m_conn))
{
- if (reader.Read())
+ cmd.Parameters.Add(new SqliteParameter(":UUID", Util.ToRawUuidString(uuid)));
+ using (IDataReader reader = cmd.ExecuteReader())
{
- AssetBase asset = buildAsset(reader);
- reader.Close();
- return asset;
- }
- else
- {
- reader.Close();
- return null;
+ if (reader.Read())
+ {
+ AssetBase asset = buildAsset(reader);
+ reader.Close();
+ return asset;
+ }
+ else
+ {
+ reader.Close();
+ return null;
+ }
}
}
}
@@ -128,17 +130,19 @@ namespace OpenSim.Data.SQLite
}
else
{
- using (SqliteCommand cmd = new SqliteCommand(InsertAssetSQL, m_conn))
- {
- cmd.Parameters.Add(new SqliteParameter(":UUID", Util.ToRawUuidString(asset.FullID)));
- cmd.Parameters.Add(new SqliteParameter(":Name", asset.Name));
- cmd.Parameters.Add(new SqliteParameter(":Description", asset.Description));
- cmd.Parameters.Add(new SqliteParameter(":Type", asset.Type));
- cmd.Parameters.Add(new SqliteParameter(":Local", asset.Local));
- cmd.Parameters.Add(new SqliteParameter(":Temporary", asset.Temporary));
- cmd.Parameters.Add(new SqliteParameter(":Data", asset.Data));
-
- cmd.ExecuteNonQuery();
+ lock(this) {
+ using (SqliteCommand cmd = new SqliteCommand(InsertAssetSQL, m_conn))
+ {
+ cmd.Parameters.Add(new SqliteParameter(":UUID", Util.ToRawUuidString(asset.FullID)));
+ cmd.Parameters.Add(new SqliteParameter(":Name", asset.Name));
+ cmd.Parameters.Add(new SqliteParameter(":Description", asset.Description));
+ cmd.Parameters.Add(new SqliteParameter(":Type", asset.Type));
+ cmd.Parameters.Add(new SqliteParameter(":Local", asset.Local));
+ cmd.Parameters.Add(new SqliteParameter(":Temporary", asset.Temporary));
+ cmd.Parameters.Add(new SqliteParameter(":Data", asset.Data));
+
+ cmd.ExecuteNonQuery();
+ }
}
}
}
@@ -150,20 +154,21 @@ namespace OpenSim.Data.SQLite
override public void UpdateAsset(AssetBase asset)
{
LogAssetLoad(asset);
-
- using (SqliteCommand cmd = new SqliteCommand(UpdateAssetSQL, m_conn))
- {
- cmd.Parameters.Add(new SqliteParameter(":UUID", Util.ToRawUuidString(asset.FullID)));
- cmd.Parameters.Add(new SqliteParameter(":Name", asset.Name));
- cmd.Parameters.Add(new SqliteParameter(":Description", asset.Description));
- cmd.Parameters.Add(new SqliteParameter(":Type", asset.Type));
- cmd.Parameters.Add(new SqliteParameter(":Local", asset.Local));
- cmd.Parameters.Add(new SqliteParameter(":Temporary", asset.Temporary));
- cmd.Parameters.Add(new SqliteParameter(":Data", asset.Data));
-
- cmd.ExecuteNonQuery();
+
+ lock(this) {
+ using (SqliteCommand cmd = new SqliteCommand(UpdateAssetSQL, m_conn))
+ {
+ cmd.Parameters.Add(new SqliteParameter(":UUID", Util.ToRawUuidString(asset.FullID)));
+ cmd.Parameters.Add(new SqliteParameter(":Name", asset.Name));
+ cmd.Parameters.Add(new SqliteParameter(":Description", asset.Description));
+ cmd.Parameters.Add(new SqliteParameter(":Type", asset.Type));
+ cmd.Parameters.Add(new SqliteParameter(":Local", asset.Local));
+ cmd.Parameters.Add(new SqliteParameter(":Temporary", asset.Temporary));
+ cmd.Parameters.Add(new SqliteParameter(":Data", asset.Data));
+
+ cmd.ExecuteNonQuery();
+ }
}
-
}
///
@@ -190,20 +195,22 @@ namespace OpenSim.Data.SQLite
/// True if exist, or false.
override public bool ExistsAsset(LLUUID uuid)
{
- using (SqliteCommand cmd = new SqliteCommand(SelectAssetSQL, m_conn))
- {
- cmd.Parameters.Add(new SqliteParameter(":UUID", Util.ToRawUuidString(uuid)));
- using (IDataReader reader = cmd.ExecuteReader())
+ lock (this) {
+ using (SqliteCommand cmd = new SqliteCommand(SelectAssetSQL, m_conn))
{
- if (reader.Read())
- {
- reader.Close();
- return true;
- }
- else
+ cmd.Parameters.Add(new SqliteParameter(":UUID", Util.ToRawUuidString(uuid)));
+ using (IDataReader reader = cmd.ExecuteReader())
{
- reader.Close();
- return false;
+ if (reader.Read())
+ {
+ reader.Close();
+ return true;
+ }
+ else
+ {
+ reader.Close();
+ return false;
+ }
}
}
}
--
cgit v1.1