Skip to content

Commit 2c8f80d

Browse files
JinZhou5042Jin Zhou
andauthored
vine: return count pruned in vine_prune_file (#4261)
Co-authored-by: Jin Zhou <[email protected]>
1 parent 8b5a4b8 commit 2c8f80d

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

taskvine/src/manager/taskvine.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -929,8 +929,9 @@ The given file or directory object is deleted from all worker's caches,
929929
but is still available on the manager's site, and can be recovered by submitting a recovery task.
930930
@param m A manager object
931931
@param f Any file object.
932+
@return The number of replicas pruned.
932933
*/
933-
void vine_prune_file(struct vine_manager *m, struct vine_file *f);
934+
int vine_prune_file(struct vine_manager *m, struct vine_file *f);
934935

935936
//@}
936937

taskvine/src/manager/vine_manager.c

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6438,16 +6438,18 @@ Should be invoked by the application when a file will never
64386438
be needed again, to free up available space.
64396439
*/
64406440

6441-
void vine_prune_file(struct vine_manager *m, struct vine_file *f)
6441+
int vine_prune_file(struct vine_manager *m, struct vine_file *f)
64426442
{
64436443
if (!f) {
6444-
return;
6444+
return 0;
64456445
}
64466446

64476447
if (!m) {
6448-
return;
6448+
return 0;
64496449
}
64506450

6451+
int pruned_replica_count = 0;
6452+
64516453
/* delete all of the replicas present at remote workers. */
64526454
struct set *source_workers = hash_table_lookup(m->file_worker_table, f->cached_name);
64536455
if (source_workers && set_size(source_workers) > 0) {
@@ -6456,13 +6458,16 @@ void vine_prune_file(struct vine_manager *m, struct vine_file *f)
64566458
for (int i = 0; workers_array[i] != NULL; i++) {
64576459
struct vine_worker_info *w = (struct vine_worker_info *)workers_array[i];
64586460
delete_worker_file(m, w, f->cached_name, 0, 0);
6461+
pruned_replica_count++;
64596462
}
64606463
set_free_values_array(workers_array);
64616464
}
64626465
}
64636466

64646467
/* also remove from the replication table. */
64656468
hash_table_remove(m->temp_files_to_replicate, f->cached_name);
6469+
6470+
return pruned_replica_count;
64666471
}
64676472

64686473
/*

0 commit comments

Comments
 (0)