-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: replication error message and scan command yield #4665
Conversation
src/server/generic_family.cc
Outdated
journal::JournalFlushGuard journal_flush_guard(op_args.shard->journal()); | ||
cur = prime_table->Traverse( | ||
cur, [&](PrimeIterator it) { cnt += ScanCb(op_args, it, scan_opts, vec); }); | ||
break; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be fine. We can still over spin a little bit, because the called of OpScan
does not return unless:
677 // Break after kMaxScanTimeMs.
678 uint64_t time_now_ms = GetCurrentTimeMs();
679 if (time_now_ms > db_cntx.time_now_ms + kMaxScanTimeMs) {
680 break;
681 }
or when the limit is reached. Basically, our worse latency is now the timeout (as opposed to OpScan
potentially iterate the whole db table which would be unbounded time depending on the shard size)
src/server/generic_family.cc
Outdated
journal::JournalFlushGuard journal_flush_guard(op_args.shard->journal()); | ||
cur = prime_table->Traverse( | ||
cur, [&](PrimeIterator it) { cnt += ScanCb(op_args, it, scan_opts, vec); }); | ||
break; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe this can be inside the while condition
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are right. I did not want to make the expression big so I opted in for an if statement 🤷
One sec will address this.
I accidentally changed the error message in 8512f72#diff-8174e8eae32841a10b583a676b1b8ec068e7b3f2aa3cf61d2e952553ab343875R96
Furthermore, I never pushed the commit with the early return from the suggestion in https://github.com/dragonflydb/dragonfly/pull/4624/files#diff-f8f9387edb04c03ce7333ad3b69778d7b379fcf8c8765543f62b34d883e187c5R629