-
Notifications
You must be signed in to change notification settings - Fork 734
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
valkey-cli: re-select previously selected database after reconnect #1694
Conversation
f937313
to
bfbd731
Compare
Fixes issue #1693 |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## unstable #1694 +/- ##
============================================
- Coverage 71.04% 70.94% -0.11%
============================================
Files 121 123 +2
Lines 65311 65535 +224
============================================
+ Hits 46399 46492 +93
- Misses 18912 19043 +131
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i think we can do a re-select in here? after the reconnect
static int issueCommandRepeat(int argc, char **argv, long repeat) {
/* In Lua debugging mode, we want to pass the "help" to the server to get
* it's own HELP message, rather than handle it by the CLI, see ldbRepl.
*
* For the normal server HELP, we can process it without a connection. */
if (!config.eval_ldb && (!strcasecmp(argv[0], "help") || !strcasecmp(argv[0], "?"))) {
cliOutputHelp(--argc, ++argv);
return REDIS_OK;
}
while (1) {
if (config.cluster_reissue_command || context == NULL || context->err == REDIS_ERR_IO ||
context->err == REDIS_ERR_EOF) {
if (cliConnect(CC_FORCE) != REDIS_OK) {
cliPrintContextError();
config.cluster_reissue_command = 0;
return REDIS_ERR;
}
+ reset config
+ cliSelect();
}
|
07c5cb0
to
1e1a1cb
Compare
DB0 is selecetd after reconnection regardless of the previously selected database. The prompt show the previously selected databse while working with DB0, which is misleading. The code has been chanegd to reselect the requested database. Signed-off-by: xbasel <103044017+xbasel@users.noreply.github.com>
1e1a1cb
to
c6ad039
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good in general.
If you write Fixes #xxxx
or Closes #xxxx
in the PR top comment, it links the PR to the issue closes the issue when merging. It's useful.
This PR obsoletes #1382. I prefer this new PR because it includes a test case.
446e49f
to
8f4fe28
Compare
Signed-off-by: xbasel <103044017+xbasel@users.noreply.github.com>
8f4fe28
to
d7b1cbc
Compare
DB0 is selecetd after reconnection regardless of the previously selected database. The prompt show the previously selected databse while working with DB0, which is misleading.
The code has been chanegd to reselect the requested database.
Fixes #1693