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
RPC wrappers, pass arguments by const ref #12504
Comments
Changed? That's the commit that introduced messaging_service. |
I copied this from @gleb reply in the slack channel, didn't investigated it on my own yet. |
This scylladb/seastar@3942546 commit. |
We had a redundant copy in receive_mutation_handler forward_fn callback. This frozen_mutation is dynamically allocated and can be arbitrary large. Fixes: scylladb#12504
By default `idl-compiler.py` emits code to pass parameters by value. There was an attribute `[[ref]]`, which makes it to use `const&`, but it was not used systematically and in many cases parameters were redundantly copied. In this PR, all `verb` directives have been reviewed and the `[[ref]]` attribute has been added where it makes sense. The parameters [are serialised synchronously](https://github.com/scylladb/seastar/blob/master/include/seastar/rpc/rpc_impl.hh#L471) so there should be no lifetime issues. This was not the case before, but the behaviour changed in [this commit](scylladb/seastar@3942546). Now it's not a problem to get an object by reference when using `send_` methods. Fixes: #12504 Closes #14003 * github.com:scylladb/scylladb: tracing::trace_info: pass by ref storage_proxy: pass inet_address_vector_replica_set by ref raft: add [[ref]] attribute repair: add [[ref]] attribute forward_request: add [[ref]] attribute storage_proxy: paxos:: add [[ref]] attribute storage_proxy: read_XXX:: make read_command [[ref]] storage_proxy: hint_mutation:: make frozen_mutation [[ref]] storage_proxy: mutation:: make frozen_mutation [[ref]]
We had a redundant copy in receive_mutation_handler forward_fn callback. This frozen_mutation is dynamically allocated and can be arbitrary large. Fixes: scylladb#12504
Minor improvement, but the fix is very low-risk, so I'll backport. |
Backported to 5.2. |
Now they are always passed by value, which sometimes leads to redundant copies, e.g. in
storage_proxy::handle_write
forward_fn
fromreceive_mutation_handler
declares the parameter asconst frozen_mutation& m
, but then it’s passed to this wrapper and gets copied, so we would have n copies for each forwarding.The parameters are serialised synchronously so there should be no lifetime issues.
This was not the case before, but the behaviour changed in this commit. Nowdays there is no problem to get an object by reference during sending.
The text was updated successfully, but these errors were encountered: