For FlotsamAssetCache, always update access times of cached scene assets before looking for files to expire.
This is to resolve a problem where an asset marked as local but not temporary but still used in the scene would be removed. The timed expiry scan no longer tries to refetch assets from the scene that are not currently in the cache - this is not helpful since it just drags a lot of data into the cache that may never be referenced. This removes the DeepScanBeforePurge option since setting this to false will introduce the above problem. This previously had a default of true.integration
parent
5dd2569bf7
commit
d5c8c6bc12
|
@ -107,8 +107,6 @@ namespace OpenSim.Region.CoreModules.Asset
|
||||||
private IAssetService m_AssetService;
|
private IAssetService m_AssetService;
|
||||||
private List<Scene> m_Scenes = new List<Scene>();
|
private List<Scene> m_Scenes = new List<Scene>();
|
||||||
|
|
||||||
private bool m_DeepScanBeforePurge;
|
|
||||||
|
|
||||||
public FlotsamAssetCache()
|
public FlotsamAssetCache()
|
||||||
{
|
{
|
||||||
m_InvalidChars.AddRange(Path.GetInvalidPathChars());
|
m_InvalidChars.AddRange(Path.GetInvalidPathChars());
|
||||||
|
@ -170,8 +168,6 @@ namespace OpenSim.Region.CoreModules.Asset
|
||||||
m_CacheDirectoryTierLen = assetConfig.GetInt("CacheDirectoryTierLength", m_CacheDirectoryTierLen);
|
m_CacheDirectoryTierLen = assetConfig.GetInt("CacheDirectoryTierLength", m_CacheDirectoryTierLen);
|
||||||
|
|
||||||
m_CacheWarnAt = assetConfig.GetInt("CacheWarnAt", m_CacheWarnAt);
|
m_CacheWarnAt = assetConfig.GetInt("CacheWarnAt", m_CacheWarnAt);
|
||||||
|
|
||||||
m_DeepScanBeforePurge = assetConfig.GetBoolean("DeepScanBeforePurge", m_DeepScanBeforePurge);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
m_log.InfoFormat("[FLOTSAM ASSET CACHE]: Cache Directory {0}", m_CacheDirectory);
|
m_log.InfoFormat("[FLOTSAM ASSET CACHE]: Cache Directory {0}", m_CacheDirectory);
|
||||||
|
@ -506,13 +502,10 @@ namespace OpenSim.Region.CoreModules.Asset
|
||||||
// Purge all files last accessed prior to this point
|
// Purge all files last accessed prior to this point
|
||||||
DateTime purgeLine = DateTime.Now - m_FileExpiration;
|
DateTime purgeLine = DateTime.Now - m_FileExpiration;
|
||||||
|
|
||||||
// An optional deep scan at this point will ensure assets present in scenes,
|
// An asset cache may contain local non-temporary assets that are not in the asset service. Therefore,
|
||||||
// or referenced by objects in the scene, but not recently accessed
|
// before cleaning up expired files we must scan the objects in the scene to make sure that we retain
|
||||||
// are not purged.
|
// such local assets if they have not been recently accessed.
|
||||||
if (m_DeepScanBeforePurge)
|
TouchAllSceneAssets(false);
|
||||||
{
|
|
||||||
CacheScenes();
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach (string dir in Directory.GetDirectories(m_CacheDirectory))
|
foreach (string dir in Directory.GetDirectories(m_CacheDirectory))
|
||||||
{
|
{
|
||||||
|
@ -705,11 +698,14 @@ namespace OpenSim.Region.CoreModules.Asset
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Iterates through all Scenes, doing a deep scan through assets
|
/// Iterates through all Scenes, doing a deep scan through assets
|
||||||
/// to cache all assets present in the scene or referenced by assets
|
/// to update the access time of all assets present in the scene or referenced by assets
|
||||||
/// in the scene
|
/// in the scene.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
/// <param name="storeUncached">
|
||||||
private int CacheScenes()
|
/// If true, then assets scanned which are not found in cache are added to the cache.
|
||||||
|
/// </param>
|
||||||
|
/// <returns>Number of distinct asset references found in the scene.</returns>
|
||||||
|
private int TouchAllSceneAssets(bool storeUncached)
|
||||||
{
|
{
|
||||||
UuidGatherer gatherer = new UuidGatherer(m_AssetService);
|
UuidGatherer gatherer = new UuidGatherer(m_AssetService);
|
||||||
|
|
||||||
|
@ -732,7 +728,7 @@ namespace OpenSim.Region.CoreModules.Asset
|
||||||
{
|
{
|
||||||
File.SetLastAccessTime(filename, DateTime.Now);
|
File.SetLastAccessTime(filename, DateTime.Now);
|
||||||
}
|
}
|
||||||
else
|
else if (storeUncached)
|
||||||
{
|
{
|
||||||
m_AssetService.Get(assetID.ToString());
|
m_AssetService.Get(assetID.ToString());
|
||||||
}
|
}
|
||||||
|
@ -860,13 +856,14 @@ namespace OpenSim.Region.CoreModules.Asset
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
case "assets":
|
case "assets":
|
||||||
m_log.Info("[FLOTSAM ASSET CACHE]: Caching all assets, in all scenes.");
|
m_log.Info("[FLOTSAM ASSET CACHE]: Ensuring assets are cached for all scenes.");
|
||||||
|
|
||||||
Util.FireAndForget(delegate {
|
Util.FireAndForget(delegate {
|
||||||
int assetsCached = CacheScenes();
|
int assetReferenceTotal = TouchAllSceneAssets(true);
|
||||||
m_log.InfoFormat("[FLOTSAM ASSET CACHE]: Completed Scene Caching, {0} assets found.", assetsCached);
|
m_log.InfoFormat(
|
||||||
|
"[FLOTSAM ASSET CACHE]: Completed check with {0} assets.",
|
||||||
|
assetReferenceTotal);
|
||||||
});
|
});
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -54,10 +54,3 @@
|
||||||
|
|
||||||
; Warning level for cache directory size
|
; Warning level for cache directory size
|
||||||
;CacheWarnAt = 30000
|
;CacheWarnAt = 30000
|
||||||
|
|
||||||
; Perform a deep scan of all assets within all regions, looking for all assets
|
|
||||||
; present or referenced. Mark all assets found that are already present in the
|
|
||||||
; cache, and request all assets that are found that are not already cached (this
|
|
||||||
; will cause those assets to be cached)
|
|
||||||
;
|
|
||||||
DeepScanBeforePurge = true
|
|
||||||
|
|
Loading…
Reference in New Issue