cli fix for correct db number#6728
Conversation
itamarhaber
left a comment
There was a problem hiding this comment.
Hello @hwware
This looks like a good start. However, I think more work is needed.
For example, I don't see where DISCARD is handled and I'm unclear how this will behave if I try nested MULTI statements (which [usually] yields an error).
|
@itamarhaber Hi, thank you for your valuable comments, I will work on these and resolve & test these shortly.. |
update redis cli solve comments
|
Hi @itamarhaber Can you please review this PR again? thanks! |
|
closing this PR since we have a more recent descussion and fix in #8000 |
|
in my eyes, redis-cli is aiming to be simple and dumb, but considering it attempts to show the currently selected db in the prompt, i think it's its job to track multi state. |
|
hi @oranagra , showing the multi state is a good idea in cli, it indeed give user clear idea whether it is in a transaction context, rather than checking the return value of command(will return queued). For this db number inconsistency issue, I felt like if we provide a way for fetching the current db, like #8139 or CLIENT INFO command and using this in cli when it refreshing the prompt, we shouldn't see this issue anymore. How do you think? |
|
i don't think redis-cli needs to implicitly send commands to redis to refresh the prompt (even the initial COMMAND command it implicitly sends at startup may be problematic). |
|
thanks @oranagra for the advice,
I was just not sure if this is the only case causing the db inconsistencies between cli and redis server and what we did here is just purely doing something in cli side rather than #8139 which provide a way for sync with server to get correct db number. but this pr actually fixing the issue #6727, if you think this make sense I can modify this pr, also include something like: |
|
seems right to me. i'd like to see what @itamarhaber thinks. |
Agreed.
Totally - a MULTI indicator would be awesome. I think that dbnum should precede it though, and for the sake of brevity I'd use something like: |
|
Thanks @oranagra @itamarhaber , based on the conversion please review my new changes of this PR, thanks! |
oranagra
left a comment
There was a problem hiding this comment.
@itamarhaber since the db number is only shown (with brackets) when !=0, then showing the TX without any brackets will make it look odd with DB 0. (i.e. 127.0.0.1TX)
i suggest adding back the parenthesis.
|
thanks @oranagra @itamarhaber , pr updated based on the suggestions.. |
oranagra
left a comment
There was a problem hiding this comment.
@itamarhaber can i merge this?
|
@Oran be my guest, please do. |
No description provided.