Skip to content
Snippets Groups Projects
Commit c7185149 authored by Yuriy Vostrikov's avatar Yuriy Vostrikov
Browse files

[box] now replica reports its lag

parent 706ef774
No related branches found
No related tags found
No related merge requests found
......@@ -1177,6 +1177,9 @@ write_to_disk(void *_state, struct tbuf *t)
u32 result = 0;
int suffix = 0;
/* we're not running inside ev_loop, so update ev_now manually */
ev_now_update();
/* caller requested termination */
if (t == NULL) {
if (wal != NULL)
......
......@@ -129,6 +129,7 @@ pull_from_remote(void *state)
for (;;) {
row = remote_read_row(h->r->confirmed_lsn + 1);
h->r->recovery_lag = ev_now() - row_v11(row)->tm;
h->r->recovery_last_update_tstamp = ev_now();
if (h->handler(h->r, row) < 0)
continue;
......
......@@ -84,7 +84,7 @@ struct recovery_state {
log_io_class->reader is responsible of converting data from old format */
row_handler *wal_row_handler, *snap_row_handler;
ev_timer wal_timer;
ev_tstamp recovery_lag;
ev_tstamp recovery_lag, recovery_last_update_tstamp;
int snap_io_rate_limit;
......
......@@ -1886,6 +1886,8 @@ mod_info(struct tbuf *out)
tbuf_printf(out, " pid: %i\r\n", getpid());
tbuf_printf(out, " wal_writer_pid: %" PRIi64 "\r\n", (i64)recovery_state->wal_writer->pid);
tbuf_printf(out, " lsn: %" PRIi64 "\r\n", recovery_state->confirmed_lsn);
tbuf_printf(out, " recovery_lag: %.3f\r\n", recovery_state->recovery_lag);
tbuf_printf(out, " recovery_last_update: %.3f\r\n", recovery_state->recovery_last_update_tstamp);
tbuf_printf(out, " status: %s\r\n", status);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment