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 support for MySQL pipelining execution #1168

Merged

Conversation

BillyYccc
Copy link
Member

Motivation:

fixes #861, fixes #873

Changes:

  • add support for query pipelining execution
  • mysql connection now handles the fire & forget command in the queue order correctly
  • rework the batch execution to use pipelining mode by default

Conformance:

You should have signed the Eclipse Contributor Agreement as explained in https://github.com/eclipse/vert.x/blob/master/CONTRIBUTING.md
Please also make sure you adhere to the code style guidelines: https://github.com/vert-x3/wiki/wiki/Vert.x-code-style-guidelines

@BillyYccc
Copy link
Member Author

This feature is now ready for reviewing

@vietj vietj added this to the 4.3.0 milestone Apr 1, 2022
Copy link
Member

@vietj vietj left a comment

Choose a reason for hiding this comment

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

LGTM overall, a couple of minor changes to do and we are good to go.

Copy link
Contributor

@tsegismont tsegismont left a comment

Choose a reason for hiding this comment

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

Thank you @BillyYccc ! I just have a question about usage

* {@code MySQLBatchException} is thrown if an error occurs during executions when using {@link io.vertx.sqlclient.PreparedQuery#executeBatch(List)}.
* The client will try to execute with all the params no matter if one iteration of the executions fails, the iteration count is calculated from zero.
*/
public class MySQLBatchException extends RuntimeException {
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you think about a way to combine this type with MySQLException in a hierarchy? It can be convenient for users to identity where the issue comes from when the exception bubbles up to upper layers.

Copy link
Member Author

Choose a reason for hiding this comment

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

how about using a mapping like Map<Integer, MySQLException> to represent the errors in a batching process? I think MySQL needs this because it emulates batching by sending multiple requests and might receive multiple error responses which does not behave like Postgres client batching(one request & one response)

@BillyYccc
Copy link
Member Author

I also need to label this as breaking change because it changes the way how the batching works.

@vietj
Copy link
Member

vietj commented Apr 4, 2022

@BillyYccc can you update the breaking change wiki page too https://github.com/vert-x3/wiki/wiki/4.3.0-Deprecations-and-breaking-changes

@BillyYccc
Copy link
Member Author

@BillyYccc can you update the breaking change wiki page too https://github.com/vert-x3/wiki/wiki/4.3.0-Deprecations-and-breaking-changes

done

@vietj
Copy link
Member

vietj commented Apr 7, 2022

Another small change, I think receiveNoResponsePacket method should be renamed expectNoResponsePacket

@vietj
Copy link
Member

vietj commented Apr 11, 2022

ping @BillyYccc

@BillyYccc
Copy link
Member Author

I think it's ready for a final review now

@@ -65,6 +65,7 @@ public static MySQLConnectOptions fromUri(String connectionUri) throws IllegalAr
public static final Map<String, String> DEFAULT_CONNECTION_ATTRIBUTES;
public static final SslMode DEFAULT_SSL_MODE = SslMode.DISABLED;
public static final String DEFAULT_CHARACTER_ENCODING = "UTF-8";
public static final int DEFAULT_PIPELINING_LIMIT = 1;
Copy link
Member

Choose a reason for hiding this comment

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

why not use the same value than PgConnectOptions which is 256 ?

Copy link
Member

Choose a reason for hiding this comment

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

I'm assuming this is for backward compatibility ?

Copy link
Member Author

Choose a reason for hiding this comment

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

yes, I'm trying to avoid introducing breaking changes.

Copy link
Member

@vietj vietj left a comment

Choose a reason for hiding this comment

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

A few minor change and a question about pipelining limit default = 1 (assuming it's for being conservative and backward compatible).

@vietj
Copy link
Member

vietj commented May 9, 2022

@BillyYccc if you can handle the minor changes soon, it can be merged and be part of Vert.x 4.3 release

BillyYccc added 3 commits May 9, 2022 20:54
Signed-off-by: Billy Yuan <[email protected]>
Signed-off-by: Billy Yuan <[email protected]>
@BillyYccc
Copy link
Member Author

all comments should be addressed now

@vietj vietj merged commit bef0b4b into eclipse-vertx:master May 9, 2022
@vietj
Copy link
Member

vietj commented May 9, 2022

thanks for your great contribution @BillyYccc !

@BillyYccc
Copy link
Member Author

thanks for the reviewing 😃

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