-
Notifications
You must be signed in to change notification settings - Fork 1k
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): Update helio, optimize and clean up rdb/snapshot #625
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Submodule helio
updated
10 files
+1 −1 | base/CMakeLists.txt | |
+64 −0 | base/io_buf.cc | |
+49 −61 | base/io_buf.h | |
+5 −0 | cmake/third_party.cmake | |
+34 −13 | io/io.cc | |
+45 −4 | io/io.h | |
+27 −33 | io/io_test.cc | |
+29 −0 | util/fibers/fibers_ext.cc | |
+19 −0 | util/fibers/fibers_ext.h | |
+19 −1 | util/fibers/fibers_ext_test.cc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,27 +22,27 @@ struct Entry; | |
|
||
class RdbSerializer; | ||
|
||
//┌────────────────┐ ┌─────────────┐ | ||
//│IterateBucketsFb│ │ OnDbChange │ | ||
//└──────┬─────────┘ └─┬───────────┘ | ||
// │ │ OnDbChange forces whole bucket to be | ||
// ▼ ▼ serialized if iterate didn't reach it yet | ||
//┌──────────────────────────┐ | ||
//│ SerializeBucket │ Both might fall back to a temporary serializer | ||
//└────────────┬─────────────┘ if default is used on another db index | ||
// │ | ||
// | Channel is left open in journal streaming mode | ||
// ▼ | ||
//┌──────────────────────────┐ ┌─────────────────────────┐ | ||
//│ SerializeEntry │ ◄────────┤ OnJournalEntry │ | ||
//└─────────────┬────────────┘ └─────────────────────────┘ | ||
// ┌────────────────┐ ┌─────────────┐ | ||
// │IterateBucketsFb│ │ OnDbChange │ | ||
// └──────┬─────────┘ └─┬───────────┘ | ||
// │ │ OnDbChange forces whole bucket to be | ||
// ▼ ▼ serialized if iterate didn't reach it yet | ||
// ┌──────────────────────────┐ | ||
// │ SerializeBucket │ Both might fall back to a temporary serializer | ||
// └────────────┬─────────────┘ if default is used on another db index | ||
// │ | ||
// PushFileToChannel Default buffer gets flushed on iteration, | ||
// │ temporary on destruction | ||
// | Channel is left open in journal streaming mode | ||
// ▼ | ||
//┌──────────────────────────────┐ | ||
//│ dest->Push(buffer) │ | ||
//└──────────────────────────────┘ | ||
// ┌──────────────────────────┐ ┌─────────────────────────┐ | ||
// │ SerializeEntry │ ◄────────┤ OnJournalEntry │ | ||
// └─────────────┬────────────┘ └─────────────────────────┘ | ||
// │ | ||
// PushBytesToChannel Default buffer gets flushed on iteration, | ||
// │ temporary on destruction | ||
// ▼ | ||
// ┌──────────────────────────────┐ | ||
// │ dest->Push(buffer) │ | ||
// └──────────────────────────────┘ | ||
|
||
// SliceSnapshot is used for iterating over a shard at a specified point-in-time | ||
// and submitting all values to an output channel. | ||
|
@@ -95,8 +95,8 @@ class SliceSnapshot { | |
void SerializeEntry(DbIndex db_index, const PrimeKey& pk, const PrimeValue& pv, | ||
std::optional<uint64_t> expire, RdbSerializer* serializer); | ||
|
||
// Push StringFile buffer to channel. | ||
void PushFileToChannel(DbIndex db_index, io::StringFile* sfile); | ||
// Push byte slice to channel. | ||
void PushBytesToChannel(DbIndex db_index, io::Bytes bytes); | ||
|
||
// DbChange listener | ||
void OnDbChange(DbIndex db_index, const DbSlice::ChangeReq& req); | ||
|
@@ -115,9 +115,6 @@ class SliceSnapshot { | |
// Convert value into DbRecord. | ||
DbRecord GetDbRecord(DbIndex db_index, std::string value); | ||
|
||
// Flush internals of a temporary serializer. | ||
void FlushTmpSerializer(DbIndex db_index, RdbSerializer* serializer); | ||
|
||
public: | ||
uint64_t snapshot_version() const { | ||
return snapshot_version_; | ||
|
@@ -144,8 +141,6 @@ class SliceSnapshot { | |
|
||
DbIndex current_db_; | ||
|
||
// TODO : drop default_buffer from this class, we dont realy need it. | ||
std::unique_ptr<io::StringFile> default_buffer_; // filled by default_serializer_ | ||
Comment on lines
-147
to
-148
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. Either way removing this is intended |
||
std::unique_ptr<RdbSerializer> default_serializer_; | ||
|
||
::boost::fibers::mutex mu_; | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
My idea:
If I'll be implementing an async writer with the IoBuf swapping technique, then I can use it for single shard snapshots as well instead of a channel with small portions
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.
Why is it important? Take into account that iobuf is not optimized for being a queue. It may realloc heavily for variable size workloads. I think it's too soon to start optimizing the code towards a winning approach.