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

feat(server): Rewrite journal commands (basic) #651

Merged
merged 9 commits into from
Jan 16, 2023

Conversation

dranikpg
Copy link
Contributor

@dranikpg dranikpg commented Jan 7, 2023

No description provided.

src/server/command_registry.h Outdated Show resolved Hide resolved
src/server/dflycmd.cc Outdated Show resolved Hide resolved
src/server/generic_family.cc Outdated Show resolved Hide resolved
src/server/generic_family.cc Outdated Show resolved Hide resolved
@dranikpg dranikpg force-pushed the rewrite-expire-journal branch from e4141c7 to c139bc8 Compare January 7, 2023 21:13
Signed-off-by: Vladislav Oleshko <[email protected]>
@dranikpg dranikpg force-pushed the rewrite-expire-journal branch from 1b030b6 to 30c170a Compare January 8, 2023 17:30
@dranikpg dranikpg linked an issue Jan 10, 2023 that may be closed by this pull request
@dranikpg dranikpg requested a review from adiholden January 13, 2023 18:26
@@ -190,6 +192,12 @@ bool ParseDouble(string_view src, double* value) {
return true;
}

void OpArgs::RecordJournal(string_view key, ArgSlice args) const {
Copy link
Collaborator

Choose a reason for hiding this comment

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

key -> command_name

void OpArgs::RecordJournal(string_view key, ArgSlice args) const {
auto journal = shard->journal();
CHECK(journal);
journal->RecordEntry(txid, journal::Op::COMMAND, db_cntx.db_index, 1, make_pair(key, args));
Copy link
Collaborator

Choose a reason for hiding this comment

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

this records can be part of multi transaction and in this case we should use MULTI_COMMAND

if (auto journal = owner_->journal(); journal) {
string scratch;
auto payload = make_pair("DEL"sv, ArgSlice{it->first.GetSlice(&scratch)});
journal->RecordEntry(0, journal::Op::COMMAND, cntx.db_index, 1, payload);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Do you know to tell if this flow will not happen while executing multi command?
If it does, it will break the current impl in replica as if it gets multi command from journal it reads more multi commands till it gets exec. Replica assumes that there is no command op entry that was inserted before the exec op was reached

Signed-off-by: Vladislav Oleshko <[email protected]>
Signed-off-by: Vladislav Oleshko <[email protected]>
@dranikpg dranikpg force-pushed the rewrite-expire-journal branch from 8070b9c to 4e0ba46 Compare January 16, 2023 09:56
src/server/common.cc Outdated Show resolved Hide resolved
@dranikpg dranikpg requested a review from adiholden January 16, 2023 09:57
@dranikpg dranikpg marked this pull request as ready for review January 16, 2023 09:57
@dranikpg dranikpg changed the title feat(server): MVP rewrite + expire on journal feat(server): Rewrite journal commands (basic) Jan 16, 2023
@dranikpg dranikpg force-pushed the rewrite-expire-journal branch from 3da1b84 to 4eeb6c8 Compare January 16, 2023 10:09
Signed-off-by: Vladislav Oleshko <[email protected]>
@dranikpg dranikpg requested a review from adiholden January 16, 2023 10:51
@dranikpg dranikpg merged commit 1eb227e into dragonflydb:main Jan 16, 2023
} else {
auto time = absl::StrCat(res.value());
// Note: Don't forget to change this when adding arguments to expire commands.
op_args.RecordJournal("PEXPIREAT"sv, ArgSlice{time});
Copy link
Collaborator

Choose a reason for hiding this comment

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

where is the key in PEXPIREAT journal write?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Damn 😓 I'll fix it in the next PR

@dranikpg dranikpg deleted the rewrite-expire-journal branch February 27, 2023 16:39
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