-
Notifications
You must be signed in to change notification settings - Fork 981
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(server): Init tx time for all multi/lua transactions #2562
Conversation
src/server/generic_family.cc
Outdated
if (cntx->transaction) { | ||
// This will be 0 if run under an unscheduled transaction |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
how come we run under unscheduled transaction?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because this transaction has no keys, see #2555 (comment):
EVAL "return redis.call('TIME')" 0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Roman, your comment made me rethink my solution. Now I explicitly init tx time in all cases, including empty keys multi/lua. PTAL.
TIME
under unscheduled tx
src/server/main_service.cc
Outdated
@@ -1710,8 +1710,10 @@ optional<bool> StartMultiEval(DbIndex dbid, CmdArgList keys, ScriptMgr::ScriptPa | |||
return false; | |||
} | |||
|
|||
if (keys.empty() && script_mode == Transaction::LOCK_AHEAD) | |||
if (keys.empty() && script_mode == Transaction::LOCK_AHEAD) { | |||
trans->InitTxTime(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
where do we call InitTxTime for NON_ATOMIC mode and keys is empty?
src/server/main_service.cc
Outdated
@@ -2040,7 +2042,9 @@ void Service::Exec(CmdArgList args, ConnectionContext* cntx) { | |||
"Dragonfly does not allow execution of a server-side Lua in Multi transaction"); | |||
|
|||
bool scheduled = false; | |||
if (*multi_mode != Transaction::NOT_DETERMINED) { | |||
if (*multi_mode == Transaction::NOT_DETERMINED) { | |||
cntx->transaction->InitTxTime(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
how about call this in transaction constructor and if we will do scheduling this will overide the value
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's a fantastic idea!
Fixes #2555