{"record":{"id":"cd7e082032bacd2e","repo":"microsoft/garnet","slug":"not-implemented-for-tsavoritelogallocator","errorCode":null,"errorMessage":"Not implemented for TsavoriteLogAllocator","messagePattern":"Not implemented for TsavoriteLogAllocator","errorType":"exception","errorClass":"NotImplementedException","httpStatus":null,"severity":"error","filePath":"libs/storage/Tsavorite/cs/src/core/Allocator/TsavoriteLogAllocator.cs","lineNumber":42,"sourceCode":"            _this = (TsavoriteLogAllocatorImpl)@this;\n        }\n\n        /// <inheritdoc/>\n        public readonly AllocatorBase<TsavoriteLogStoreFunctions, TAllocator> GetBase<TAllocator>()\n            where TAllocator : IAllocator<TsavoriteLogStoreFunctions>\n            => (AllocatorBase<TsavoriteLogStoreFunctions, TAllocator>)(object)_this;\n\n        /// <inheritdoc/>\n        public readonly bool HasObjectLog => false;\n\n        /// <inheritdoc/>\n        [MethodImpl(MethodImplOptions.AggressiveInlining)]\n        public readonly void InitializeRecord<TKey>(TKey key, long logicalAddress, in RecordSizeInfo _, ref LogRecord newLogRecord)\n            where TKey : IKey\n#if NET9_0_OR_GREATER\n                , allows ref struct\n#endif\n            => throw new NotImplementedException(\"Not implemented for TsavoriteLogAllocator\");\n\n        /// <inheritdoc/>\n        [MethodImpl(MethodImplOptions.AggressiveInlining)]\n        public readonly RecordSizeInfo GetRMWCopyRecordSize<TSourceLogRecord, TInput, TVariableLengthInput>(in TSourceLogRecord srcLogRecord, ref TInput input, TVariableLengthInput varlenInput)\n            where TSourceLogRecord : ISourceLogRecord\n            where TVariableLengthInput : IVariableLengthInput<TInput>\n              => throw new NotImplementedException(\"Not implemented for TsavoriteLogAllocator\");\n\n        /// <inheritdoc/>\n        [MethodImpl(MethodImplOptions.AggressiveInlining)]\n        public readonly RecordSizeInfo GetRMWInitialRecordSize<TKey, TInput, TVariableLengthInput>(TKey key, ref TInput input, TVariableLengthInput varlenInput)\n            where TKey : IKey\n#if NET9_0_OR_GREATER\n                , allows ref struct\n#endif\n            where TVariableLengthInput : IVariableLengthInput<TInput>\n            => throw new NotImplementedException(\"Not implemented for TsavoriteLogAllocator\");\n","sourceCodeStart":24,"sourceCodeEnd":60,"githubUrl":"https://github.com/microsoft/garnet/blob/951b0fc6838721f89d102c2bbe1b914e8d39d700/libs/storage/Tsavorite/cs/src/core/Allocator/TsavoriteLogAllocator.cs#L24-L60","documentation":"TsavoriteLogAllocator is the allocator backing TsavoriteLog, an append-only log with no key comparisons or value operations (the struct's own comment states this). InitializeRecord — which writes a key into a newly allocated log record — is therefore meaningless for a log allocator and throws NotImplementedException. Keys exist in FasterKV stores, not in TsavoriteLog.","triggerScenarios":"Invoking InitializeRecord on a TsavoriteLogAllocator instance, typically via generic plumbing that works against any IAllocator but was routed to the log allocator instead of a FasterKV allocator.","commonSituations":"Reusing FasterKV record-initialization helpers against a TsavoriteLog; reflection/dynamic dispatch hitting this stub; a bug in allocator selection that binds KV code to the log allocator.","solutions":["Do not call KV record initialization on TsavoriteLog; use session.Append for the log instead.","If you need keyed records (InitializeRecord/Upsert/RMW/Delete), use a FasterKV store, not TsavoriteLog.","Add a type guard rejecting TsavoriteLogAllocator before dispatching to KV allocator methods."],"exampleFix":"// before\nallocator.InitializeRecord(key, addr, in sizeInfo, ref record);\n\n// after\nif (allocator.GetBase<TsavoriteLogAllocator>() is not null)\n    throw new InvalidOperationException(\"TsavoriteLog does not support keyed records; use FasterKV.\");\nallocator.InitializeRecord(key, addr, in sizeInfo, ref record);","handlingStrategy":"type-guard","validationCode":null,"typeGuard":"static bool IsLogAllocator<TAllocator>(TAllocator a) where TAllocator : IAllocator =>\n    a is TsavoriteLogAllocator;","tryCatchPattern":null,"preventionTips":["Use TsavoriteLog only for appends; never route keyed operations at its allocator.","Type-guard TsavoriteLogAllocator out of generic KV pipelines.","Bind KV workloads to FasterKV stores with real allocators."],"tags":["tsavorite","allocator","notimplemented","log-mode","record-init"],"backgroundTag":null,"analyzedSha":"951b0fc6838721f89d102c2bbe1b914e8d39d700","analyzedAt":"2026-08-13T19:01:32.939Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}