mirror of https://github.com/schoebel/mars
marsadm: safeguard {create,join}-resource against old remains
This commit is contained in:
parent
3e92223e47
commit
58294defe5
|
@ -1591,6 +1591,20 @@ sub create_res {
|
|||
}
|
||||
}
|
||||
|
||||
# check for remains from former incidents
|
||||
foreach my $remain (glob("$resdir/{log,version}-*-$host")) {
|
||||
if (!$create) {
|
||||
$remain =~ m/-([0-9]+)-$host/;
|
||||
my $nr = $1;
|
||||
next if $nr < $replay_nr;
|
||||
}
|
||||
lwarn "Resource directory has some old remains like '$remain'.\n";
|
||||
lwarn "First cleanup.\n";
|
||||
my $extra_op = $create ? "delete-resource" : "log-purge-all";
|
||||
lwarn "If you really want to $cmd, run 'marsadm $extra_op' first.\n";
|
||||
ldie "REFUSING $cmd\n" unless $force;
|
||||
}
|
||||
|
||||
my $file = "$resdir/data-$host";
|
||||
if (!$dev) {
|
||||
lwarn "file '$file' already exists - reusing\n" if -l $file;
|
||||
|
|
Loading…
Reference in New Issue