Skip to content
Snippets Groups Projects
Commit cd17b77f authored by Vladimir Davydov's avatar Vladimir Davydov Committed by Roman Tsisyk
Browse files

replication: fix insane lag after reconnect

Applier must not update the replication lag upon receiving a packet
containing an error, because those packets don't have timestamps.

Closes #2965
parent 487555e0
No related branches found
No related tags found
No related merge requests found
......@@ -421,8 +421,6 @@ applier_subscribe(struct applier *applier)
}
coio_read_xrow(coio, &iobuf->in, &row);
applier->lag = ev_now(loop()) - row.tm;
applier->last_row_time = ev_monotonic_now(loop());
if (iproto_type_is_error(row.type))
xrow_decode_error_xc(&row); /* error */
......@@ -437,6 +435,10 @@ applier_subscribe(struct applier *applier)
int2str(row.replica_id),
tt_uuid_str(&REPLICASET_UUID));
}
applier->lag = ev_now(loop()) - row.tm;
applier->last_row_time = ev_monotonic_now(loop());
if (vclock_get(&replicaset_vclock, row.replica_id) < row.lsn) {
/**
* Promote the replica set vclock before
......
......@@ -235,6 +235,10 @@ box.info.replication[1].upstream.status
---
- follow
...
box.info.replication[1].upstream.lag
---
- 0
...
-- wait for ack timeout
while box.info.replication[1].upstream.message ~= 'timed out' do fiber.sleep(0.0001) end
---
......
......@@ -102,6 +102,7 @@ test_run:cmd("switch replica")
-- wait for reconnect
while box.info.replication[1].upstream.status ~= 'follow' do fiber.sleep(0.0001) end
box.info.replication[1].upstream.status
box.info.replication[1].upstream.lag
-- wait for ack timeout
while box.info.replication[1].upstream.message ~= 'timed out' do fiber.sleep(0.0001) end
......
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