Skip to content

Commit 086764b

Browse files
authored
vine: check if file exists on worker when access file_replica_table (#4060)
1 parent c1784df commit 086764b

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

taskvine/src/manager/vine_file_replica_table.c

+8
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,10 @@ See the file COPYING for details.
2424
// add a file to the remote file table.
2525
int vine_file_replica_table_insert(struct vine_manager *m, struct vine_worker_info *w, const char *cachename, struct vine_file_replica *replica)
2626
{
27+
if (hash_table_lookup(w->current_files, cachename)) {
28+
return 0;
29+
}
30+
2731
w->inuse_cache += replica->size;
2832
hash_table_insert(w->current_files, cachename, replica);
2933

@@ -47,6 +51,10 @@ int vine_file_replica_table_insert(struct vine_manager *m, struct vine_worker_in
4751
// remove a file from the remote file table.
4852
struct vine_file_replica *vine_file_replica_table_remove(struct vine_manager *m, struct vine_worker_info *w, const char *cachename)
4953
{
54+
if (!hash_table_lookup(w->current_files, cachename)) {
55+
return 0;
56+
}
57+
5058
struct vine_file_replica *replica = hash_table_remove(w->current_files, cachename);
5159
if (replica) {
5260
w->inuse_cache -= replica->size;

0 commit comments

Comments
 (0)