This is an automated email from the ASF dual-hosted git repository.

zwoop pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/trafficserver.git


The following commit(s) were added to refs/heads/master by this push:
     new f6c051b9d5 Change the interpretation of cache fragment size (#11866)
f6c051b9d5 is described below

commit f6c051b9d568c3d35a7aca298a1c7af1c01d23f0
Author: Leif Hedstrom <[email protected]>
AuthorDate: Fri Nov 15 08:30:49 2024 -0700

    Change the interpretation of cache fragment size (#11866)
---
 src/iocore/cache/Cache.cc   | 5 ++++-
 src/iocore/cache/StripeSM.h | 4 ++--
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/src/iocore/cache/Cache.cc b/src/iocore/cache/Cache.cc
index 04f88f3416..d99a53f6da 100644
--- a/src/iocore/cache/Cache.cc
+++ b/src/iocore/cache/Cache.cc
@@ -860,8 +860,11 @@ ink_cache_init(ts::ModuleVersion v)
              REC_ERR_FAIL);
   REC_ReadConfigInt32(cache_config_target_fragment_size, 
"proxy.config.cache.target_fragment_size");
 
-  if (cache_config_target_fragment_size == 0 || 
cache_config_target_fragment_size - sizeof(Doc) > MAX_FRAG_SIZE) {
+  if (cache_config_target_fragment_size == 0) {
     cache_config_target_fragment_size = DEFAULT_TARGET_FRAGMENT_SIZE;
+  } else if (cache_config_target_fragment_size - sizeof(Doc) > MAX_FRAG_SIZE) {
+    Warning("The fragments size exceed the limitation, setting to 
MAX_FRAG_SIZE (%ld)", MAX_FRAG_SIZE + sizeof(Doc));
+    cache_config_target_fragment_size = MAX_FRAG_SIZE + sizeof(Doc);
   }
 
   REC_EstablishStaticConfigInt32(cache_config_max_disk_errors, 
"proxy.config.cache.max_disk_errors");
diff --git a/src/iocore/cache/StripeSM.h b/src/iocore/cache/StripeSM.h
index e24b89e497..a1d1effcb4 100644
--- a/src/iocore/cache/StripeSM.h
+++ b/src/iocore/cache/StripeSM.h
@@ -52,8 +52,8 @@
 #define LOOKASIDE_SIZE               256
 #define AIO_NOT_IN_PROGRESS          -1
 #define AIO_AGG_WRITE_IN_PROGRESS    -2
-#define AUTO_SIZE_RAM_CACHE          -1                      // 1-1 with 
directory size
-#define DEFAULT_TARGET_FRAGMENT_SIZE (1048576 - sizeof(Doc)) // 1MB
+#define AUTO_SIZE_RAM_CACHE          -1       // 1-1 with directory size
+#define DEFAULT_TARGET_FRAGMENT_SIZE 1048576; // 1MB. Note: Should not exclude 
sizeof(Doc)
 #define STORE_BLOCKS_PER_STRIPE      (STRIPE_BLOCK_SIZE / STORE_BLOCK_SIZE)
 
 // Documents

Reply via email to