mirror of
https://github.com/schoebel/mars
synced 2025-04-01 22:58:34 +00:00
marsadm: avoid old rsync method at join-resource
This commit is contained in:
parent
aecccd547c
commit
2180337e85
@ -3668,22 +3668,37 @@ sub create_res {
|
||||
# For safety, try to get the very newest infos.
|
||||
# Reason: newer kernel modules will fetch non-member resource infos less frequently.
|
||||
# Therefore we shift some responsibility for non-member -> member transitions to userspace.
|
||||
my @peers = map { m:^$mars/ips/ip-(.+):; $1 } lamport_glob("$mars/ips/ip-*");
|
||||
for (my $retry = 0; $retry < 3; $retry++) {
|
||||
$primary = _get_designated_primary($res, 1);
|
||||
last if (defined($primary) && $primary);
|
||||
lprint "Trying to get primary info\n";
|
||||
wait_cluster($cmd, $res, "*", 0, 8);
|
||||
}
|
||||
my $max_retry = 5;
|
||||
for (;;) {
|
||||
if ($primary && $primary ne "(none)") {
|
||||
$max_retry--;
|
||||
$primary = _get_designated_primary($res, 1);
|
||||
if ($primary && $primary ne $host && $primary ne "(none)") {
|
||||
# first check whether symlink information appears to be recent enough
|
||||
last if recent_cluster($cmd, $res, $primary);
|
||||
# for safety, fetch newest infos from last known primary
|
||||
if ($max_retry >= 3) {
|
||||
lprint "Trying update-cluster from '$primary'\n";
|
||||
update_cluster($cmd, $res, $primary);
|
||||
next;
|
||||
} elsif ($max_retry >= 1) {
|
||||
lprint "Trying full update-cluster\n";
|
||||
update_cluster($cmd, $res);
|
||||
next;
|
||||
}
|
||||
$use_rsync++;
|
||||
rsync_cmd($primary, "--max-size=1 --update $primary:$mars/resource-$res/ $mars/resource-$res/", $res, 1);
|
||||
last;
|
||||
next;
|
||||
}
|
||||
lprint "Using update-cluster for primary determination\n";
|
||||
update_cluster($cmd, $res);
|
||||
next if $max_retry > 2;
|
||||
my @peers = map { m:^$mars/ips/ip-(.+):; $1 } lamport_glob("$mars/ips/ip-*");
|
||||
if (!@peers || $max_retry < 0) {
|
||||
lwarn "cannot get a relevant primary\n";
|
||||
last;
|
||||
@ -3694,8 +3709,6 @@ sub create_res {
|
||||
next if $peer eq $real_host;
|
||||
$use_rsync++;
|
||||
rsync_cmd($peer, "--max-size=1 --update $peer:$mars/resource-$res $mars/", 1);
|
||||
$primary = _get_designated_primary($res, 1);
|
||||
$max_retry--;
|
||||
} # retry loop
|
||||
ldie "resource '$res' does not exist\n" unless -d $resdir;
|
||||
ldie "resource '$res' has no designated primary\n" unless $primary && $primary ne "(none)";
|
||||
|
Loading…
Reference in New Issue
Block a user