light: fix annoying replay error message

This commit is contained in:
Thomas Schoebel-Theuer 2014-03-26 10:52:12 +01:00 committed by Thomas Schoebel-Theuer
parent 9ebea0cb8a
commit fcf4863503
2 changed files with 15 additions and 7 deletions

View File

@ -2829,6 +2829,7 @@ void trans_logger_replay(struct trans_logger_brick *brick)
struct log_header lh = {};
loff_t start_pos;
loff_t finished_pos = -1;
loff_t new_finished_pos = -1;
long long old_jiffies = jiffies;
int nr_flying;
int backoff = 0;
@ -2837,6 +2838,7 @@ void trans_logger_replay(struct trans_logger_brick *brick)
brick->replay_code = 0; // indicates "running"
start_pos = brick->replay_start_pos;
brick->replay_current_pos = start_pos;
_init_input(input, start_pos);
@ -2851,7 +2853,6 @@ void trans_logger_replay(struct trans_logger_brick *brick)
mars_power_led_on((void*)brick, true);
for (;;) {
loff_t new_finished_pos;
void *buf = NULL;
int len = 0;
@ -2964,7 +2965,13 @@ void trans_logger_replay(struct trans_logger_brick *brick)
MARS_INF("TOLERANCE: logfile is incomplete at %lld (of %lld)\n", finished_pos, brick->replay_end_pos);
brick->replay_code = 2;
} else if (status < 0) {
MARS_ERR("replay error %d at %lld (of %lld)\n", status, finished_pos, brick->replay_end_pos);
if (finished_pos < 0)
finished_pos = new_finished_pos;
if (finished_pos + brick->replay_tolerance > brick->replay_end_pos) {
MARS_INF("TOLERANCE: logfile is incomplete at %lld (of %lld), status = %d\n", finished_pos, brick->replay_end_pos, status);
} else {
MARS_ERR("replay error %d at %lld (of %lld)\n", status, finished_pos, brick->replay_end_pos);
}
brick->replay_code = status;
} else {
MARS_INF("replay stopped prematurely at %lld (of %lld)\n", finished_pos, brick->replay_end_pos);

View File

@ -3493,12 +3493,13 @@ int make_log_finalize(struct mars_global *global, struct mars_dent *dent)
if (trans_brick->replay_mode) {
if (trans_brick->replay_code > 0) {
MARS_INF_TO(rot->log_say, "logfile replay ended successfully\n");
} else if (trans_brick->replay_code == -EAGAIN) {
MARS_INF_TO(rot->log_say, "logfile replay stopped intermediately\n");
MARS_INF_TO(rot->log_say, "logfile replay ended successfully at position %lld\n", trans_brick->replay_current_pos);
} else if (trans_brick->replay_code == -EAGAIN ||
trans_brick->replay_end_pos - trans_brick->replay_current_pos < trans_brick->replay_tolerance) {
MARS_INF_TO(rot->log_say, "logfile replay stopped intermediately at position %lld\n", trans_brick->replay_current_pos);
} else if (trans_brick->replay_code < 0) {
MARS_ERR_TO(rot->log_say, "logfile replay stopped with error = %d\n", trans_brick->replay_code);
make_rot_msg(rot, "err-replay-stop", "logfile replay stopped with error = %d", trans_brick->replay_code);
MARS_ERR_TO(rot->log_say, "logfile replay stopped with error = %d at position %lld\n", trans_brick->replay_code, trans_brick->replay_current_pos);
make_rot_msg(rot, "err-replay-stop", "logfile replay stopped with error = %d at position %lld", trans_brick->replay_code, trans_brick->replay_current_pos);
}
}