Skip to content

Commit

Permalink
LSM: Review changes
Browse files Browse the repository at this point in the history
  • Loading branch information
cb22 committed Oct 24, 2023
1 parent 0733fb7 commit e81a087
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
8 changes: 3 additions & 5 deletions src/lsm/groove.zig
Original file line number Diff line number Diff line change
Expand Up @@ -910,9 +910,7 @@ pub fn GrooveType(
// Sanity check to ensure the caller didn't accidentally pass in an alias.
assert(new != old);

if (has_id) {
assert(old.id == new.id);
}
if (has_id) assert(old.id == new.id);
assert(old.timestamp == new.timestamp);

// The ID can't change, so no need to update the ID tree. Update the object tree entry
Expand Down Expand Up @@ -950,8 +948,8 @@ pub fn GrooveType(

// Putting the objects_cache upsert after the index tree updates is critical:
// We diff the old and new objects, but the old object will be a pointer into the
// objects_cache. If we upsert first, old.* == new.* and no secondary indexes will
// be updated!
// objects_cache. If we upsert first, there's a high chance old.* == new.* (always,
// unless old comes from the stash) and no secondary indexes will be updated!
groove.objects_cache.upsert(new);
groove.objects.put(new);
}
Expand Down
2 changes: 1 addition & 1 deletion src/stdx.zig
Original file line number Diff line number Diff line change
Expand Up @@ -545,7 +545,7 @@ pub fn has_unique_representation(comptime T: type) bool {
.Struct => |info| {
// Only consider packed structs unique if they are byte aligned.
if (info.backing_integer) |backing_integer| {
return @sizeOf(@Type(.{ .Struct = info })) * 8 == @bitSizeOf(backing_integer);
return @sizeOf(T) * 8 == @bitSizeOf(backing_integer);
}

var sum_size = @as(usize, 0);
Expand Down

0 comments on commit e81a087

Please sign in to comment.