Skip to content

Commit

Permalink
more tests, phew
Browse files Browse the repository at this point in the history
  • Loading branch information
badrishc committed Aug 15, 2019
1 parent 4dc6d27 commit 5cda2f9
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
1 change: 1 addition & 0 deletions cs/src/core/ClientSession/FASTERAsync.cs
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ internal async ValueTask CompleteCheckpointAsync(ClientSession<Key, Value, Input
internal async ValueTask InternalRefreshAsync(ClientSession<Key, Value, Input, Output, Context, Functions> clientSession)
{
epoch.ProtectAndDrain();
epoch.Check();

// We check if we are in normal mode
var newPhaseInfo = SystemState.Copy(ref _systemState);
Expand Down
16 changes: 16 additions & 0 deletions cs/src/core/Epochs/LightEpoch.cs
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,22 @@ private int ComputeNewSafeToReclaimEpoch(int currentEpoch)
return SafeToReclaimEpoch;
}

public void Check()
{
int count = 0;
for (int index = 1; index <= numEntries; ++index)
{
int entry_epoch = (*(tableAligned + index)).localCurrentEpoch;
if (0 != entry_epoch && entry_epoch < int.MaxValue)
{
count++;
}
}

if (count > 1)
throw new Exception("Unexpected epoch entries");
}

/// <summary>
/// Reserve entry for thread. This method relies on the fact that no
/// thread will ever have ID 0.
Expand Down

0 comments on commit 5cda2f9

Please sign in to comment.