Skip to content

Commit

Permalink
Incremental large obj (#62)
Browse files Browse the repository at this point in the history
The C# version of FASTER consists of a separate object log that contains the C# objects that are heap-allocated. This checking writes and reads the object log for a page incrementally, in chunks of 100MB. This avoids collecting all the data in an in-memory buffer before reading or writing them. There is a limit of 2GB per key-value pair in this setting.
  • Loading branch information
badrishc committed Nov 13, 2018
1 parent c852752 commit d2e11ec
Show file tree
Hide file tree
Showing 7 changed files with 311 additions and 105 deletions.
30 changes: 29 additions & 1 deletion cs/src/core/Index/Common/Contexts.cs
Expand Up @@ -236,6 +236,10 @@ public struct HybridLogRecoveryInfo
/// Tokens per guid
/// </summary>
public Dictionary<Guid, long> continueTokens;
/// <summary>
/// Object log segment offsets
/// </summary>
public long[] objectLogSegmentOffsets;

/// <summary>
/// Initialize
Expand All @@ -253,6 +257,7 @@ public void Initialize(Guid token, int _version)
finalLogicalAddress = 0;
guids = new Guid[LightEpoch.kTableSize+1];
continueTokens = new Dictionary<Guid, long>();
objectLogSegmentOffsets = null;
}

/// <summary>
Expand All @@ -261,7 +266,7 @@ public void Initialize(Guid token, int _version)
/// <param name="reader"></param>
public void Initialize(StreamReader reader)
{
guids = new Guid[64];
guids = new Guid[LightEpoch.kTableSize + 1];
continueTokens = new Dictionary<Guid, long>();

string value = reader.ReadLine();
Expand Down Expand Up @@ -290,6 +295,19 @@ public void Initialize(StreamReader reader)
value = reader.ReadLine();
guids[i] = Guid.Parse(value);
}

// Read object log segment offsets
value = reader.ReadLine();
var numSegments = int.Parse(value);
if (numSegments > 0)
{
objectLogSegmentOffsets = new long[numSegments];
for (int i = 0; i < numSegments; i++)
{
value = reader.ReadLine();
objectLogSegmentOffsets[i] = long.Parse(value);
}
}
}

/// <summary>
Expand Down Expand Up @@ -364,6 +382,16 @@ public void Write(StreamWriter writer)
{
writer.WriteLine(guids[i]);
}

//Write object log segment offsets
writer.WriteLine(objectLogSegmentOffsets == null ? 0 : objectLogSegmentOffsets.Length);
if (objectLogSegmentOffsets != null)
{
for (int i = 0; i < objectLogSegmentOffsets.Length; i++)
{
writer.WriteLine(objectLogSegmentOffsets[i]);
}
}
}
}

Expand Down

0 comments on commit d2e11ec

Please sign in to comment.