Reformat / cleanup
All checks were successful
NuGet Publish / build-and-pack (push) Successful in 46s
NuGet Publish / publish-to-gitea (push) Successful in 56s

This commit is contained in:
Joseph Doherty
2026-02-21 08:10:36 -05:00
parent 4c6aaa5a3f
commit a70d8befae
176 changed files with 50555 additions and 49587 deletions

View File

@@ -7,12 +7,12 @@ namespace ZB.MOM.WW.CBDD.Tests;
public class CompactionOnlineConcurrencyTests
{
/// <summary>
/// Verifies online compaction completes without deadlock under concurrent workload.
/// Verifies online compaction completes without deadlock under concurrent workload.
/// </summary>
[Fact]
public async Task OnlineCompaction_WithConcurrentishWorkload_ShouldCompleteWithoutDeadlock()
{
var dbPath = NewDbPath();
string dbPath = NewDbPath();
var activeIds = new List<ObjectId>();
var sync = new object();
var completedOps = 0;
@@ -48,10 +48,7 @@ public class CompactionOnlineConcurrencyTests
ObjectId? candidate = null;
lock (sync)
{
if (activeIds.Count > 0)
{
candidate = activeIds[i % activeIds.Count];
}
if (activeIds.Count > 0) candidate = activeIds[i % activeIds.Count];
}
if (candidate.HasValue)
@@ -76,10 +73,7 @@ public class CompactionOnlineConcurrencyTests
}
}
if (candidate.HasValue)
{
db.Users.Delete(candidate.Value);
}
if (candidate.HasValue) db.Users.Delete(candidate.Value);
}
db.SaveChanges();
@@ -115,10 +109,7 @@ public class CompactionOnlineConcurrencyTests
}
var actualIds = allUsers.Select(x => x.Id).ToHashSet();
foreach (var id in snapshotIds)
{
actualIds.ShouldContain(id);
}
foreach (var id in snapshotIds) actualIds.ShouldContain(id);
}
finally
{
@@ -127,14 +118,16 @@ public class CompactionOnlineConcurrencyTests
}
private static string NewDbPath()
=> Path.Combine(Path.GetTempPath(), $"compaction_online_{Guid.NewGuid():N}.db");
{
return Path.Combine(Path.GetTempPath(), $"compaction_online_{Guid.NewGuid():N}.db");
}
private static void CleanupFiles(string dbPath)
{
var walPath = Path.ChangeExtension(dbPath, ".wal");
string walPath = Path.ChangeExtension(dbPath, ".wal");
var markerPath = $"{dbPath}.compact.state";
if (File.Exists(dbPath)) File.Delete(dbPath);
if (File.Exists(walPath)) File.Delete(walPath);
if (File.Exists(markerPath)) File.Delete(markerPath);
}
}
}