-
Notifications
You must be signed in to change notification settings - Fork 1.1k
refactor: remove is_oom flag from ConnectionContext #5216
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
Conversation
43c0949
to
fe4d813
Compare
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.
What I would have considered is to change the return type of InvokeCmd
from bool
to an enum (no error code as it has virtual members -- even for SystemCategory as it's basically a static global object and not a thread local). And then I would propagate the error (if any) from DispatchCommand
back to the caller. My rationale for this is:
- We already return if we succeed or not from InvokeCmd. Why not just supplement that?
CommandContext
belongs logically withinDispatchCommand
because this is where we have all the information to create it. Seedfly_cntx->transaction = dist_trans.get();
. Now we overwritedfly_cntx
&& theCommandContext
passed toDispatchCommand
and I find it slightly confusing that we do the extra bookeeping
This is not something I gave much thought but rather thinking out loud here
@kostasrim I need these changes not only for OOM, but for cluster slots too. I agree that this is also not the best solution, but better than before. Let's consider InvokeResult separately. |
I think that for cluster slots you already have the slot information inside the Transaction class and therefore you dont need to add it to CommandCntx. you can have the tx->GetDbContext() return the slots data as well. For this PR change I think that you dont need the is_oom in CommandCntx. If you can access the conn_context_->transaction->local_result_ after calling dispatch command in JournalExecutor::Execute |
@adiholden I want to remove the cluster code from the transaction, because we do slot calculations several times even before transaction |
@kostasrim I like your idea regarding InvokeCmd. If you want, I can remove OOM refactoring from this PR, but I still need other changes regarding CommandContext. Or we can merge the current refactoring and, in the future, return to your idea regarding the InvokeCmd result. I don't want to do these changes here because in this case the PR will have 2 absolutely different refactorings. |
9371eb4
to
46060b7
Compare
46060b7
to
112afdd
Compare
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.
🚀 very much needed for the fix in #5277
LGTM
@@ -143,12 +143,13 @@ class ClusterShardMigration { | |||
} | |||
|
|||
private: | |||
void ExecuteTx(TransactionData&& tx_data, ExecutionState* cntx) { | |||
std::error_code ExecuteTx(TransactionData&& tx_data, ExecutionState* cntx) { |
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.
Nice! We need the same for replication ;)
fixes: #5196