aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Data/SQLite/SQLiteAssetData.cs
diff options
context:
space:
mode:
authorSean Dague2008-07-18 15:34:32 +0000
committerSean Dague2008-07-18 15:34:32 +0000
commit611b56070b793343614e411d28203965f3aea418 (patch)
tree7db262afdea5bffa1c7ce6961836833a811ec34b /OpenSim/Data/SQLite/SQLiteAssetData.cs
parentsimplifying OSHTtpHandler (a bit), adding query string matching, (diff)
downloadopensim-SC-611b56070b793343614e411d28203965f3aea418.zip
opensim-SC-611b56070b793343614e411d28203965f3aea418.tar.gz
opensim-SC-611b56070b793343614e411d28203965f3aea418.tar.bz2
opensim-SC-611b56070b793343614e411d28203965f3aea418.tar.xz
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.
Diffstat (limited to '')
-rw-r--r--OpenSim/Data/SQLite/SQLiteAssetData.cs105
1 files changed, 56 insertions, 49 deletions
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
94 /// <returns>Asset base</returns> 94 /// <returns>Asset base</returns>
95 override public AssetBase FetchAsset(LLUUID uuid) 95 override public AssetBase FetchAsset(LLUUID uuid)
96 { 96 {
97 97 lock(this)
98 using (SqliteCommand cmd = new SqliteCommand(SelectAssetSQL, m_conn))
99 { 98 {
100 cmd.Parameters.Add(new SqliteParameter(":UUID", Util.ToRawUuidString(uuid))); 99 using (SqliteCommand cmd = new SqliteCommand(SelectAssetSQL, m_conn))
101 using (IDataReader reader = cmd.ExecuteReader())
102 { 100 {
103 if (reader.Read()) 101 cmd.Parameters.Add(new SqliteParameter(":UUID", Util.ToRawUuidString(uuid)));
102 using (IDataReader reader = cmd.ExecuteReader())
104 { 103 {
105 AssetBase asset = buildAsset(reader); 104 if (reader.Read())
106 reader.Close(); 105 {
107 return asset; 106 AssetBase asset = buildAsset(reader);
108 } 107 reader.Close();
109 else 108 return asset;
110 { 109 }
111 reader.Close(); 110 else
112 return null; 111 {
112 reader.Close();
113 return null;
114 }
113 } 115 }
114 } 116 }
115 } 117 }
@@ -128,17 +130,19 @@ namespace OpenSim.Data.SQLite
128 } 130 }
129 else 131 else
130 { 132 {
131 using (SqliteCommand cmd = new SqliteCommand(InsertAssetSQL, m_conn)) 133 lock(this) {
132 { 134 using (SqliteCommand cmd = new SqliteCommand(InsertAssetSQL, m_conn))
133 cmd.Parameters.Add(new SqliteParameter(":UUID", Util.ToRawUuidString(asset.FullID))); 135 {
134 cmd.Parameters.Add(new SqliteParameter(":Name", asset.Name)); 136 cmd.Parameters.Add(new SqliteParameter(":UUID", Util.ToRawUuidString(asset.FullID)));
135 cmd.Parameters.Add(new SqliteParameter(":Description", asset.Description)); 137 cmd.Parameters.Add(new SqliteParameter(":Name", asset.Name));
136 cmd.Parameters.Add(new SqliteParameter(":Type", asset.Type)); 138 cmd.Parameters.Add(new SqliteParameter(":Description", asset.Description));
137 cmd.Parameters.Add(new SqliteParameter(":Local", asset.Local)); 139 cmd.Parameters.Add(new SqliteParameter(":Type", asset.Type));
138 cmd.Parameters.Add(new SqliteParameter(":Temporary", asset.Temporary)); 140 cmd.Parameters.Add(new SqliteParameter(":Local", asset.Local));
139 cmd.Parameters.Add(new SqliteParameter(":Data", asset.Data)); 141 cmd.Parameters.Add(new SqliteParameter(":Temporary", asset.Temporary));
140 142 cmd.Parameters.Add(new SqliteParameter(":Data", asset.Data));
141 cmd.ExecuteNonQuery(); 143
144 cmd.ExecuteNonQuery();
145 }
142 } 146 }
143 } 147 }
144 } 148 }
@@ -150,20 +154,21 @@ namespace OpenSim.Data.SQLite
150 override public void UpdateAsset(AssetBase asset) 154 override public void UpdateAsset(AssetBase asset)
151 { 155 {
152 LogAssetLoad(asset); 156 LogAssetLoad(asset);
153 157
154 using (SqliteCommand cmd = new SqliteCommand(UpdateAssetSQL, m_conn)) 158 lock(this) {
155 { 159 using (SqliteCommand cmd = new SqliteCommand(UpdateAssetSQL, m_conn))
156 cmd.Parameters.Add(new SqliteParameter(":UUID", Util.ToRawUuidString(asset.FullID))); 160 {
157 cmd.Parameters.Add(new SqliteParameter(":Name", asset.Name)); 161 cmd.Parameters.Add(new SqliteParameter(":UUID", Util.ToRawUuidString(asset.FullID)));
158 cmd.Parameters.Add(new SqliteParameter(":Description", asset.Description)); 162 cmd.Parameters.Add(new SqliteParameter(":Name", asset.Name));
159 cmd.Parameters.Add(new SqliteParameter(":Type", asset.Type)); 163 cmd.Parameters.Add(new SqliteParameter(":Description", asset.Description));
160 cmd.Parameters.Add(new SqliteParameter(":Local", asset.Local)); 164 cmd.Parameters.Add(new SqliteParameter(":Type", asset.Type));
161 cmd.Parameters.Add(new SqliteParameter(":Temporary", asset.Temporary)); 165 cmd.Parameters.Add(new SqliteParameter(":Local", asset.Local));
162 cmd.Parameters.Add(new SqliteParameter(":Data", asset.Data)); 166 cmd.Parameters.Add(new SqliteParameter(":Temporary", asset.Temporary));
163 167 cmd.Parameters.Add(new SqliteParameter(":Data", asset.Data));
164 cmd.ExecuteNonQuery(); 168
169 cmd.ExecuteNonQuery();
170 }
165 } 171 }
166
167 } 172 }
168 173
169 /// <summary> 174 /// <summary>
@@ -190,20 +195,22 @@ namespace OpenSim.Data.SQLite
190 /// <returns>True if exist, or false.</returns> 195 /// <returns>True if exist, or false.</returns>
191 override public bool ExistsAsset(LLUUID uuid) 196 override public bool ExistsAsset(LLUUID uuid)
192 { 197 {
193 using (SqliteCommand cmd = new SqliteCommand(SelectAssetSQL, m_conn)) 198 lock (this) {
194 { 199 using (SqliteCommand cmd = new SqliteCommand(SelectAssetSQL, m_conn))
195 cmd.Parameters.Add(new SqliteParameter(":UUID", Util.ToRawUuidString(uuid)));
196 using (IDataReader reader = cmd.ExecuteReader())
197 { 200 {
198 if (reader.Read()) 201 cmd.Parameters.Add(new SqliteParameter(":UUID", Util.ToRawUuidString(uuid)));
199 { 202 using (IDataReader reader = cmd.ExecuteReader())
200 reader.Close();
201 return true;
202 }
203 else
204 { 203 {
205 reader.Close(); 204 if (reader.Read())
206 return false; 205 {
206 reader.Close();
207 return true;
208 }
209 else
210 {
211 reader.Close();
212 return false;
213 }
207 } 214 }
208 } 215 }
209 } 216 }