Skip to content

Conversation

@dvkashapov
Copy link
Contributor

I was testing #2309 and found that if you do MULTI, SELECT incorrect dbid and EXEC combination of commands, then database ID right next to valkey-server address won't change, but it should. Turns out, for this combination of commands reply->type is VALKEY_REPLY_ARRAY, which was added to if statement for EXEC handling.

BEFORE:
127.0.0.1:6379> multi
OK
127.0.0.1:6379(TX)> select 438764
QUEUED
127.0.0.1:6379[438764](TX)> exec
1) (error) ERR DB index is out of range
127.0.0.1:6379[438764]> multi
OK
127.0.0.1:6379[438764](TX)> select 327648273645872634
QUEUED
127.0.0.1:6379[1911465466](TX)> exec
1) (error) ERR value is out of range, value must between -2147483648 and 2147483647

AFTER:
127.0.0.1:6379> multi
OK
127.0.0.1:6379(TX)> select 7463746
QUEUED
127.0.0.1:6379[7463746](TX)> exec
1) (error) ERR DB index is out of range
127.0.0.1:6379>
             /\
No incorrect DB ID

@codecov
Copy link

codecov bot commented Jul 15, 2025

Codecov Report

Attention: Patch coverage is 0% with 1 line in your changes missing coverage. Please review.

Project coverage is 71.44%. Comparing base (de76586) to head (551a133).
Report is 1 commits behind head on unstable.

Files with missing lines Patch % Lines
src/valkey-cli.c 0.00% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##           unstable    #2357      +/-   ##
============================================
+ Coverage     71.41%   71.44%   +0.03%     
============================================
  Files           123      123              
  Lines         67132    67132              
============================================
+ Hits          47942    47965      +23     
+ Misses        19190    19167      -23     
Files with missing lines Coverage Δ
src/valkey-cli.c 56.25% <0.00%> (ø)

... and 13 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Member

@roshkhatri roshkhatri left a comment

Choose a reason for hiding this comment

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

LGTM

@dvkashapov
Copy link
Contributor Author

@roshkhatri I've thought a bit, and this clears dbid indicator even for valid MULTI, SELECT id, EXEC, when it should not, we need to investigate why reply->type for it is VALKEY_REPLY_ARRAY. This is not a correct fix, closing.

@dvkashapov dvkashapov closed this Jul 16, 2025
@dvkashapov dvkashapov deleted the cli-fix branch July 16, 2025 07:58
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