Add pipelined execution for the binary protocol #225
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The mysql_send_query() function allows text protocol queries to be executed in a batched manner, also known as pipelined execution of the queries. The batched execution for the text protocol is done by sending the queries before reading their results. This allows the sending of the query and reading of the result to be detached which eliminates the latency that would otherwise exist for normal serialized execution.
The same can be done for the binary protocol by splitting the execution of mysql_stmt_execute() into separate parts. This commit adds the extensions mariadb_stmt_send_execute() and
mariadb_stmt_read_execute_result(). They behave the same way a normal mysql_stmt_execute() would: the query parameter binds are bound before the query is sent and the result binds are bound once the results are read.
With pipelined execution supported for both text and binary protocols, bulk insertions can be done more efficiently on servers that do not implement the MariaDB bulk insertion API.
I tested this with the
10.11.3docker image and all tests pass.