git-hulk commented on code in PR #782:
URL: https://github.com/apache/incubator-kvrocks/pull/782#discussion_r952066157
##########
src/redis_cmd.cc:
##########
@@ -4742,6 +4742,32 @@ class CommandEvalSHA : public Commander {
}
};
+class CommandEvalRO : public Commander {
+ public:
+ Status Parse(const std::vector<std::string> &args) override {
+ return Status::OK();
+ }
+
Review Comment:
```suggestion
```
Can remove this part if it does nothing
##########
src/scripting.cc:
##########
@@ -898,7 +921,9 @@ Status createFunction(Server *srv, const std::string &body,
std::string *sha) {
funcdef += body;
funcdef += "\nend";
- lua_State *lua = srv->Lua();
+ if (!lua) {
Review Comment:
Can we choose the Lua state in caller? the caller should determine where to
create the function.
##########
src/scripting.cc:
##########
@@ -233,11 +240,18 @@ namespace Lua {
Status evalGenericCommand(Redis::Connection *conn,
const std::vector<std::string> &args,
bool evalsha,
- std::string *output) {
+ std::string *output,
+ bool read_only) {
int64_t numkeys = 0;
char funcname[43];
Server *srv = conn->GetServer();
- lua_State *lua = srv->Lua();
+ lua_State *lua = NULL;
+ if (read_only) {
+ // use worker's lua VM
+ lua = conn->Owner()->Lua();
+ } else {
+ lua = srv->Lua();
+ }
Review Comment:
```suggestion
lua_State *lua = srv->Lua();
if (read_only) {
// Use the worker's private Lua VM when entering the read-only mode
lua = conn->Owner()->Lua();
}
```
--
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]