mirror of
https://github.com/dragonflydb/dragonfly.git
synced 2025-05-11 18:35:46 +02:00
bug server: fix lns mismatch in replication
Signed-off-by: adi_holden <adi@dragonflydb.io>
This commit is contained in:
parent
7402730f71
commit
2e12d1f3d5
2 changed files with 5 additions and 9 deletions
|
@ -57,14 +57,6 @@ void JournalStreamer::Start(util::FiberSocketBase* dest, bool send_lsn) {
|
|||
dest_ = dest;
|
||||
journal_cb_id_ =
|
||||
journal_->RegisterOnChange([this, send_lsn](const JournalItem& item, bool allow_await) {
|
||||
if (allow_await) {
|
||||
ThrottleIfNeeded();
|
||||
// No record to write, just await if data was written so consumer will read the data.
|
||||
// TODO: shouldnt we trigger async write in noop??
|
||||
if (item.opcode == Op::NOOP)
|
||||
return;
|
||||
}
|
||||
|
||||
if (!ShouldWrite(item)) {
|
||||
return;
|
||||
}
|
||||
|
@ -81,6 +73,10 @@ void JournalStreamer::Start(util::FiberSocketBase* dest, bool send_lsn) {
|
|||
writer.Write(Entry{journal::Op::LSN, item.lsn});
|
||||
Write(std::move(sink).str());
|
||||
}
|
||||
|
||||
if (allow_await) {
|
||||
ThrottleIfNeeded();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -48,7 +48,7 @@ class JournalStreamer {
|
|||
void ThrottleIfNeeded();
|
||||
|
||||
virtual bool ShouldWrite(const journal::JournalItem& item) const {
|
||||
return cntx_->IsRunning();
|
||||
return cntx_->IsRunning() && item.opcode != journal::Op::NOOP;
|
||||
}
|
||||
|
||||
void WaitForInflightToComplete();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue