EVALSHA_RO and EVAL_RO Commands#8820
Conversation
Added new readonly versions of EVAL and EVALSHA.
Add additional test, remove readonly flag.
madolson
left a comment
There was a problem hiding this comment.
@nmvk Can you update the comment to give more detail about the feature.
@redis/core-team ping, this is basically just he implementation that was discussed in #8537. Adding an EVAL command that can not become unkillable, can't force replication, and can be consistently routed to replicas in cluster mode.
Fix spacing issue
Fix function order.
|
@MeirShpilraien FYI |
|
I believe we decided we're okay merging this. Going to pick this so I can merge it into my redaction PR. |
* EVALSHA_RO and EVAL_RO Commands Added new readonly versions of EVAL and EVALSHA.
|
@madolson @nmvk i now realize we removed the |
|
@oranagra The check for whether or not a command can get executed on a replica is if it has the 'write' flag is present, not if the 'read-only' flag is present. Clients can also know that a command "accesses" keys by checking keyspecs I suppose, and seeing that the command accesses at least one key. The same question also sort of exists for EVAL, which isn't marked as a write command. |
|
right, both EVAL and EVAL_RO don't have either the |
|
The important point is not whether they access keys, it's how they access them. EVAL_RO has keys marked as RO and EVAL has keys marked as RW. If we want to use read-only as the authoritative flag to indicate a command to be sent on the replica, that seems reasonable but we probably want to refactor the tracking code as was originally called out. |
|
ok, so you're saying that the difference is in the key-spec (which is a new thing that's not widely used yet). i was under the impression that there are some clients that already use the read-only flag for command routing, and if that's the case, i think we need to do the extra effort to add that flag and fix the problems with tracking. if that's not the case, maybe it's just that the value of this new command is lower than i thought. |
|
Some clients:
So, not very well adopted, but I agree it seems like the right approach. @oranagra Any thoughts about whether or not we should include EVAL_RO inside the ACL read-only category? I was thinking probably not, given how often lua vulnerabilities exist. |
|
i don't see the relation between ACL |
|
The ACL readonly category is the collection of all commands that have the readonly flag, which would include the lua script. I was suggesting that lua should still be excluded from this category even if we add the flag. I don't want it to be implicitly added, I feel like you need to 'opt-in' to allowing scripts. |
|
if you allow a certain user a read-only access, what you care about is that they won't modify the dataset, and EVAL_RO is a valid command, since it doesn't allow modifying the dataset (unless we have bugs, but that's not what we design features by). LCS is also dangerous (we had some overflows in it i the past), should we set it as non-read-only too? @yossigo please comment. anyway, putting the ACL argument aside for a moment, we do agree that considering the purpose of this command, and at least the implementation of some (one) client libraries, it should have the |
|
Yeah, I do agree about marking the flag that way.
A counter argument to this is that you have to explicitly allow @scripting for EVAL. If yossi has a comment here, please do, otherwise let me just go implement the PR and we can move the discussion there. EDIT: Scripting commands aren't marked as dangerous? That seems shocking to me. |
|
@madolson I agree, |
|
@madolson i understand that you're concerned that if someone makes an ACL that blocks all commands and grants access only to on the other hand, i'm not sure if the first one is that useful, arguably if a user wants to only allow reads, a better approach is the block @yossigo i'm not entirely sure what you meant by |
|
@oranagra That doesn't really work well with ACLs, since +@ALL is also considered less optimal than -@ALL since it allows ALL future module commands, if any exist, which could be read or write. <- this is also something we may want to fix |
|
we discussed this in a core-team meeting and decided to go with it, i.e. these commands will have the Also, we realized that we kinda regret adding the EVAL_RO command (was done before shabang flags existed), and we now realize that can can probably split client libraries into 3 categories:
arguably option [2] is insufficient anyway, and we don't need to promote it. |
Added new readonly versions of EVAL and EVALSHA. Commands are implemented
as
no-script @scripting. We have avoided addingread-onlyas it may resultin client key tracking which is not part of
EVAL/EVALSHA.These commands can not become unkillable, can't force replication, and can
be consistently routed to replicas in cluster mode.
Fixes - #8537
Update:
in 7.0.1 we change the flags of this command.
see: #8820 (comment) #10728