mirror of https://github.com/schoebel/mars
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)) {
|
||||
char *skip_path = path_make("%s/skip-check-%s", rot->parent_path, my_id());
|
||||
char *skip_link = mars_readlink(skip_path);
|
||||
char *msg = "";
|
||||
int skip_nr = -1;
|
||||
int nr_char = 0;
|
||||
if (skip_link) {
|
||||
(void)sscanf(skip_link, "%d", &skip_nr);
|
||||
brick_string_free(skip_link);
|
||||
(void)sscanf(skip_link, "%d%n", &skip_nr, &nr_char);
|
||||
msg = skip_link + nr_char;
|
||||
}
|
||||
brick_string_free(skip_path);
|
||||
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;
|
||||
}
|
||||
MARS_WRN_TO(rot->log_say,
|
||||
"you explicitly requested to SKIP sequence numbers from %d to %d"
|
||||
"-- THIS IS EXTREMELY RISKY"
|
||||
"-- any inconsistencies are on your own!\n",
|
||||
rot->inf_prev_sequence, inf->inf_sequence);
|
||||
"you explicitly requested to SKIP sequence numbers from %d to %d%s\n",
|
||||
rot->inf_prev_sequence, inf->inf_sequence, msg);
|
||||
brick_string_free(skip_link);
|
||||
}
|
||||
prev = path_make("%s/version-%09d-%s", rot->parent_path, inf->inf_sequence - 1, my_id());
|
||||
if (unlikely(!prev)) {
|
||||
|
|
|
@ -691,7 +691,8 @@ sub _fake_versionlink {
|
|||
}
|
||||
|
||||
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)");
|
||||
my $rep_path = "$basedir/replay-$host";
|
||||
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("$log_nr", "$basedir/skip-check-$host");
|
||||
set_link("$log_nr$msg", "$basedir/skip-check-$host");
|
||||
}
|
||||
|
||||
##################################################################
|
||||
|
@ -958,7 +959,7 @@ sub create_res {
|
|||
finish_links();
|
||||
lprint "successfully created resource '$res'\n";
|
||||
} else {
|
||||
_set_replaylink($resdir, $replay_nr, $primary);
|
||||
_set_replaylink($resdir, $replay_nr, $primary, "");
|
||||
set_link("0", "$resdir/syncstatus-$host");
|
||||
finish_links();
|
||||
lprint "successfully joined resource '$res'\n";
|
||||
|
@ -1392,7 +1393,7 @@ sub invalidate_res_phase3 {
|
|||
my $replay_nr = $1;
|
||||
set_link("0", $dst);
|
||||
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/sync", 1);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue