Skip to content

Commit c18b976

Browse files
authored
refactor(accountsdb): Add more testing for public API (#933)
Accompanied by some fixes, refactors, and helpful additions. With this we are now testing insertion, deletion, forking, and behavior of all these relative to the rooted slot.
1 parent 64857f6 commit c18b976

File tree

10 files changed

+1068
-189
lines changed

10 files changed

+1068
-189
lines changed

src/accountsdb/account_store.zig

Lines changed: 656 additions & 4 deletions
Large diffs are not rendered by default.

src/accountsdb/db.zig

Lines changed: 130 additions & 65 deletions
Large diffs are not rendered by default.

src/accountsdb/fuzz.zig

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -186,12 +186,12 @@ pub fn run(seed: u64, args: *std.process.ArgIterator) !void {
186186
// prealloc some references to use throught the fuzz
187187
try accounts_db.account_index.expandRefCapacity(1_000_000);
188188

189-
var manager_exit: std.atomic.Value(bool) = .init(false);
190189
var manager: sig.accounts_db.manager.Manager = try .init(allocator, &accounts_db, .{
191-
.exit = &manager_exit,
192-
.slots_per_full_snapshot = 50_000,
193-
.slots_per_incremental_snapshot = 5_000,
194-
.zstd_nb_workers = @intCast(std.Thread.getCpuCount() catch 0),
190+
.snapshot = .{
191+
.slots_per_full_snapshot = 50_000,
192+
.slots_per_incremental_snapshot = 5_000,
193+
.zstd_nb_workers = @intCast(std.Thread.getCpuCount() catch 0),
194+
},
195195
});
196196
defer manager.deinit(allocator);
197197

@@ -358,7 +358,10 @@ pub fn run(seed: u64, args: *std.process.ArgIterator) !void {
358358
random.int(u8) == 0;
359359
if (create_new_root) snapshot_validation: {
360360
largest_rooted_slot = @min(top_slot, largest_rooted_slot + 2);
361-
accounts_db.largest_rooted_slot.store(largest_rooted_slot, .monotonic);
361+
accounts_db.max_slots.set(.{
362+
.rooted = largest_rooted_slot,
363+
.flushed = null,
364+
});
362365
try manager.manage(allocator);
363366

364367
// holding the lock here means that the snapshot archive(s) wont be deleted

0 commit comments

Comments
 (0)