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

fix: readonly client moved inconsistency #1284

Open
wants to merge 3 commits into
base: unstable
Choose a base branch
from

Conversation

proost
Copy link

@proost proost commented Nov 9, 2024

issue: #869

When client is read-only and client send lua script with write command to replica, return redirect response

Copy link

codecov bot commented Nov 12, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 70.62%. Comparing base (5d08149) to head (669ed28).
Report is 10 commits behind head on unstable.

Additional details and impacted files
@@             Coverage Diff              @@
##           unstable    #1284      +/-   ##
============================================
+ Coverage     70.57%   70.62%   +0.04%     
============================================
  Files           117      117              
  Lines         63320    63333      +13     
============================================
+ Hits          44690    44730      +40     
+ Misses        18630    18603      -27     
Files with missing lines Coverage Δ
src/script.c 88.23% <100.00%> (+0.59%) ⬆️

... and 11 files with indirect coverage changes

@madolson madolson requested a review from hpatro November 22, 2024 03:23
Comment on lines +393 to +399
if (n == NULL || !clusterNodeIsMyself(n)) {
if (error_code == CLUSTER_REDIR_MOVED || error_code == CLUSTER_REDIR_ASK) {
int port = clusterNodeClientPort(n, connIsTLS(original_c->conn));
*err = sdscatprintf(sdsempty(), "-%s %d %s:%d", (error_code == CLUSTER_REDIR_ASK) ? "ASK" : "MOVED",
hashslot, clusterNodePreferredEndpoint(n, c), port);
return C_ERR;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Could we use clusterRedirectClient method instead of handling the error manually?

Copy link
Author

@proost proost Nov 27, 2024

Choose a reason for hiding this comment

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

unforunately, we can't because after returned scriptVerifyWriteCommandAllow we should go to "error" label.
in the error label, handling reply.

…ix-readonly-client-moved-inconsistency

Signed-off-by: proost <[email protected]>
@proost proost requested a review from hpatro November 27, 2024 13:35
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.

2 participants