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

Signed-off-by: proost <jwalag87@gmail.com>
…ix-inconsistency-moved-readonly-client

Signed-off-by: proost <jwalag87@gmail.com>
Copy link

codecov bot commented Nov 12, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 70.71%. Comparing base (45d596e) to head (8d9cd8b).
Report is 6 commits behind head on unstable.

Additional details and impacted files
@@             Coverage Diff              @@
##           unstable    #1284      +/-   ##
============================================
+ Coverage     70.56%   70.71%   +0.14%     
============================================
  Files           114      114              
  Lines         63147    63160      +13     
============================================
+ Hits          44560    44663     +103     
+ Misses        18587    18497      -90     
Files with missing lines Coverage Δ
src/script.c 88.23% <100.00%> (+0.59%) ⬆️

... and 12 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 <jwalag87@gmail.com>
@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