From 8d26f0250d2a8db6972f0869e8265eb322ea9cf8 Mon Sep 17 00:00:00 2001 From: Thomas Schoebel-Theuer Date: Sat, 9 Sep 2017 23:03:02 +0200 Subject: [PATCH 1/5] marsadm: continue work after leave-resource --- userspace/marsadm | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/userspace/marsadm b/userspace/marsadm index 7c2ebfee..83c2d261 100755 --- a/userspace/marsadm +++ b/userspace/marsadm @@ -2207,6 +2207,7 @@ sub leave_res_phase0 { sub leave_res_phase1 { my ($cmd, $res) = @_; + set_link("1", "$mars/resource-$res/work-$host"); _create_delete("$mars/resource-$res/replay-$host"); _create_delete("$mars/resource-$res/data-$host"); _create_delete("$mars/resource-$res/syncstatus-$host"); @@ -2258,6 +2259,7 @@ sub delete_res { next if $path =~ m:/(maxnr$|\.deleted-):; _create_delete($path); } + set_link("1", "$mars/resource-$res/work-$host"); finish_links(); _wait_delete(); } @@ -2407,7 +2409,7 @@ sub logdelete_res { my ($cmd, $res) = @_; lprint "removing left-over .deleted symlinks...\n" if $verbose; my $start_time = mars_time(); - foreach my $leftlink (glob("$mars/{,resource-$res/}{,*/}{.deleted,delete-}-*")) { + foreach my $leftlink (glob("$mars/{,resource-$res/}{,*/}{.deleted,delete,work}-*")) { my $stamp = get_link_stamp($leftlink); next unless $stamp + 3600 * 24 < $start_time; lprint " unlink '$leftlink'\n" if $verbose; From 9189a47afc0bdb0ef22ee97657e2869b24cbd440 Mon Sep 17 00:00:00 2001 From: Thomas Schoebel-Theuer Date: Sat, 23 Sep 2017 07:11:47 +0200 Subject: [PATCH 2/5] marsadm: cleanup internal backups after 1 week --- userspace/marsadm | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/userspace/marsadm b/userspace/marsadm index 83c2d261..149657df 100755 --- a/userspace/marsadm +++ b/userspace/marsadm @@ -2407,8 +2407,16 @@ sub delete_file_cmd { sub logdelete_res { my ($cmd, $res) = @_; - lprint "removing left-over .deleted symlinks...\n" if $verbose; + lprint "removing left-over data and symlinks...\n" if $verbose; my $start_time = mars_time(); + # keep internal backups for 1 week + my $keep_backups = 24 * 7; + foreach my $leftlink (glob("$mars/backup*")) { + my $stamp = get_link_stamp($leftlink); + next unless $stamp + 3600 * $keep_backups < $start_time; + lprint " unlink '$leftlink'\n" if $verbose; + system("rm -rf $leftlink"); + } foreach my $leftlink (glob("$mars/{,resource-$res/}{,*/}{.deleted,delete,work}-*")) { my $stamp = get_link_stamp($leftlink); next unless $stamp + 3600 * 24 < $start_time; From 947e7fe9e97cd9d9505bcf23a3a824628532dbba Mon Sep 17 00:00:00 2001 From: Thomas Schoebel-Theuer Date: Sat, 23 Sep 2017 07:18:45 +0200 Subject: [PATCH 3/5] marsadm: silence annoying error msg on empty resource list --- userspace/marsadm | 1 + 1 file changed, 1 insertion(+) diff --git a/userspace/marsadm b/userspace/marsadm index 149657df..fb3f448a 100755 --- a/userspace/marsadm +++ b/userspace/marsadm @@ -2169,6 +2169,7 @@ sub split_cluster { foreach my $peer (@peers) { print "--- peer $peer\n"; my $cmd = "rm -f $mars/todo-global/delete* $mars/actual-*/msg-*connection-*; "; + $cmd .= "shopt -s nullglob; "; $cmd .= "for i in $mars/resource-*; do if ! [[ -e \$i/data-$peer ]] && ! [[ -e \$i/replay-$peer ]]; then rm -rf $backup_dir/\${i##*/}; mv \$i $backup_dir/; fi; done; "; $cmd .= "mkdir -p $mars/ips; "; my $sub_list = "{ for i in \$(ls $mars/resource-*/data-$peer | cut -d/ -f1-3 | sort -u); do (cd \$i; ls data-*); done; echo x-$peer; }"; From a529b2f2cbcd9523924eae16bf43f6a979bb4ea3 Mon Sep 17 00:00:00 2001 From: Thomas Schoebel-Theuer Date: Wed, 5 Jul 2017 10:07:25 +0200 Subject: [PATCH 4/5] marsadm: show number of replicas --- userspace/marsadm | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/userspace/marsadm b/userspace/marsadm index fb3f448a..a3a82002 100755 --- a/userspace/marsadm +++ b/userspace/marsadm @@ -5739,12 +5739,18 @@ sub do_all_res { ldie "Cannot combine command '$cmd' with 'all' existing resources - you must explicitly name a single new resource\n" if $cmd =~ m/create|join/; my $any_success = 0; my $any_member = 0; + my @total_list = glob("$mars/ips/ip-*"); + my $total_count = scalar(@total_list); foreach $res (glob("$mars/resource-*")) { next unless -e "$res/data-$host"; $any_member++; $res =~ s/^.*\/resource-(.*)$/$1/; next if defined($skip_res{$res}); - lprint "--------- resource $res\n" if ($verbose || $cmd !~ m/^log-/); + if ($verbose || $cmd !~ m/^log-/) { + my @this_list = glob("$mars/resource-$res/data-*"); + my $this_count = scalar(@this_list); + lprint "--------- resource $res [$this_count/$total_count]\n" + } eval { do_one_res($func, $cmd, $res, @_); 1; From dea701d47c4e4b4626c83b36be47f86862111e61 Mon Sep 17 00:00:00 2001 From: Thomas Schoebel-Theuer Date: Sat, 23 Sep 2017 07:42:46 +0200 Subject: [PATCH 5/5] all: release mars0.1stable50 --- ChangeLog | 12 ++++++++++++ userspace/marsadm | 2 +- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index c1c25809..6ab25aa0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -147,6 +147,18 @@ Changelog for series 0.1a: ----------------------------------- Changelog for series 0.1: +mars0.1stable50 + * Major usability improvement (backport from 0.1a): + marsadm shows number of replicas of each resource, out of total number + of cluster members. Example: [2/4] + * Minor fix: automatically cleanup internal backups produced by the new + merge-cluster / split-cluster after 1 week. + * Minor fix: also cleanup some new symlink types replicated through + the network when running asymmetric clusters with mixed branches + 0.1 and 0.1a. + * Minor annoyance: silence split-cluster error message when no + resources are present. + mars0.1stable49 * Backports of new marsadm commands merge-cluster and split-cluster. The new functionality is needed for background migration of resources. diff --git a/userspace/marsadm b/userspace/marsadm index a3a82002..3d0c9392 100755 --- a/userspace/marsadm +++ b/userspace/marsadm @@ -98,7 +98,7 @@ sub lwarn { my $Id = '$Id$ '; my $user_version = 0.1; -my $marsadm_version = 1.1; # some rough hint at newer features +my $marsadm_version = 1.2; # some rough hint at newer features my $mars = "/mars"; my $host = `uname -n` or ldie "cannot determine my network node name\n"; chomp $host;