mirror of https://github.com/schoebel/mars
marsadm: wait for deletions after leave-resource
This commit is contained in:
parent
0ad20e54c8
commit
561bf67a55
|
@ -1027,6 +1027,13 @@ sub leave_res_phase1 {
|
|||
_create_delete($dir);
|
||||
}
|
||||
cleanup_res($cmd, $res, 0);
|
||||
finish_links();
|
||||
}
|
||||
|
||||
# wait for deletions (avoid races with following commands)
|
||||
sub leave_res_phase2 {
|
||||
my ($cmd, $res) = @_;
|
||||
_wait_delete();
|
||||
}
|
||||
|
||||
sub logrotate_res {
|
||||
|
@ -1096,6 +1103,15 @@ sub _create_delete {
|
|||
set_link($target, $new);
|
||||
}
|
||||
|
||||
sub _wait_delete {
|
||||
for (;;) {
|
||||
my $deleted = get_link("$mars/todo-global/deleted-$host");
|
||||
last if $deleted >= $delete_nr;
|
||||
lprint "waiting for deletions to apply locally....\n";
|
||||
sleep_timeout();
|
||||
}
|
||||
}
|
||||
|
||||
sub delete_file_cmd {
|
||||
my $cmd = shift;
|
||||
foreach my $path (@_) {
|
||||
|
@ -1611,6 +1627,7 @@ my %cmd_table =
|
|||
"leave-resource" => [
|
||||
"check preconditions", \&leave_res_phase0,
|
||||
"switch state", \&leave_res_phase1,
|
||||
"wait for deletions", \&leave_res_phase2,
|
||||
],
|
||||
"log-rotate" => \&logrotate_res,
|
||||
"log-delete" => \&logdelete_res,
|
||||
|
|
Loading…
Reference in New Issue