Skip to content

Commit

Permalink
vine: check if file exists on worker when access file_replica_table (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
JinZhou5042 authored Feb 14, 2025
1 parent c1784df commit 086764b
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions taskvine/src/manager/vine_file_replica_table.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ See the file COPYING for details.
// add a file to the remote file table.
int vine_file_replica_table_insert(struct vine_manager *m, struct vine_worker_info *w, const char *cachename, struct vine_file_replica *replica)
{
if (hash_table_lookup(w->current_files, cachename)) {
return 0;
}

w->inuse_cache += replica->size;
hash_table_insert(w->current_files, cachename, replica);

Expand All @@ -47,6 +51,10 @@ int vine_file_replica_table_insert(struct vine_manager *m, struct vine_worker_in
// remove a file from the remote file table.
struct vine_file_replica *vine_file_replica_table_remove(struct vine_manager *m, struct vine_worker_info *w, const char *cachename)
{
if (!hash_table_lookup(w->current_files, cachename)) {
return 0;
}

struct vine_file_replica *replica = hash_table_remove(w->current_files, cachename);
if (replica) {
w->inuse_cache -= replica->size;
Expand Down

0 comments on commit 086764b

Please sign in to comment.