aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
authorMelanie Thielker2017-01-30 13:59:05 +0000
committerMelanie Thielker2017-01-30 13:59:05 +0000
commit5a18ea31cf9d9a97fc1a65f8623b633c244221c2 (patch)
tree80eae98cddde4ffbdb7287ad0ac82449c33cb316 /OpenSim/Region
parentComment two very spammy debug messages that the usr can't do anything about (diff)
downloadopensim-SC-5a18ea31cf9d9a97fc1a65f8623b633c244221c2.zip
opensim-SC-5a18ea31cf9d9a97fc1a65f8623b633c244221c2.tar.gz
opensim-SC-5a18ea31cf9d9a97fc1a65f8623b633c244221c2.tar.bz2
opensim-SC-5a18ea31cf9d9a97fc1a65f8623b633c244221c2.tar.xz
Make negative asset caching actually work
Also fixes some merge artefacts in HGAssetBroker where cached assets were requested but not actually used and completely squelch a materials debug message because there is nothing the user can do to fix it anyway.
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/CoreModules/Agent/TextureSender/J2KDecoderModule.cs3
-rw-r--r--OpenSim/Region/CoreModules/Asset/CenomeAssetCache.cs4
-rw-r--r--OpenSim/Region/CoreModules/Asset/CoreAssetCache.cs6
-rw-r--r--OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs37
-rw-r--r--OpenSim/Region/CoreModules/Asset/GlynnTuckerAssetCache.cs4
-rw-r--r--OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs3
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/HGAssetBroker.cs34
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/LocalAssetServiceConnector.cs36
-rw-r--r--OpenSim/Region/OptionalModules/Materials/MaterialsModule.cs3
9 files changed, 97 insertions, 33 deletions
diff --git a/OpenSim/Region/CoreModules/Agent/TextureSender/J2KDecoderModule.cs b/OpenSim/Region/CoreModules/Agent/TextureSender/J2KDecoderModule.cs
index 2242e42..594b6bb 100644
--- a/OpenSim/Region/CoreModules/Agent/TextureSender/J2KDecoderModule.cs
+++ b/OpenSim/Region/CoreModules/Agent/TextureSender/J2KDecoderModule.cs
@@ -369,7 +369,8 @@ namespace OpenSim.Region.CoreModules.Agent.TextureSender
369 else if (Cache != null) 369 else if (Cache != null)
370 { 370 {
371 string assetName = "j2kCache_" + AssetId.ToString(); 371 string assetName = "j2kCache_" + AssetId.ToString();
372 AssetBase layerDecodeAsset = Cache.Get(assetName); 372 bool negative;
373 AssetBase layerDecodeAsset = Cache.Get(assetName, out negative);
373 374
374 if (layerDecodeAsset != null) 375 if (layerDecodeAsset != null)
375 { 376 {
diff --git a/OpenSim/Region/CoreModules/Asset/CenomeAssetCache.cs b/OpenSim/Region/CoreModules/Asset/CenomeAssetCache.cs
index 23c1f03..136134f 100644
--- a/OpenSim/Region/CoreModules/Asset/CenomeAssetCache.cs
+++ b/OpenSim/Region/CoreModules/Asset/CenomeAssetCache.cs
@@ -260,8 +260,10 @@ namespace OpenSim.Region.CoreModules.Asset
260 /// Cache doesn't guarantee in any situation that asset is stored to it. 260 /// Cache doesn't guarantee in any situation that asset is stored to it.
261 /// </para> 261 /// </para>
262 /// </remarks> 262 /// </remarks>
263 public AssetBase Get(string id) 263 public AssetBase Get(string id, out bool negative)
264 { 264 {
265 negative = false;
266
265 m_getCount++; 267 m_getCount++;
266 AssetBase assetBase; 268 AssetBase assetBase;
267 if (m_cache.TryGetValue(id, out assetBase)) 269 if (m_cache.TryGetValue(id, out assetBase))
diff --git a/OpenSim/Region/CoreModules/Asset/CoreAssetCache.cs b/OpenSim/Region/CoreModules/Asset/CoreAssetCache.cs
index 51fc3d1..d655509 100644
--- a/OpenSim/Region/CoreModules/Asset/CoreAssetCache.cs
+++ b/OpenSim/Region/CoreModules/Asset/CoreAssetCache.cs
@@ -115,7 +115,8 @@ namespace OpenSim.Region.CoreModules.Asset
115 public bool Check(string id) 115 public bool Check(string id)
116 { 116 {
117 // XXX This is probably not an efficient implementation. 117 // XXX This is probably not an efficient implementation.
118 return Get(id) != null; 118 bool negative;
119 return Get(id, out negative) != null;
119 } 120 }
120 121
121 public void Cache(AssetBase asset) 122 public void Cache(AssetBase asset)
@@ -129,8 +130,9 @@ namespace OpenSim.Region.CoreModules.Asset
129 // We don't do negative caching 130 // We don't do negative caching
130 } 131 }
131 132
132 public AssetBase Get(string id) 133 public AssetBase Get(string id, out bool negative)
133 { 134 {
135 negative = false;
134 return (AssetBase)m_Cache.Get(id); 136 return (AssetBase)m_Cache.Get(id);
135 } 137 }
136 138
diff --git a/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs b/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs
index 187f090..b183a75 100644
--- a/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs
+++ b/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs
@@ -474,6 +474,8 @@ namespace OpenSim.Region.CoreModules.Asset
474 { 474 {
475 using (FileStream stream = File.Open(filename, FileMode.Open, FileAccess.Read, FileShare.Read)) 475 using (FileStream stream = File.Open(filename, FileMode.Open, FileAccess.Read, FileShare.Read))
476 { 476 {
477 if (stream.Length == 0) // Empty file will trigger exception below
478 return null;
477 BinaryFormatter bformatter = new BinaryFormatter(); 479 BinaryFormatter bformatter = new BinaryFormatter();
478 480
479 asset = (AssetBase)bformatter.Deserialize(stream); 481 asset = (AssetBase)bformatter.Deserialize(stream);
@@ -531,13 +533,25 @@ namespace OpenSim.Region.CoreModules.Asset
531 return found; 533 return found;
532 } 534 }
533 535
536 // For IAssetService
534 public AssetBase Get(string id) 537 public AssetBase Get(string id)
535 { 538 {
539 bool negative;
540 return Get(id, out negative);
541 }
542
543 public AssetBase Get(string id, out bool negative)
544 {
545 negative = false;
546
536 m_Requests++; 547 m_Requests++;
537 548
538 object dummy; 549 object dummy;
539 if (m_negativeCache.TryGetValue(id, out dummy)) 550 if (m_negativeCache.TryGetValue(id, out dummy))
551 {
552 negative = true;
540 return null; 553 return null;
554 }
541 555
542 AssetBase asset = null; 556 AssetBase asset = null;
543 asset = GetFromWeakReference(id); 557 asset = GetFromWeakReference(id);
@@ -578,12 +592,6 @@ namespace OpenSim.Region.CoreModules.Asset
578 GenerateCacheHitReport().ForEach(l => m_log.InfoFormat("[FLOTSAM ASSET CACHE]: {0}", l)); 592 GenerateCacheHitReport().ForEach(l => m_log.InfoFormat("[FLOTSAM ASSET CACHE]: {0}", l));
579 } 593 }
580 594
581 if(asset == null)
582 {
583
584
585 }
586
587 return asset; 595 return asset;
588 } 596 }
589 597
@@ -599,7 +607,8 @@ namespace OpenSim.Region.CoreModules.Asset
599 607
600 public AssetBase GetCached(string id) 608 public AssetBase GetCached(string id)
601 { 609 {
602 return Get(id); 610 bool negative;
611 return Get(id, out negative);
603 } 612 }
604 613
605 public void Expire(string id) 614 public void Expire(string id)
@@ -1227,19 +1236,24 @@ namespace OpenSim.Region.CoreModules.Asset
1227 1236
1228 public AssetMetadata GetMetadata(string id) 1237 public AssetMetadata GetMetadata(string id)
1229 { 1238 {
1230 AssetBase asset = Get(id); 1239 bool negative;
1240 AssetBase asset = Get(id, out negative);
1231 return asset.Metadata; 1241 return asset.Metadata;
1232 } 1242 }
1233 1243
1234 public byte[] GetData(string id) 1244 public byte[] GetData(string id)
1235 { 1245 {
1236 AssetBase asset = Get(id); 1246 bool negative;
1247 AssetBase asset = Get(id, out negative);
1237 return asset.Data; 1248 return asset.Data;
1238 } 1249 }
1239 1250
1240 public bool Get(string id, object sender, AssetRetrieved handler) 1251 public bool Get(string id, object sender, AssetRetrieved handler)
1241 { 1252 {
1242 AssetBase asset = Get(id); 1253 bool negative;
1254 AssetBase asset = Get(id, out negative);
1255 if (negative)
1256 return false;
1243 handler(id, sender, asset); 1257 handler(id, sender, asset);
1244 return true; 1258 return true;
1245 } 1259 }
@@ -1270,7 +1284,8 @@ namespace OpenSim.Region.CoreModules.Asset
1270 1284
1271 public bool UpdateContent(string id, byte[] data) 1285 public bool UpdateContent(string id, byte[] data)
1272 { 1286 {
1273 AssetBase asset = Get(id); 1287 bool negative;
1288 AssetBase asset = Get(id, out negative);
1274 asset.Data = data; 1289 asset.Data = data;
1275 Cache(asset); 1290 Cache(asset);
1276 return true; 1291 return true;
diff --git a/OpenSim/Region/CoreModules/Asset/GlynnTuckerAssetCache.cs b/OpenSim/Region/CoreModules/Asset/GlynnTuckerAssetCache.cs
index 208963d..342d4d9 100644
--- a/OpenSim/Region/CoreModules/Asset/GlynnTuckerAssetCache.cs
+++ b/OpenSim/Region/CoreModules/Asset/GlynnTuckerAssetCache.cs
@@ -131,8 +131,10 @@ namespace OpenSim.Region.CoreModules.Asset
131 // We don't do negative caching 131 // We don't do negative caching
132 } 132 }
133 133
134 public AssetBase Get(string id) 134 public AssetBase Get(string id, out bool negative)
135 { 135 {
136 negative = false;
137
136 Object asset = null; 138 Object asset = null;
137 m_Cache.TryGet(id, out asset); 139 m_Cache.TryGet(id, out asset);
138 140
diff --git a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs
index fb408a4..3e47782 100644
--- a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs
@@ -299,7 +299,8 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
299 if (bakedTextureFace == null) 299 if (bakedTextureFace == null)
300 continue; 300 continue;
301 301
302 AssetBase asset = cache.Get(bakedTextureFace.TextureID.ToString()); 302 bool negative;
303 AssetBase asset = cache.Get(bakedTextureFace.TextureID.ToString(), out negative);
303 304
304 if (asset != null && asset.Local) 305 if (asset != null && asset.Local)
305 { 306 {
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/HGAssetBroker.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/HGAssetBroker.cs
index f5aa971..ce61ff0 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/HGAssetBroker.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/HGAssetBroker.cs
@@ -209,7 +209,11 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset
209 209
210 if (m_Cache != null) 210 if (m_Cache != null)
211 { 211 {
212 asset = m_Cache.Get(id); 212 bool negative;
213 asset = m_Cache.Get(id, out negative);
214
215 if (negative)
216 return null;
213 217
214 if (asset != null) 218 if (asset != null)
215 return asset; 219 return asset;
@@ -238,8 +242,9 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset
238 242
239 public AssetBase GetCached(string id) 243 public AssetBase GetCached(string id)
240 { 244 {
245 bool negative;
241 if (m_Cache != null) 246 if (m_Cache != null)
242 return m_Cache.Get(id); 247 return m_Cache.Get(id, out negative);
243 248
244 return null; 249 return null;
245 } 250 }
@@ -250,8 +255,11 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset
250 255
251 if (m_Cache != null) 256 if (m_Cache != null)
252 { 257 {
253 if (m_Cache != null) 258 bool negative;
254 m_Cache.Get(id); 259 asset = m_Cache.Get(id, out negative);
260
261 if (negative)
262 return null;
255 263
256 if (asset != null) 264 if (asset != null)
257 return asset.Metadata; 265 return asset.Metadata;
@@ -273,8 +281,11 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset
273 281
274 if (m_Cache != null) 282 if (m_Cache != null)
275 { 283 {
276 if (m_Cache != null) 284 bool negative;
277 m_Cache.Get(id); 285 asset = m_Cache.Get(id, out negative);
286
287 if (negative)
288 return null;
278 289
279 if (asset != null) 290 if (asset != null)
280 return asset.Data; 291 return asset.Data;
@@ -292,7 +303,13 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset
292 AssetBase asset = null; 303 AssetBase asset = null;
293 304
294 if (m_Cache != null) 305 if (m_Cache != null)
295 asset = m_Cache.Get(id); 306 {
307 bool negative;
308 asset = m_Cache.Get(id, out negative);
309
310 if (negative)
311 return false;
312 }
296 313
297 if (asset != null) 314 if (asset != null)
298 { 315 {
@@ -381,8 +398,9 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset
381 { 398 {
382 AssetBase asset = null; 399 AssetBase asset = null;
383 400
401 bool negative;
384 if (m_Cache != null) 402 if (m_Cache != null)
385 asset = m_Cache.Get(id); 403 asset = m_Cache.Get(id, out negative);
386 404
387 if (asset != null) 405 if (asset != null)
388 { 406 {
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/LocalAssetServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/LocalAssetServiceConnector.cs
index 7190aa0..bbaed21 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/LocalAssetServiceConnector.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/LocalAssetServiceConnector.cs
@@ -158,7 +158,13 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset
158 158
159 AssetBase asset = null; 159 AssetBase asset = null;
160 if (m_Cache != null) 160 if (m_Cache != null)
161 asset = m_Cache.Get(id); 161 {
162 bool negative;
163 asset = m_Cache.Get(id, out negative);
164
165 if (negative)
166 return null;
167 }
162 168
163 if (asset == null) 169 if (asset == null)
164 { 170 {
@@ -178,7 +184,10 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset
178// m_log.DebugFormat("[LOCAL ASSET SERVICES CONNECTOR]: Cache request for {0}", id); 184// m_log.DebugFormat("[LOCAL ASSET SERVICES CONNECTOR]: Cache request for {0}", id);
179 185
180 if (m_Cache != null) 186 if (m_Cache != null)
181 return m_Cache.Get(id); 187 {
188 bool negative;
189 return m_Cache.Get(id, out negative);
190 }
182 191
183 return null; 192 return null;
184 } 193 }
@@ -187,7 +196,12 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset
187 { 196 {
188 AssetBase asset = null; 197 AssetBase asset = null;
189 if (m_Cache != null) 198 if (m_Cache != null)
190 asset = m_Cache.Get(id); 199 {
200 bool negative;
201 asset = m_Cache.Get(id, out negative);
202 if (negative)
203 return null;
204 }
191 205
192 if (asset != null) 206 if (asset != null)
193 return asset.Metadata; 207 return asset.Metadata;
@@ -210,7 +224,12 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset
210 AssetBase asset = null; 224 AssetBase asset = null;
211 225
212 if (m_Cache != null) 226 if (m_Cache != null)
213 asset = m_Cache.Get(id); 227 {
228 bool negative;
229 asset = m_Cache.Get(id, out negative);
230 if (negative)
231 return null;
232 }
214 233
215 if (asset != null) 234 if (asset != null)
216 return asset.Data; 235 return asset.Data;
@@ -232,7 +251,11 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset
232 251
233 if (m_Cache != null) 252 if (m_Cache != null)
234 { 253 {
235 AssetBase asset = m_Cache.Get(id); 254 bool negative;
255 AssetBase asset = m_Cache.Get(id, out negative);
256
257 if (negative)
258 return false;
236 259
237 if (asset != null) 260 if (asset != null)
238 { 261 {
@@ -286,8 +309,9 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset
286 public bool UpdateContent(string id, byte[] data) 309 public bool UpdateContent(string id, byte[] data)
287 { 310 {
288 AssetBase asset = null; 311 AssetBase asset = null;
312 bool negative;
289 if (m_Cache != null) 313 if (m_Cache != null)
290 m_Cache.Get(id); 314 m_Cache.Get(id, out negative);
291 if (asset != null) 315 if (asset != null)
292 { 316 {
293 asset.Data = data; 317 asset.Data = data;
diff --git a/OpenSim/Region/OptionalModules/Materials/MaterialsModule.cs b/OpenSim/Region/OptionalModules/Materials/MaterialsModule.cs
index 3d2de82..e8cb052 100644
--- a/OpenSim/Region/OptionalModules/Materials/MaterialsModule.cs
+++ b/OpenSim/Region/OptionalModules/Materials/MaterialsModule.cs
@@ -329,8 +329,7 @@ namespace OpenSim.Region.OptionalModules.Materials
329 AssetBase matAsset = m_scene.AssetService.Get(id.ToString()); 329 AssetBase matAsset = m_scene.AssetService.Get(id.ToString());
330 if (matAsset == null || matAsset.Data == null || matAsset.Data.Length == 0 ) 330 if (matAsset == null || matAsset.Data == null || matAsset.Data.Length == 0 )
331 { 331 {
332 if (id != UUID.Zero) 332 //m_log.WarnFormat("[Materials]: Prim \"{0}\" ({1}) contains unknown material ID {2}", part.Name, part.UUID, id);
333 m_log.WarnFormat("[Materials]: Prim \"{0}\" ({1}) contains unknown material ID {2}", part.Name, part.UUID, id);
334 return; 333 return;
335 } 334 }
336 335