-
Notifications
You must be signed in to change notification settings - Fork 998
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
Conversation
Signed-off-by: Vladislav Oleshko <[email protected]>
e4141c7
to
c139bc8
Compare
Signed-off-by: Vladislav Oleshko <[email protected]>
1b030b6
to
30c170a
Compare
Signed-off-by: Vladislav <[email protected]>
Signed-off-by: Vladislav Oleshko <[email protected]>
src/server/common.cc
Outdated
@@ -190,6 +192,12 @@ bool ParseDouble(string_view src, double* value) { | |||
return true; | |||
} | |||
|
|||
void OpArgs::RecordJournal(string_view key, ArgSlice args) const { |
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.
key -> command_name
src/server/common.cc
Outdated
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)); |
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 records can be part of multi transaction and in this case we should use MULTI_COMMAND
Signed-off-by: Vladislav <[email protected]>
src/server/db_slice.cc
Outdated
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); |
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.
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]>
8070b9c
to
4e0ba46
Compare
Signed-off-by: Vladislav Oleshko <[email protected]>
3da1b84
to
4eeb6c8
Compare
Signed-off-by: Vladislav Oleshko <[email protected]>
} 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}); |
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.
where is the key in PEXPIREAT journal write?
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.
Damn 😓 I'll fix it in the next PR
No description provided.