diff --git a/cs/src/core/Allocator/AllocatorBase.cs b/cs/src/core/Allocator/AllocatorBase.cs
index 72eb6f0ed..ee557ca74 100644
--- a/cs/src/core/Allocator/AllocatorBase.cs
+++ b/cs/src/core/Allocator/AllocatorBase.cs
@@ -334,6 +334,12 @@ public abstract (int, int) GetRecordSize(long physicalAddr
///
public abstract int GetAverageRecordSize();
+ ///
+ /// Get size of fixed (known) part of record on the main log
+ ///
+ ///
+ public abstract int GetFixedRecordSize();
+
///
/// Get initial record size
///
diff --git a/cs/src/core/Allocator/BlittableAllocator.cs b/cs/src/core/Allocator/BlittableAllocator.cs
index f4aa9f210..501e7c091 100644
--- a/cs/src/core/Allocator/BlittableAllocator.cs
+++ b/cs/src/core/Allocator/BlittableAllocator.cs
@@ -75,6 +75,8 @@ public override int GetAverageRecordSize()
return recordSize;
}
+ public override int GetFixedRecordSize() => recordSize;
+
public override (int, int) GetInitialRecordSize(ref Key key, ref Input input, FasterSession fasterSession)
{
return (recordSize, recordSize);
diff --git a/cs/src/core/Allocator/GenericAllocator.cs b/cs/src/core/Allocator/GenericAllocator.cs
index 29d45294e..8373a70e0 100644
--- a/cs/src/core/Allocator/GenericAllocator.cs
+++ b/cs/src/core/Allocator/GenericAllocator.cs
@@ -160,6 +160,8 @@ public override int GetAverageRecordSize()
return recordSize;
}
+ public override int GetFixedRecordSize() => recordSize;
+
public override (int, int) GetInitialRecordSize(ref Key key, ref Input input, FasterSession fasterSession)
{
return (recordSize, recordSize);
diff --git a/cs/src/core/Allocator/VarLenBlittableAllocator.cs b/cs/src/core/Allocator/VarLenBlittableAllocator.cs
index e95a297a3..5a0db930e 100644
--- a/cs/src/core/Allocator/VarLenBlittableAllocator.cs
+++ b/cs/src/core/Allocator/VarLenBlittableAllocator.cs
@@ -158,6 +158,13 @@ public override int GetAverageRecordSize()
((ValueLength.GetInitialLength() + kRecordAlignment - 1) & (~(kRecordAlignment - 1)));
}
+ public override int GetFixedRecordSize()
+ {
+ return RecordInfo.GetLength()
+ + (fixedSizeKey ? KeyLength.GetInitialLength() : 0)
+ + (fixedSizeValue ? ValueLength.GetInitialLength() : 0);
+ }
+
public override (int, int) GetInitialRecordSize(ref Key key, ref TInput input, FasterSession fasterSession)
{
var actualSize = RecordInfo.GetLength() +
diff --git a/cs/src/core/Index/FASTER/LogAccessor.cs b/cs/src/core/Index/FASTER/LogAccessor.cs
index 383179a7c..dc1f0acb1 100644
--- a/cs/src/core/Index/FASTER/LogAccessor.cs
+++ b/cs/src/core/Index/FASTER/LogAccessor.cs
@@ -53,6 +53,14 @@ public LogAccessor(FasterKV fht, AllocatorBase allocator
///
public long BeginAddress => allocator.BeginAddress;
+ ///
+ /// Get the bytes used on the primary log by every record. Does not include
+ /// the size of variable-length inline data. Note that class objects occupy
+ /// 8 bytes (reference) on the main log (i.e., the heap space occupied by
+ /// class objects is not included in the result of this call).
+ ///
+ public int FixedRecordSize => allocator.GetFixedRecordSize();
+
///
/// Truncate the log until, but not including, untilAddress. Make sure address corresponds to record boundary if snapToPageStart is set to false.
///