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): Buffered journal serializers #619

Merged
merged 6 commits into from
Dec 30, 2022

Conversation

dranikpg
Copy link
Contributor

No description provided.

@dranikpg dranikpg requested a review from adiholden December 29, 2022 11:51
for (const auto& entry : test_entries) {
writer.Write(entry);
}

// Read them back.
io::BytesSource bs{io::Buffer(ss.str())};
JournalReader reader{0};
io::BytesSource bs{writer.Accumulated()};
Copy link
Collaborator

Choose a reason for hiding this comment

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

The Accumulated function is only used in test.. Why do you use it and not just flush to io::StringSink ?

Copy link
Contributor Author

@dranikpg dranikpg Dec 29, 2022

Choose a reason for hiding this comment

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

Indeed, I forgot to make rdb saver use it as well. Its better than doing a double copy

src/server/journal/serializer.h Outdated Show resolved Hide resolved
src/server/dflycmd.cc Outdated Show resolved Hide resolved
JournalWriter writer{flow->conn->socket()};
auto journal_cb = [flow, writer = std::move(writer)](const journal::Entry& je) mutable {
writer.Write(je);
writer = new JournalWriter{};
Copy link
Collaborator

Choose a reason for hiding this comment

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

maybe the writer can be in flow struct, as rdb save is in flow

Copy link
Contributor Author

Choose a reason for hiding this comment

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

There is no need to, it will be replaced anyway in the next pr

Signed-off-by: Vladislav Oleshko <[email protected]>
Signed-off-by: Vladislav Oleshko <[email protected]>
Comment on lines +27 to 29
// Return reference to internal buffer.
base::IoBuf& Accumulated();

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 want to make base::IoBuf movable in helio and then let the new journal streamer just swap it instead of doing a copy

await asyncio.sleep(0.5)
await asyncio.sleep(1.0)
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 suspect they failed last time because of the small delay

@dranikpg dranikpg requested a review from adiholden December 29, 2022 20:00
@dranikpg dranikpg merged commit 7788600 into dragonflydb:main Dec 30, 2022
tamcore pushed a commit to gitgrave/dragonfly that referenced this pull request Jan 4, 2023
@dranikpg dranikpg deleted the refactor-journal-serializers branch January 5, 2023 18:21
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.

3 participants