Skip to content

Commit

Permalink
Don't retain when traverse base commit
Browse files Browse the repository at this point in the history
  • Loading branch information
杨赫然 committed Jan 10, 2025
1 parent bc697b0 commit bc24894
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions server/gc/gc-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,8 @@ typedef struct {
SeafDBTrans *trans;
gint64 keep_alive_last_time;
gint64 keep_alive_obj_counter;

gboolean traverse_base_commit;
} GCData;

static int
Expand Down Expand Up @@ -166,6 +168,12 @@ fs_callback (SeafFSManager *mgr,

add_fs_to_index(data, obj_id);

// If traversing the base_commit, only the fs objects need to be retained, while the block does not.
// This is because only the fs objects are needed when merging virtual repo.
if (data->repo->is_virtual && data->traverse_base_commit) {
return TRUE;
}

if (type == SEAF_METADATA_TYPE_FILE &&
add_blocks_to_index (mgr, data, obj_id) < 0)
return FALSE;
Expand Down Expand Up @@ -422,6 +430,7 @@ populate_gc_index_for_repo (GCData *data, SeafDBTrans *trans)
if (!vinfo) {
continue;
}
data->traverse_base_commit = TRUE;
res = seaf_commit_manager_traverse_commit_tree (seaf->commit_mgr,
repo->store_id, repo->version,
vinfo->base_commit,
Expand Down

0 comments on commit bc24894

Please sign in to comment.