mirror of
https://github.com/schoebel/mars
synced 2025-04-04 23:39:42 +00:00
main: try to self-repair damaged logfiles
This commit is contained in:
parent
9f321dd072
commit
acae344ccf
@ -1907,6 +1907,7 @@ int _update_file(struct mars_dent *parent, const char *switch_path, const char *
|
|||||||
const char *argv[2] = { tmp, file };
|
const char *argv[2] = { tmp, file };
|
||||||
struct copy_brick *copy = NULL;
|
struct copy_brick *copy = NULL;
|
||||||
struct key_value_pair *msg_pair = find_key(rot->msgs, "inf-fetch");
|
struct key_value_pair *msg_pair = find_key(rot->msgs, "inf-fetch");
|
||||||
|
loff_t start_pos;
|
||||||
bool do_start = true;
|
bool do_start = true;
|
||||||
int status = -ENOMEM;
|
int status = -ENOMEM;
|
||||||
|
|
||||||
@ -1953,7 +1954,16 @@ int _update_file(struct mars_dent *parent, const char *switch_path, const char *
|
|||||||
do_start = false;
|
do_start = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
MARS_DBG("src = '%s' dst = '%s' do_start=%d\n", tmp, file, do_start);
|
/* Self-correct logfile when necessary
|
||||||
|
*/
|
||||||
|
start_pos = -1;
|
||||||
|
if (do_start && (rot->is_log_damaged | rot->log_is_really_damaged)) {
|
||||||
|
start_pos = 0;
|
||||||
|
MARS_INF("Trying to repair damaged logfile '%s'\n", file);
|
||||||
|
}
|
||||||
|
|
||||||
|
MARS_DBG("src = '%s' dst = '%s' start_pos=%lld do_start=%d\n",
|
||||||
|
tmp, file, start_pos, do_start);
|
||||||
|
|
||||||
status = __make_copy(global,
|
status = __make_copy(global,
|
||||||
NULL,
|
NULL,
|
||||||
@ -1962,7 +1972,7 @@ int _update_file(struct mars_dent *parent, const char *switch_path, const char *
|
|||||||
NULL,
|
NULL,
|
||||||
argv,
|
argv,
|
||||||
msg_pair,
|
msg_pair,
|
||||||
-1,
|
start_pos,
|
||||||
-1,
|
-1,
|
||||||
false, false, false, true,
|
false, false, false, true,
|
||||||
©,
|
©,
|
||||||
|
Loading…
Reference in New Issue
Block a user