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

Enable module API SendClusterMessage to use light message header type #1572

Merged
merged 15 commits into from
Feb 3, 2025

Conversation

hpatro
Copy link
Collaborator

@hpatro hpatro commented Jan 16, 2025

This change uses the light message header for cluster module message type to be sent to a target node or broadcast across the cluster. The light message header was introduced in Valkey 8 to reduce network in/out over clusterbus and have been already used for pub/sub message transfer. It's only used if the target node supports the light message header (~30B) otherwise it falls back to using the regular header (~2KB). The module API VM_SendClusterMessage remains as is.

src/cluster_legacy.c Outdated Show resolved Hide resolved
Copy link

codecov bot commented Jan 17, 2025

Codecov Report

Attention: Patch coverage is 14.66667% with 64 lines in your changes missing coverage. Please review.

Project coverage is 70.95%. Comparing base (26c6f1a) to head (d29df94).
Report is 1 commits behind head on unstable.

Files with missing lines Patch % Lines
src/cluster_legacy.c 14.66% 64 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##           unstable    #1572      +/-   ##
============================================
- Coverage     71.02%   70.95%   -0.08%     
============================================
  Files           121      121              
  Lines         65177    65225      +48     
============================================
- Hits          46295    46282      -13     
- Misses        18882    18943      +61     
Files with missing lines Coverage Δ
src/module.c 9.59% <ø> (ø)
src/cluster_legacy.c 86.16% <14.66%> (-1.20%) ⬇️

... and 9 files with indirect coverage changes

@hpatro hpatro requested a review from a team January 21, 2025 20:53
Copy link
Contributor

@zuiderkwast zuiderkwast left a comment

Choose a reason for hiding this comment

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

It looks pretty good, but we need cross-version testing IMO with a mixed cluster to make sure it works during rolling upgrade, i.e. a mixed cluster. Can you take my work from #1371 and add it here? Or help completing it.

@sarthakaggarwal97
Copy link
Contributor

sarthakaggarwal97 commented Jan 22, 2025

Can you take my work from #1371 and add it here? Or help completing it.

@zuiderkwast just out of curiosity what is pending over here? I see @madolson approved the PR as well. I can help contribute / complete it.

Copy link
Contributor

@zuiderkwast zuiderkwast left a comment

Choose a reason for hiding this comment

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

Very nice! Some minor comments.

tests/unit/moduleapi/cross-version-cluster.tcl Outdated Show resolved Hide resolved
src/cluster_legacy.c Outdated Show resolved Hide resolved
src/cluster_legacy.c Outdated Show resolved Hide resolved
src/module.c Outdated Show resolved Hide resolved
tests/modules/cluster.c Outdated Show resolved Hide resolved
tests/modules/cluster.c Outdated Show resolved Hide resolved
assert_equal OK [$node1 test.pingall]
assert_equal 2 [CI 0 cluster_stats_messages_module_sent]
wait_for_condition 50 100 {
[CI 1 cluster_stats_messages_module_received] eq 1 &&
Copy link
Contributor

Choose a reason for hiding this comment

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

We don't check that the message receiver callback was called. Should we?

An idea is to let test.pingall be a blocking command that waits for the pong from each node and returns the number of replies, but maybe that's more complicated. You can decide.

Copy link
Collaborator Author

@hpatro hpatro Jan 29, 2025

Choose a reason for hiding this comment

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

Yeah, we don't. We lack coverage for module message receiver callback. The stat counter ticks only if the payload is valid. So, we confirm that the target is able to process the packet i.e. if it's valid only.

I think it's beyond the scope of this PR to verify the callback. I will file an (good first) issue.

Copy link
Contributor

@zuiderkwast zuiderkwast left a comment

Choose a reason for hiding this comment

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

LGTM.

I added one suggestion but I'm not sure if it's objectively better or not so you can decide. :)

If you feel like adding some test coverage for the module message receiver callback API in another PR, that would be nice.

src/cluster_legacy.c Outdated Show resolved Hide resolved
src/cluster_legacy.c Outdated Show resolved Hide resolved
@hpatro hpatro force-pushed the cluster_module_support_light_msg branch from 7bcf752 to 1583bef Compare February 1, 2025 00:56
@hpatro hpatro requested a review from zuiderkwast February 1, 2025 01:38
@zuiderkwast
Copy link
Contributor

There are some committs from other PRs here now. Some rebased/merge mistake?

If you reset hard to before the last merge commit and then rebase again, the strange ones should disappear. Try that?

Anyway, seems good to merge.

@madolson
Copy link
Member

madolson commented Feb 1, 2025

Is it intentional the new test isn't getting run anywhere? Only the main test runs with other server, this one doesn't run anywhere.

@hpatro hpatro force-pushed the cluster_module_support_light_msg branch from df720b2 to 1a2ba84 Compare February 3, 2025 17:38
hpatro added 12 commits February 3, 2025 17:39
Signed-off-by: Harkrishn Patro <[email protected]>
Signed-off-by: Harkrishn Patro <[email protected]>
Signed-off-by: Harkrishn Patro <[email protected]>
Signed-off-by: Harkrishn Patro <[email protected]>
Signed-off-by: Harkrishn Patro <[email protected]>
Signed-off-by: Harkrishn Patro <[email protected]>
Signed-off-by: Harkrishn Patro <[email protected]>
Signed-off-by: Harkrishn Patro <[email protected]>
Signed-off-by: Harkrishn Patro <[email protected]>
hpatro and others added 3 commits February 3, 2025 17:39
Signed-off-by: Harkrishn Patro <[email protected]>
Signed-off-by: Harkrishn Patro <[email protected]>
Co-authored-by: Viktor Söderqvist <[email protected]>
Signed-off-by: Harkrishn Patro <[email protected]>
Signed-off-by: Harkrishn Patro <[email protected]>
@hpatro hpatro force-pushed the cluster_module_support_light_msg branch from 1a2ba84 to d29df94 Compare February 3, 2025 17:39
@hpatro
Copy link
Collaborator Author

hpatro commented Feb 3, 2025

There are some committs from other PRs here now. Some rebased/merge mistake?

If you reset hard to before the last merge commit and then rebase again, the strange ones should disappear. Try that?

Anyway, seems good to merge.

Looks like a bad merge. Couldn't fix it via merge. Did a rebase and force pushed it.

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.

4 participants