8000 vine: do not remove items when iterating hash_table by JinZhou5042 · Pull Request #4142 · cooperative-computing-lab/cctools · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

vine: do not remove items when iterating hash_table #4142

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions taskvine/src/manager/vine_manager.c
Original file line number Diff line number Diff line change
Expand Up @@ -977,6 +977,8 @@ static int consider_tempfile_replications(struct vine_manager *q)
int iter_control;
int iter_count_var;

struct list *to_remove = list_create();

HASH_TABLE_ITERATE_FROM_KEY(q->temp_files_to_replicate, iter_control, iter_count_var, key_start, cached_name, empty_val)
{
struct vine_file *f = hash_table_lookup(q->file_table, cached_name);
Expand All @@ -993,7 +995,7 @@ static int consider_tempfile_replications(struct vine_manager *q)
if (q->transfer_temps_recovery) {
vine_manager_consider_recovery_task(q, f, f->recovery_task);
}
hash_table_remove(q->temp_files_to_replicate, f->cached_name);
list_push_tail(to_remove, xxstrdup(f->cached_name));
continue;
}

Expand All @@ -1015,7 +1017,7 @@ static int consider_tempfile_replications(struct vine_manager *q)
int nsources = set_size(sources);
int to_find = MIN(q->temp_replica_count - nsources, q->transfer_replica_per_cycle);
if (to_find <= 0) {
hash_table_remove(q->temp_files_to_replicate, f->cached_name);
list_push_tail(to_remove, xxstrdup(f->cached_name));
continue;
}

Expand All @@ -1029,6 +1031,11 @@ static int consider_tempfile_replications(struct vine_manager *q)
}
}

while ((cached_name = list_pop_head(to_remove))) {
hash_table_remove(q->temp_files_to_replicate, cached_name);
free(cached_name);
}

return total_replication_request_sent;
}

Expand Down
0