mirror of
https://github.com/schoebel/mars
synced 2024-12-11 09:15:48 +00:00
light: create detailed warn message in userspace
This commit is contained in:
parent
6755b8e4b8
commit
7ad628a725
@ -876,10 +876,12 @@ int _update_version_link(struct mars_rotate *rot, struct trans_logger_info *inf)
|
|||||||
rot->inf_prev_sequence != 0)) {
|
rot->inf_prev_sequence != 0)) {
|
||||||
char *skip_path = path_make("%s/skip-check-%s", rot->parent_path, my_id());
|
char *skip_path = path_make("%s/skip-check-%s", rot->parent_path, my_id());
|
||||||
char *skip_link = mars_readlink(skip_path);
|
char *skip_link = mars_readlink(skip_path);
|
||||||
|
char *msg = "";
|
||||||
int skip_nr = -1;
|
int skip_nr = -1;
|
||||||
|
int nr_char = 0;
|
||||||
if (skip_link) {
|
if (skip_link) {
|
||||||
(void)sscanf(skip_link, "%d", &skip_nr);
|
(void)sscanf(skip_link, "%d%n", &skip_nr, &nr_char);
|
||||||
brick_string_free(skip_link);
|
msg = skip_link + nr_char;
|
||||||
}
|
}
|
||||||
brick_string_free(skip_path);
|
brick_string_free(skip_path);
|
||||||
if (likely(skip_nr != inf->inf_sequence)) {
|
if (likely(skip_nr != inf->inf_sequence)) {
|
||||||
@ -887,10 +889,9 @@ int _update_version_link(struct mars_rotate *rot, struct trans_logger_info *inf)
|
|||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
MARS_WRN_TO(rot->log_say,
|
MARS_WRN_TO(rot->log_say,
|
||||||
"you explicitly requested to SKIP sequence numbers from %d to %d"
|
"you explicitly requested to SKIP sequence numbers from %d to %d%s\n",
|
||||||
"-- THIS IS EXTREMELY RISKY"
|
rot->inf_prev_sequence, inf->inf_sequence, msg);
|
||||||
"-- any inconsistencies are on your own!\n",
|
brick_string_free(skip_link);
|
||||||
rot->inf_prev_sequence, inf->inf_sequence);
|
|
||||||
}
|
}
|
||||||
prev = path_make("%s/version-%09d-%s", rot->parent_path, inf->inf_sequence - 1, my_id());
|
prev = path_make("%s/version-%09d-%s", rot->parent_path, inf->inf_sequence - 1, my_id());
|
||||||
if (unlikely(!prev)) {
|
if (unlikely(!prev)) {
|
||||||
|
@ -691,7 +691,8 @@ sub _fake_versionlink {
|
|||||||
}
|
}
|
||||||
|
|
||||||
sub _set_replaylink {
|
sub _set_replaylink {
|
||||||
my ($basedir, $log_nr, $primary) = @_;
|
my ($basedir, $log_nr, $primary, $msg) = @_;
|
||||||
|
$msg = " -- THIS IS EXTREMELY RISKY -- any inconsistencies are on your own!" unless defined($msg);
|
||||||
ldie "no designated primary defined\n" unless ($primary && $primary ne "(none)");
|
ldie "no designated primary defined\n" unless ($primary && $primary ne "(none)");
|
||||||
my $rep_path = "$basedir/replay-$host";
|
my $rep_path = "$basedir/replay-$host";
|
||||||
my $rep_val = sprintf("log-%09d-$primary,0,0", $log_nr);
|
my $rep_val = sprintf("log-%09d-$primary,0,0", $log_nr);
|
||||||
@ -709,7 +710,7 @@ sub _set_replaylink {
|
|||||||
}
|
}
|
||||||
set_link($initial, "$basedir/version-000000001-$host");
|
set_link($initial, "$basedir/version-000000001-$host");
|
||||||
}
|
}
|
||||||
set_link("$log_nr", "$basedir/skip-check-$host");
|
set_link("$log_nr$msg", "$basedir/skip-check-$host");
|
||||||
}
|
}
|
||||||
|
|
||||||
##################################################################
|
##################################################################
|
||||||
@ -958,7 +959,7 @@ sub create_res {
|
|||||||
finish_links();
|
finish_links();
|
||||||
lprint "successfully created resource '$res'\n";
|
lprint "successfully created resource '$res'\n";
|
||||||
} else {
|
} else {
|
||||||
_set_replaylink($resdir, $replay_nr, $primary);
|
_set_replaylink($resdir, $replay_nr, $primary, "");
|
||||||
set_link("0", "$resdir/syncstatus-$host");
|
set_link("0", "$resdir/syncstatus-$host");
|
||||||
finish_links();
|
finish_links();
|
||||||
lprint "successfully joined resource '$res'\n";
|
lprint "successfully joined resource '$res'\n";
|
||||||
@ -1392,7 +1393,7 @@ sub invalidate_res_phase3 {
|
|||||||
my $replay_nr = $1;
|
my $replay_nr = $1;
|
||||||
set_link("0", $dst);
|
set_link("0", $dst);
|
||||||
finish_links(); # opportunity for errors => don't continue
|
finish_links(); # opportunity for errors => don't continue
|
||||||
_set_replaylink("$mars/resource-$res", $replay_nr, $primary);
|
_set_replaylink("$mars/resource-$res", $replay_nr, $primary, "");
|
||||||
_switch($cmd, $res, "$mars/resource-$res/todo-$host/allow-replay", 1);
|
_switch($cmd, $res, "$mars/resource-$res/todo-$host/allow-replay", 1);
|
||||||
_switch($cmd, $res, "$mars/resource-$res/todo-$host/sync", 1);
|
_switch($cmd, $res, "$mars/resource-$res/todo-$host/sync", 1);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user