Skip to content

Align rejected unblocked commands to update the correct error statistic#577

Merged
ranshid merged 8 commits intovalkey-io:unstablefrom
ranshid:fix-failed-stats-of-unblocked-clients
Jan 1, 2025
Merged

Align rejected unblocked commands to update the correct error statistic#577
ranshid merged 8 commits intovalkey-io:unstablefrom
ranshid:fix-failed-stats-of-unblocked-clients

Conversation

@ranshid
Copy link
Copy Markdown
Member

@ranshid ranshid commented May 30, 2024

Currently, in case a blocked command is unblocked externally (eg. due to the relevant slot being migrated or the CLIENT UNBLOCK command was issued, the command statistics will always update the failed_calls error statistic. This leads to missalignment with 90b9f08 as well as some inconsistencies. For example when a key is migrated during cluster slot migration, clients blocked on XREADGROUP will be unblocked and update the rejected_calls stat, while clients blocked on BLPOP will get unblocked updating the failed_calls stat.

In this PR we add explicit indication in updateStatsOnUnblock thet indicates if the command was rejected or failed.

Currently, in case a blocked command is unblocked externally (eg. due
to the relevant slot being migrated or the CLIENT UNBLOCK command was
issued, the command statistics will always update the failed_calls error
statistic. This leads to missalignment with valkey-io@90b9f08
as well as some inconsistencies. For example when a key is migrated
during cluster slot migration, clients blocked on XREADGROUP will be
unblocked and update the rejected_calls stat, while clients blocked on
BLPOP will get unblocked updating the failed_calls stat.

In this PR we add explicit indication in updateStatsOnUnblock thet
indicates if the command was rejected or failed.

Signed-off-by: ranshid <ranshid@amazon.com>
@codecov
Copy link
Copy Markdown

codecov Bot commented May 30, 2024

Codecov Report

Attention: Patch coverage is 50.00000% with 7 lines in your changes missing coverage. Please review.

Project coverage is 70.78%. Comparing base (1acf7f7) to head (cd859c4).
Report is 41 commits behind head on unstable.

Files with missing lines Patch % Lines
src/blocked.c 63.63% 4 Missing ⚠️
src/module.c 0.00% 3 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##           unstable     #577      +/-   ##
============================================
+ Coverage     70.71%   70.78%   +0.07%     
============================================
  Files           119      119              
  Lines         64652    64699      +47     
============================================
+ Hits          45717    45800      +83     
+ Misses        18935    18899      -36     
Files with missing lines Coverage Δ
src/server.h 100.00% <ø> (ø)
src/module.c 9.61% <0.00%> (-0.03%) ⬇️
src/blocked.c 91.11% <63.63%> (-0.78%) ⬇️

... and 51 files with indirect coverage changes

ranshid added 4 commits May 31, 2024 04:42
Signed-off-by: ranshid <ranshid@amazon.com>
Signed-off-by: ranshid <ranshid@amazon.com>
Signed-off-by: ranshid <ranshid@amazon.com>
Signed-off-by: ranshid <ranshid@amazon.com>
@madolson
Copy link
Copy Markdown
Member

madolson commented Oct 7, 2024

@ranshid Can you update this? I remember discussing this but I guess it fell between the cracks.

@madolson madolson requested a review from hpatro November 22, 2024 03:29
@hpatro
Copy link
Copy Markdown
Contributor

hpatro commented Nov 26, 2024

Can you update this? I remember discussing this but I guess it fell between the cracks.

I don't have the context. @ranshid What's remaining here?

Comment thread src/blocked.c Outdated
Signed-off-by: Ran Shidlansik <ranshid@amazon.com>
@ranshid
Copy link
Copy Markdown
Member Author

ranshid commented Dec 11, 2024

@madolson @hpatro so sorry I missed that one. It is something I already did in Redis OSS and wanted to port it here.
rebased and applied @hpatro suggestion.

Signed-off-by: Ran Shidlansik <ranshid@amazon.com>
@hpatro
Copy link
Copy Markdown
Contributor

hpatro commented Dec 17, 2024

This is a minor change in behavior. @madolson Do you folks vote on this as well?

@ranshid ranshid merged commit 0f273bb into valkey-io:unstable Jan 1, 2025
kronwerk pushed a commit to kronwerk/valkey that referenced this pull request Jan 27, 2025
…ic (valkey-io#577)

Currently, in case a blocked command is unblocked externally (eg. due to
the relevant slot being migrated or the CLIENT UNBLOCK command was
issued, the command statistics will always update the failed_calls error
statistic. This leads to missalignment with
valkey-io@90b9f08
as well as some inconsistencies. For example when a key is migrated
during cluster slot migration, clients blocked on XREADGROUP will be
unblocked and update the rejected_calls stat, while clients blocked on
BLPOP will get unblocked updating the failed_calls stat.

In this PR we add explicit indication in updateStatsOnUnblock thet
indicates if the command was rejected or failed.

---------

Signed-off-by: ranshid <ranshid@amazon.com>
Signed-off-by: Ran Shidlansik <ranshid@amazon.com>
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