{"record":{"id":"9f7a6e1511b8d024","repo":"microsoft/garnet","slug":"initialiorecordsize-value-initialiorecordsize-9f7a6e","errorCode":null,"errorMessage":"InitialIORecordSize value '{InitialIORecordSize}' ({sizeInBytes} bytes) exceeds the page size ({1L << PageSizeBits()} bytes).","messagePattern":"InitialIORecordSize value '(.+?)' \\((.+?) bytes\\) exceeds the page size \\((.+?) bytes\\)\\.","errorType":"validation","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"libs/server/Servers/GarnetServerOptions.cs","lineNumber":955,"sourceCode":"        /// <summary>\n        /// Parse <see cref=\"InitialIORecordSize\"/> as a byte count.\n        /// Returns <see cref=\"KVSettings.UseDefaultInitialIORecordSize\"/> if the value is null or empty (use default).\n        /// </summary>\n        /// <returns>The byte value used for <c>KVSettings.InitialIORecordSize</c>, or <see cref=\"KVSettings.UseDefaultInitialIORecordSize\"/> if unset.</returns>\n        /// <exception cref=\"Exception\">Thrown when the value cannot be parsed.</exception>\n        public int GetInitialIORecordSizeBytes()\n        {\n            if (string.IsNullOrEmpty(InitialIORecordSize))\n                return KVSettings.UseDefaultInitialIORecordSize;\n\n            if (!TryParseSize(InitialIORecordSize, out var sizeInBytes))\n                throw new Exception($\"Unable to parse {nameof(InitialIORecordSize)} value '{InitialIORecordSize}'. Expected a memory size string (e.g. '4k', '8k').\");\n\n            if (sizeInBytes <= 0)\n                throw new Exception($\"{nameof(InitialIORecordSize)} value '{InitialIORecordSize}' ({sizeInBytes} bytes) must be positive.\");\n\n            if (sizeInBytes > 1L << PageSizeBits())\n                throw new Exception($\"{nameof(InitialIORecordSize)} value '{InitialIORecordSize}' ({sizeInBytes} bytes) exceeds the page size ({1L << PageSizeBits()} bytes).\");\n\n            return (int)sizeInBytes;\n        }\n\n        /// <summary>\n        /// Get AOF settings\n        /// </summary>\n        /// <param name=\"dbId\">DB ID</param>\n        /// <param name=\"tsavoriteLogSettings\">Tsavorite log settings</param>\n        public void GetAofSettings(int dbId, out TsavoriteLogSettings[] tsavoriteLogSettings)\n        {\n            // Validate sizes up-front (invariant across sublogs) so we don't allocate devices\n            // or commit managers that would need to be disposed if validation fails.\n            var memorySizeBits = AofMemorySizeBits();\n            var pageSizeBits = AofPageSizeBits();\n            var segmentSizeBits = AofSegmentSizeBits();\n\n            // Tsavorite requires MemorySize >= 2 * PageSize (so at least two pages fit in memory).","sourceCodeStart":937,"sourceCodeEnd":973,"githubUrl":"https://github.com/microsoft/garnet/blob/951b0fc6838721f89d102c2bbe1b914e8d39d700/libs/server/Servers/GarnetServerOptions.cs#L937-L973","documentation":"InitialIORecordSize is the size of a single read issued when loading a record from disk, so it must not exceed the page size (1 << PageSizeBits). A value larger than a page is nonsensical because a record cannot span more than a page boundary here; GetInitialIORecordSizeBytes() rejects it.","triggerScenarios":"Setting --initial-io-record-size larger than the page size, e.g. '8k' with --page 4k. Thrown at GarnetServerOptions.cs:954-955.","commonSituations":"Raising the IO read size without checking the configured page size; mismatched values copied across configs.","solutions":["Keep --initial-io-record-size <= the page size (default page is ~4 KiB).","Or raise --page to be >= the desired IO record size.","Omit the flag to use the built-in default, which is already within bounds."],"exampleFix":"# before (fails: 8k > 4k page)\ngarnet-server --initial-io-record-size 8k\n\n# after: align with a larger page\ngarnet-server --page 16k --initial-io-record-size 8k","handlingStrategy":"validation","validationCode":"var pageSize = 1L << options.PageSizeBits();\nif (!string.IsNullOrEmpty(options.InitialIORecordSize)\n    && ServerOptions.TryParseSize(options.InitialIORecordSize, out var io)\n    && io > pageSize) {\n    throw new ArgumentOutOfRangeException($\"InitialIORecordSize ({io}) must be <= pageSize ({pageSize})\");\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Keep InitialIORecordSize <= the page size; raise --page if needed.","Validate IO record size against the configured page size in config checks."],"tags":["garnet","config","tsavorite","storage","dotnet"],"backgroundTag":null,"analyzedSha":"951b0fc6838721f89d102c2bbe1b914e8d39d700","analyzedAt":"2026-08-13T19:01:32.939Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}