Skip to content
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

Add pipelined execution for the binary protocol #225

Closed
wants to merge 1 commit into from

Conversation

markus456
Copy link
Contributor

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.3 docker image and all tests pass.

@markus456 markus456 requested a review from 9EOR9 June 24, 2023 09:26
Copy link
Collaborator

@9EOR9 9EOR9 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why don't use mysql_optionsv(mysql, MARIADB_OPT_SKIP_READ_RESPONSE, &bool) instead? See also CONC-533 and e4e5b28

@markus456
Copy link
Contributor Author

I was not aware that this option existed and what it did. Based on what the wikis says about this (it's the only reference I could find), I don't know if it even is the same.

MARIADB_OPT_SKIP_READ_RESPONSE
Don't read response packets in binary protocol. Added in version 3.1.13

Would it be possible to improve the documentation with a usage example on how to use it with binary protocol prepared statements?

@markus456
Copy link
Contributor Author

I modified the commit to only add the new mariadb_ functions to the API and converted them to use the option internally. Tests seem to pass with this version and it's less code which is usually better.

The code that causes the warnings is what actually caused the
problems. This commit fixes the warnings and turns on -Werror which
should prevent this from happening in the future.
@markus456
Copy link
Contributor Author

I closed this since it doesn't seem to be required. I still think the existing APIs need to be properly documented as they are currently unusable due to the lack of documentation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants