apache / kvrocks

Apache Kvrocks is a distributed key value NoSQL database that uses RocksDB as storage engine and is compatible with Redis protocol.
https://kvrocks.apache.org/
Apache License 2.0
3.56k stars 467 forks source link

Transaction support for scripting #2612

Open PragmaTwice opened 3 weeks ago

PragmaTwice commented 3 weeks ago

Search before asking

Motivation

Solution

--

Are you willing to submit a PR?

PokIsemaine commented 2 weeks ago

We might be able to use a script flag like no-atomic (or maybe the flag name isn't appropriate, we can discuss it further) to allow the user to choose to execute the script completely exclusively or allow the script using Context + Key Lock.

PragmaTwice commented 1 week ago

Ahhh since the lua runtime is not thread-safe, we should remove the global lua context (inside Server) and utilize the worker-local lua runtimes (inside every Worker) to execute lua functions.

AS IS:

global lua runtime: EVAL, FCALL

worker-local lua runtimes: EVAL_RO, FCALL_RO

TO BE:

worker-local lua runtimes: EVAL, EVAL_RO, FCALL, FCALL_RO