PokIsemaine commented on issue #2414:
URL: https://github.com/apache/kvrocks/issues/2414#issuecomment-2288216711

   Next I plan to support the `disable-atomicity` flag, which is a reference to 
dragonflydb, and scripts with `disable-atomicity` are allowed to execute 
non-atomistically.
   
   * The script will use a separate instance of lua, similar to the current 
read-only script.
   * Commands in a script will collectively use a Context (waiting for the 
https://github.com/apache/kvrocks/pull/2332 to complete), which provides some 
isolation (about the snapshot isolation level).
   * When this non-atomic script is executed, other non-atomic scripts and 
common commands (except `MULTI/EXEC`) can also be executed at the same time.
   
   Do you have any suggestions or discussions that you would like to discuss? 
For example, whether the flag makes sense, and some suggestions for 
implementation.
   
   As far as the examples provided by dragonfly are concerned, I think 
`read-only` will solve most of the requirements, and `disable-atomicity` is the 
more permissive version.
   ```
   #!lua flags=disable-atomicity,allow-undeclared-keys
   local cursor = "0"
   repeat
     local result = redis.call("SCAN", cursor, "MATCH", "user:*")
     cursor = result[1]
     for _, user in ipairs(result[2]) do
       process_stats(user)
     end
   until cursor == "0"
   ```
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to