{"record":{"id":"8260c8e5d32e20f0","repo":"microsoft/garnet","slug":"aofpagesize-effective-effectivepage-after-round","errorCode":null,"errorMessage":"AofPageSize (effective {effectivePage} after rounding down to a power of two) cannot be larger than AofSegmentSize (effective {effectiveSegment}). Increase --aof-segment-size to at least {effectivePage}, or reduce --aof-page-size.","messagePattern":"AofPageSize \\(effective (.+?) after rounding down to a power of two\\) cannot be larger than AofSegmentSize \\(effective (.+?)\\)\\. Increase --aof-segment-size to at least (.+?), or reduce --aof-page-size\\.","errorType":"validation","errorClass":"Exception","httpStatus":null,"severity":"critical","filePath":"libs/server/Servers/GarnetServerOptions.cs","lineNumber":998,"sourceCode":"                var effectiveMemory = PrettySize(1L << memorySizeBits);\n                var effectivePage = PrettySize(1L << pageSizeBits);\n                var minMemory = PrettySize(1L << (pageSizeBits + 1));\n                var msg = $\"AofMemorySize (effective {effectiveMemory} after rounding down to a power of two) \" +\n                          $\"must be at least twice AofPageSize (effective {effectivePage}). \" +\n                          $\"Increase --aof-memory to at least {minMemory}, or reduce --aof-page-size.\";\n                logger?.LogError(\"{msg}\", msg);\n                throw new Exception(msg);\n            }\n\n            if (pageSizeBits > segmentSizeBits)\n            {\n                var effectivePage = PrettySize(1L << pageSizeBits);\n                var effectiveSegment = PrettySize(1L << segmentSizeBits);\n                var msg = $\"AofPageSize (effective {effectivePage} after rounding down to a power of two) \" +\n                          $\"cannot be larger than AofSegmentSize (effective {effectiveSegment}). \" +\n                          $\"Increase --aof-segment-size to at least {effectivePage}, or reduce --aof-page-size.\";\n                logger?.LogError(\"{msg}\", msg);\n                throw new Exception(msg);\n            }\n\n            // AofPageSize must be at least twice the main-log PageSize. An AOF entry mirrors a single\n            // main-log write (key + value/input + small overhead); raw-string SETs can be as large as\n            // the main-log PageSize (values above MaxInlineValueSize overflow to the heap on the main\n            // store but are still written in full to the AOF), and object commands like LPUSH/HSET can\n            // push the AOF entry even higher. Throw a clear error here so users do not hit the runtime\n            // \"Entry does not fit on page\" path with a stalled session.\n            var mainPageSizeBits = PageSizeBits();\n            if (pageSizeBits < mainPageSizeBits + 1)\n            {\n                var effectiveAofPage = PrettySize(1L << pageSizeBits);\n                var effectiveMainPage = PrettySize(1L << mainPageSizeBits);\n                var minAofPage = PrettySize(1L << (mainPageSizeBits + 1));\n                var msg = $\"AofPageSize (effective {effectiveAofPage} after rounding down to a power of two) \" +\n                          $\"must be at least twice the main-log PageSize (effective {effectiveMainPage}). \" +\n                          $\"Increase --aof-page-size to at least {minAofPage} (and --aof-memory to at least {PrettySize(1L << (mainPageSizeBits + 2))}), \" +\n                          $\"or reduce --page.\";","sourceCodeStart":980,"sourceCodeEnd":1016,"githubUrl":"https://github.com/microsoft/garnet/blob/951b0fc6838721f89d102c2bbe1b914e8d39d700/libs/server/Servers/GarnetServerOptions.cs#L980-L1016","documentation":"Garnet validates that the AOF page size does not exceed the AOF segment size. The page is the in-memory unit and the segment is the on-disk unit; a page larger than a segment is structurally invalid in Tsavorite's log. The check uses log2 bits: pageSizeBits > segmentSizeBits triggers the error.","triggerScenarios":"Calling GetAofSettings() when AofPageSizeBits() > AofSegmentSizeBits(). Occurs when --aof-page-size (after rounding) is larger than --aof-segment-size. For example, --aof-page-size 1g --aof-segment-size 512m.","commonSituations":"Raising --aof-page-size for large writes without also raising --aof-segment-size; copying a config with mismatched AOF size tiers; using very small segment sizes on memory-constrained devices.","solutions":["Increase --aof-segment-size to at least the effective --aof-page-size value.","Reduce --aof-page-size so it does not exceed the segment size.","Remove both overrides to use Garnet defaults where segment is always larger than page."],"exampleFix":"// before\n--aof-page-size 1g --aof-segment-size 512m\n\n// after\n--aof-page-size 256m --aof-segment-size 1g","handlingStrategy":"validation","validationCode":"var pageBits = options.AofPageSizeBits();\nvar segBits = options.AofSegmentSizeBits();\nif (pageBits > segBits)\n    throw new InvalidOperationException($\"AOF page ({1L << pageBits} bytes) exceeds segment ({1L << segBits} bytes).\");","typeGuard":null,"tryCatchPattern":"try { options.GetAofSettings(dbId, out var settings); }\ncatch (Exception ex) when (ex.Message.Contains(\"AofPageSize\") && ex.Message.Contains(\"AofSegmentSize\"))\n{ logger.LogError(\"AOF page/segment mismatch: {Msg}\", ex.Message); throw; }","preventionTips":["Maintain the size hierarchy: page < memory and page <= segment.","Document the size ordering convention in your deployment config.","Validate the entire AOF size chain in a pre-startup health check."],"tags":["aof","configuration","startup","garnet"],"backgroundTag":null,"analyzedSha":"951b0fc6838721f89d102c2bbe1b914e8d39d700","analyzedAt":"2026-08-13T19:01:32.939Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}