mirromutth / r2dbc-mysql

R2DBC MySQL Implementation
Apache License 2.0
656 stars 100 forks source link

Make obtaining ServerVersion less restrictive? #28

Closed pacphi closed 5 years ago

pacphi commented 5 years ago

Issue

I've been experimenting w/ support for r2dbc-mysql here https://github.com/pacphi/cf-butler/commit/ee197ca9639092e34280d4a1262e79cc978f98d4.

On an attempt to cf push and cf bind-service cf-butler to a p.mysql service instance hosted on a Pivotal Application Service (PAS) 2.6 foundation, you get a parse exception from r2dbc-mysql when it tries to figure out the version of MySQL it's communicating with.

Not just my app, but any app that wants to use this driver and target a service instance hosted on PAS created from the Pivotal MySQLv2 tile will run into this issue.

Workaround

Since I just build the r2dbc-mysql library from source, I made an adjustment to the ServerVersion's readIntBeforePoint(ByteBuf) method.

Ask

What could we do to make the determination of the ServerVersion less restrictive?

mirromutth commented 5 years ago

ServerVersion allowed pattern is X.Y.Z and X/Y/Z must be integers which not be negative. Sounds like the Pivotal MySQLv2 sends a version that looks like 5.7.8-RC2? (@pacphi Or could you tell me what is the server version pattern sent by the Pivotal MySQLv2 please?)

I will try to ignore characters that are not digits. Like 5.7.8-RC2 will parse to major is 5, minor is 7, patch is 8 and the postfix -RC2 has ignored.

pacphi commented 5 years ago

Release notes for the latest available MySQLv2 tile are here: https://docs.pivotal.io/p-mysql/2-6/release-notes.html. Mentions that on-demand service instances are powered by Percona Server v5.7.24-26.

Agree with your suggestion. If you could either capture or ignore the postfix, that would be appreciated.

mirromutth commented 5 years ago

ServerVersion.parse would be ignoring the postfix, see ServerVersionTest and PR.