apache / apache/kvrocks

Support more script flags in lua script shebang

Open
#2,414 3 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
C++
Stars
4.4k
Forks
658
Avg merge
1d 20h
Merged PRs (30d)
10

Description

### Search before asking

- [X] I had searched in the [issues](https://github.com/apache/kvrocks/issues) and found no similar issues.

### Motivation

https://redis.io/docs/latest/develop/interact/programmability/lua-api/#script_flags
https://redis.io/docs/latest/develop/interact/programmability/eval-intro/#eval-flags
https://redis.io/docs/latest/develop/interact/programmability/functions-intro/#function-flags

It seems that only the `name` flag of redis function is supported now, and we can support the parsing of some other flags. For example `no-writes`, `allow-cross-slot-keys`, etc.

On the one hand, there are already existing requirements issue: https://github.com/apache/kvrocks/issues/1884 , https://github.com/apache/kvrocks/issues/2133

On the other hand, for the optimization function of Lua script in the future, we may need to support some special flags like dragonflydb to enable optimization. Relevant information:

https://www.dragonflydb.io/docs/managing-dragonfly/scripting

https://www.dragonflydb.io/blog/leveraging-power-of-lua-scripting

https://github.com/apache/kvrocks/issues/2162

### Solution

I'm thinking about how to implement it. Generally speaking, the process of parsing and obtaining flag should be more general.

### Are you willing to submit a PR?

- [X] I'm willing to submit a PR!

Contributor guide

No contributing guide indexed for this repository

Research direction

The payload names no source files or tests. Start by locating the existing Lua shebang parsing that supports the `name` flag, then read the linked Redis flag documentation and related issues 1884 and 2133; done means defining and validating a general parser for the selected flags, including `no-writes` and `allow-cross-slot-keys`.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, lua
Domain
backend-api-design, databases
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.