From cbeebc209d47f9e2498cae8c25884282cb7f9aa2 Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Wed, 29 Jul 2009 17:21:36 +0000 Subject: [PATCH] Thank you, coyled, for a patch to change Flotsamcache path generation to avoid directory overflow. --- OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs | 8 ++++---- bin/config-include/FlotsamCache.ini.example | 11 +++++++++++ 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs b/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs index 35d726fbd5..bcdcfab611 100644 --- a/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs +++ b/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs @@ -94,7 +94,7 @@ namespace Flotsam.RegionModules.AssetCache /// WaitOnInprogressTimeout = 3000 /// /// ; Number of tiers to use for cache directories (current valid range 1 to 3) - /// CacheDirectoryTiers = 2 + /// CacheDirectoryTiers = 1 /// /// ; Number of letters per path tier, 1 will create 16 directories per tier, 2 - 256, 3 - 4096 and 4 - 65K /// CacheDirectoryTierLength = 3 @@ -148,7 +148,7 @@ namespace Flotsam.RegionModules.AssetCache private TimeSpan m_FileExpirationCleanupTimer = TimeSpan.Zero; private static int m_CacheDirectoryTiers = 1; - private static int m_CacheDirectoryTierLen = 4; + private static int m_CacheDirectoryTierLen = 3; private static int m_CacheWarnAt = 30000; private System.Timers.Timer m_CachCleanTimer = new System.Timers.Timer(); @@ -228,7 +228,7 @@ namespace Flotsam.RegionModules.AssetCache m_CacheDirectoryTiers = 3; } - m_CacheDirectoryTierLen = assetConfig.GetInt("CacheDirectoryTierLen", 1); + m_CacheDirectoryTierLen = assetConfig.GetInt("CacheDirectoryTierLength", 3); if (m_CacheDirectoryTierLen < 1) { m_CacheDirectoryTierLen = 1; @@ -507,7 +507,7 @@ namespace Flotsam.RegionModules.AssetCache string path = m_CacheDirectory; for (int p = 1; p <= m_CacheDirectoryTiers; p++) { - string pathPart = id.Substring(id.Length - (p * m_CacheDirectoryTierLen), m_CacheDirectoryTierLen); + string pathPart = id.Substring((p - 1) * m_CacheDirectoryTierLen, m_CacheDirectoryTierLen); path = Path.Combine(path, pathPart); } diff --git a/bin/config-include/FlotsamCache.ini.example b/bin/config-include/FlotsamCache.ini.example index e49b804f6e..feb38976b0 100644 --- a/bin/config-include/FlotsamCache.ini.example +++ b/bin/config-include/FlotsamCache.ini.example @@ -37,3 +37,14 @@ ; long (in miliseconds) to block a request thread while trying to complete ; an existing write to disk. ; WaitOnInprogressTimeout = 3000 + + ; Number of tiers to use for cache directories (current valid + ; range 1 to 3) + ;CacheDirectoryTiers = 1 + + ; Number of letters per path tier, 1 will create 16 directories + ; per tier, 2 - 256, 3 - 4096 and 4 - 65K + ;CacheDirectoryTierLength = 3 + + ; Warning level for cache directory size + ;CacheWarnAt = 30000