Skip to content

Commit

Permalink
Fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
badrishc committed Sep 4, 2019
1 parent 00fadc5 commit 27b677e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 34 deletions.
23 changes: 5 additions & 18 deletions cs/src/core/ClientSession/FASTERAsync.cs
Original file line number Diff line number Diff line change
Expand Up @@ -80,24 +80,16 @@ internal async ValueTask CompletePendingAsync(ClientSession<Key, Value, Input, O
/// <returns></returns>
internal async ValueTask CompleteCheckpointAsync(ClientSession<Key, Value, Input, Output, Context, Functions> clientSession)
{
// Thread has an active session.
// So we need to constantly complete pending
// and refresh (done inside CompletePending)
// for the checkpoint to be proceed
int count = 0;
do
// Called outside active session
while (true)
{
var systemState = _systemState;
await InternalRefreshAsync(clientSession);
await CompletePendingAsync(clientSession);

if (_systemState.phase == Phase.REST)
{
await CompletePendingAsync(clientSession);
if (systemState.phase == Phase.REST)
return;
}

if (count++ == 10000) throw new Exception("CompleteCheckpointAsync loop too long " + threadCtx.Value.phase + threadCtx.Value.version + ":" + _systemState.phase + _systemState.version);
} while (true);
}
}

[MethodImpl(MethodImplOptions.AggressiveInlining)]
Expand Down Expand Up @@ -142,15 +134,11 @@ private async ValueTask HandleCheckpointingPhasesAsync(ClientSession<Key, Value,
var previousState = SystemState.Make(threadCtx.Value.phase, threadCtx.Value.version);
var finalState = SystemState.Copy(ref _systemState);

int count = 0;
while (finalState.phase == Phase.INTERMEDIATE)
{
finalState = SystemState.Copy(ref _systemState);
if (count++ == 10000) throw new Exception("Intermediate too long");
}

count = 0;

// We need to move from previousState to finalState one step at a time
do
{
Expand Down Expand Up @@ -371,7 +359,6 @@ private async ValueTask HandleCheckpointingPhasesAsync(ClientSession<Key, Value,
threadCtx.Value.version = currentState.version;

previousState.word = currentState.word;
if (count++ == 10000) throw new Exception("HandleCheckpointingPhases do loop too long " + previousState + ":" + finalState);
} while (previousState.word != finalState.word);

if (async)
Expand Down
16 changes: 0 additions & 16 deletions cs/src/core/Epochs/LightEpoch.cs
Original file line number Diff line number Diff line change
Expand Up @@ -321,22 +321,6 @@ 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 27b677e

Please sign in to comment.