Skip to content
This repository has been archived by the owner on Jan 5, 2025. It is now read-only.

Commit

Permalink
delete src segment blobs when no longer used
Browse files Browse the repository at this point in the history
  • Loading branch information
dgllghr committed Jan 24, 2024
1 parent bcef12b commit fd4aa73
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/BlobManager.zig
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ pub fn open(self: *Self, id: i64) !Handle {
};
}

fn delete(self: *Self, tmp_arena: *ArenaAllocator, id: i64) !void {
pub fn delete(self: *Self, tmp_arena: *ArenaAllocator, id: i64) !void {
const stmt = try self.delete_stmt.acquire(tmp_arena, self);
defer self.delete_stmt.release();

Expand Down
10 changes: 9 additions & 1 deletion src/row_group/Creator.zig
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,15 @@ fn merge(
);
}

// TODO delete the segments from the source row group
// Delete the segments from the source row group since they are no longer being used
if (self.src_row_group_cursor.row_group.record_count > 0) {
const src_rowid_segment_id = self.src_row_group_cursor.row_group.rowid_segment_id;
try self.blob_manager.delete(tmp_arena, src_rowid_segment_id);
const src_col_segemnt_ids = self.src_row_group_cursor.row_group.column_segment_ids;
for (src_col_segemnt_ids) |seg_id| {
try self.blob_manager.delete(tmp_arena, seg_id);
}
}

// Delete the source row group entry
try self.row_group_index.deleteEntry(
Expand Down

0 comments on commit fd4aa73

Please sign in to comment.