-
Notifications
You must be signed in to change notification settings - Fork 1.2k
feat(server): Journal omits #7060
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
base: main
Are you sure you want to change the base?
Changes from 2 commits
c34beea
ffbdbf5
893982f
9fd7429
57ce44e
99c0270
4455856
056e6e1
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -47,8 +47,8 @@ error_code Close() { | |
| return {}; | ||
| } | ||
|
|
||
| bool HasRegisteredCallbacks() { | ||
| return journal_slice.HasRegisteredCallbacks(); | ||
| unsigned CallbackNumber() { | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. CallbackNumber is not a great name. |
||
| return journal_slice.OnChangeCbCount(); | ||
| } | ||
|
|
||
| bool IsLSNInBuffer(LSN lsn) { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -112,6 +112,7 @@ class SetCmd { | |
|
|
||
| const OpArgs op_args_; | ||
| bool explicit_journal_; // call RecordJournal (auto journaling disabled) | ||
| bool skip_journal_ = false; | ||
| }; | ||
|
|
||
| size_t SetRangeInternal(std::string* value, size_t start, std::string_view range) { | ||
|
|
@@ -836,10 +837,15 @@ OpStatus SetCmd::Set(const SetParams& params, string_view key, string_view value | |
| } | ||
| } | ||
|
|
||
| DbSlice::MutationHints hints{.hint{.single_key = true, .support_omit = explicit_journal_}}; | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. can we do it more elegantly?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I agree, let's move it to existing structures |
||
| db_slice.ProvideHints(&hints); | ||
|
|
||
| // We can use std::nullopt here because SET command can change the key type to string | ||
| auto op_res = db_slice.AddOrFind(op_args_.db_cntx, key, std::nullopt); | ||
| RETURN_ON_BAD_STATUS(op_res); | ||
|
|
||
| skip_journal_ = hints.result.omit_journal; | ||
|
|
||
| if (!op_res->is_new) { | ||
| if (auto status = CachePrevIfNeeded(params, op_res->it); status != OpStatus::OK) | ||
| return status; | ||
|
|
@@ -940,6 +946,9 @@ void SetCmd::PostEdit(const SetParams& params, std::string_view key, std::string | |
| } | ||
|
|
||
| void SetCmd::RecordJournal(const SetParams& params, string_view key, string_view value) { | ||
| if (skip_journal_) | ||
| return; | ||
|
|
||
| absl::InlinedVector<string_view, 5> cmds({key, value}); // 5 is theoretical maximum; | ||
|
|
||
| std::string exp_str; | ||
|
|
||
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.
what is the size of
MutationHints? why do you need to pass by pointer and not by value?looks fragile
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.
Because it is also used to get output variables