Skip to content

Commit

Permalink
Fix defunct silo cleanup for Azure Table Storage (dotnet#6624)
Browse files Browse the repository at this point in the history
  • Loading branch information
ReubenBond authored Jun 30, 2020
1 parent f5e2040 commit 10290b8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,9 @@ internal async Task<int> DeleteTableEntries(string clusterId)
public async Task CleanupDefunctSiloEntries(DateTimeOffset beforeDate)
{
var entriesList = (await FindAllSiloEntries())
.Where(entry => (entry.Item1.Status != INSTANCE_STATUS_ACTIVE) && entry.Item1.Timestamp < beforeDate)
.Where(entry => !string.Equals(SiloInstanceTableEntry.TABLE_VERSION_ROW, entry.Item1.RowKey)
&& entry.Item1.Status != INSTANCE_STATUS_ACTIVE
&& entry.Item1.Timestamp < beforeDate)
.ToList();

await DeleteEntriesBatch(entriesList);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,8 @@ public async Task SiloInstanceTable_Op_CleanDeadSiloInstance()
{
this.generation = i;
this.siloAddress = SiloAddressUtils.NewLocalSiloAddress(generation);
RegisterSiloInstance();
var instance = RegisterSiloInstance();
await manager.ActivateSiloInstance(instance);
}

await Task.Delay(TimeSpan.FromSeconds(3));
Expand Down Expand Up @@ -236,7 +237,7 @@ public void SiloAddress_ToFrom_RowKey()
Assert.Equal(SiloInstanceTableEntry.ConstructRowKey(siloAddress), SiloInstanceTableEntry.ConstructRowKey(fromRowKey));
}

private void RegisterSiloInstance()
private SiloInstanceTableEntry RegisterSiloInstance()
{
string partitionKey = this.clusterId;
string rowKey = SiloInstanceTableEntry.ConstructRowKey(siloAddress);
Expand Down Expand Up @@ -266,6 +267,7 @@ private void RegisterSiloInstance()
output.WriteLine("MyEntry={0}", myEntry);

manager.RegisterSiloInstance(myEntry);
return myEntry;
}

private async Task<Tuple<SiloInstanceTableEntry, string>> FindSiloEntry(SiloAddress siloAddr)
Expand Down

0 comments on commit 10290b8

Please sign in to comment.