Skip to content

chore: improve partial sync and test #5195

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

Open
wants to merge 1 commit into
base: kpr2
Choose a base branch
from
Open

chore: improve partial sync and test #5195

wants to merge 1 commit into from

Conversation

kostasrim
Copy link
Contributor

@kostasrim kostasrim commented May 28, 2025

This pr replaces helio base/ring_buffer with boost/circular_buffer for simplicity and correctness.

  • replace base/ring_buffer with boost/circular_buffer
  • add partial sync tests

Addresses #5180

@kostasrim kostasrim self-assigned this May 28, 2025
return ring_buffer_.front().lsn == lsn;
}

return ring_buffer_.front().lsn <= lsn && lsn <= ring_buffer_.back().lsn;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So much cleaner now...l

// std::string shard_path_;
// std::unique_ptr<LinuxFile> shard_file_;
std::optional<base::RingBuffer<JournalItem>> ring_buffer_;
boost::circular_buffer<JournalItem> ring_buffer_;
Copy link
Contributor Author

@kostasrim kostasrim May 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bye bye std::optional and base::RingBuffer. Welcome boost::circular_buffer :)

return;

ring_buffer_.emplace(2);
ring_buffer_.set_capacity(absl::GetFlag(FLAGS_shard_repl_backlog_len));
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also works for non power of two now :)

Signed-off-by: kostas <kostas@dragonflydb.io>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant