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

chore: refactor XRead #3775

Merged
merged 3 commits into from
Sep 27, 2024
Merged

chore: refactor XRead #3775

merged 3 commits into from
Sep 27, 2024

Conversation

dranikpg
Copy link
Contributor

Fixes #3770

Previously XREAD:

  1. Fetched group consumer info (with a hop)
  2. Looked up last stream ids (with a hop)
  3. Determined if there are entries to read (on coordinator)
  4. Dispatched a hop to read entries or retired to blocking mode

Instead we can merge steps (1), (2) and (3) into a single step, optionally with step (4) for single shard operations that can avoid concluding (we had this optimization before)

Signed-off-by: Vladislav Oleshko <[email protected]>
@dranikpg dranikpg marked this pull request as ready for review September 25, 2024 20:14
@dranikpg
Copy link
Contributor Author

dranikpg commented Sep 25, 2024

I'll add single shard optimizations separately to keep the PR smaller (I predict complains about the size 😝)

@dranikpg dranikpg requested a review from romange September 25, 2024 20:15
@dranikpg dranikpg changed the title WIP chore: refactor XRead chore: refactor XRead Sep 26, 2024
@@ -1342,6 +1312,12 @@ OpStatus OpDestroyGroup(const OpArgs& op_args, string_view key, string_view gnam
if (cgr_res->cg) {
raxRemove(cgr_res->s->cgroups, (uint8_t*)(gname.data()), gname.size(), NULL);
streamFreeCG(cgr_res->cg);

Copy link
Collaborator

Choose a reason for hiding this comment

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

add comment that you awake readers that are blocked on a consumer from this cg

romange
romange previously approved these changes Sep 27, 2024
@dranikpg dranikpg merged commit 55699a9 into dragonflydb:main Sep 27, 2024
9 checks passed
romange pushed a commit that referenced this pull request Sep 30, 2024
Previously XREAD:
- Fetched group consumer info (with a hop)
- Looked up last stream ids (with a hop)
- Determined if there are entries to read (on coordinator)
- Dispatched a hop to read entries or retired to blocking mode

Instead we can merge steps (1), (2) and (3) into a single step, optionally with step (4) for single shard operations that can avoid concluding (we had this optimization before)
@dranikpg dranikpg deleted the xread-opt branch October 20, 2024 14:55
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.

A data race inside blocking XREAD
2 participants