Skip to content
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

refactor(server): Refactor replica #472

Merged
merged 2 commits into from
Nov 9, 2022

Conversation

dranikpg
Copy link
Contributor

@dranikpg dranikpg commented Nov 8, 2022

Migrating replication branch on main, part 5

The replica became an manageable 1k LOC mess 🤯 Time to fix technical debt 🔧 🔨

Mixed implementation:

  • Cleaned up and re-ordered header
  • Added more comments everywhere
  • Added helper functions for common scenarios
  • Did some planning ahead for replication branch features (more code re-use!!)

Signed-off-by: Vladislav Oleshko <[email protected]>
src/server/replica.h Show resolved Hide resolved
src/server/replica.cc Show resolved Hide resolved
src/server/replica.cc Show resolved Hide resolved
Comment on lines +539 to +541
std::unique_ptr<base::IoBuf> io_buf{new base::IoBuf(128)};
unsigned consumed = 0;
RETURN_ON_ERR(ReadRespReply(io_buf.get(), &consumed)); // uses parser_
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't really like the whole we-are-throwing-bytes-around-manually vibe. A parsed response with RAII semantics (drop or re-assign) would be really handy... But its likely over-engineering

Copy link
Collaborator

Choose a reason for hiding this comment

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

the moment you get me a PoC with "set" only replication that includes full-sync and the journal - you do whatever refactorings you want plus 👸🏼 to marry plus half 👑 .

Copy link
Contributor Author

@dranikpg dranikpg Nov 8, 2022

Choose a reason for hiding this comment

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

The PoC is in the replication branch 😎 I'll do the refactoring sometime later. Its just the more hard code we have, the more efforts we need in the future to fix it all

Copy link
Collaborator

@romange romange left a comment

Choose a reason for hiding this comment

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

LGTM

@dranikpg dranikpg marked this pull request as ready for review November 8, 2022 21:21
@dranikpg
Copy link
Contributor Author

dranikpg commented Nov 8, 2022

Lets keep it like now if everything is fine

@dranikpg dranikpg requested a review from romange November 8, 2022 21:26
@dranikpg dranikpg merged commit a314b1b into dragonflydb:main Nov 9, 2022
@dranikpg dranikpg deleted the refactor-replica branch December 25, 2022 12:01
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.

2 participants