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
[MDEV-15935] support redirection for MariaDB Connector J #134
base: master
Are you sure you want to change the base?
Conversation
|
It seems that the mirror where the AppVeyor Build it gets the MSI packages from, http://mariadb.mirrors.ovh.net/MariaDB/, is missing several versions: 10.2.21 (missing) Whereas these versions are present on the mirror: |
Hi ColinNg, About your comment, may I ask what action should I take for this to go on further progress? Thanks. |
|
Hi ColinNg, Thanks. I've rebased the code and test has been passed. Can you help review the source code change. Thanks. Best Regards, |
|
Can this be used now? Or is it useless until the server will be able to send redirection information? |
Hi @vuvova , Best Regards, |
|
Okay, so Azure MySQL server has it, correct? |
|
Sorry for the late response. Please check the content below. Thanks.
Best Regards, |
|
It might be not a good idea to accept this pull request before server support. Without MariaDB server implementing redirects, this Connector/J feature cannot be properly tested, so it'll essentially be a dead code and will definitely stop working soon because of some unrelated changes, because the test suite will not be able to alert when the code is broken. I think it make sense to get redirect support into MariaDB server and connectors at about the same time. Then we can test that they all work together and have automatic test suites to make sure that they will work in the future too. |
src/main/java/org/mariadb/jdbc/internal/util/RedirectionInfo.java
Outdated
Show resolved
Hide resolved
|
Server pull request MariaDB/server#1472 is now OK. This PR has been there since more than one year, and connection implementation has been rewritten and simplified since. Could you update PR to current codebase ? I will do that in a few weeks if not. |
|
Hi @rusher , |
|
Hi @rusher Best Regards, |
|
I've built a server from PR MariaDB/server#1472, and the basic redirection connection test can pass now. |
|
I've updated the PR according to server side protocol, and add a new option for enableRedirect option. The enableRedirect has three choice now: Could you help check and review? Thanks. Best Regards, |
src/main/java/org/mariadb/jdbc/internal/MariaDbServerCapabilities.java
Outdated
Show resolved
Hide resolved
src/main/java/org/mariadb/jdbc/internal/util/RedirectionInfo.java
Outdated
Show resolved
Hide resolved
| try { | ||
|
|
||
| Pattern INFO_PATTERN = | ||
| Pattern.compile("^Location: mysql://\\[([^\\]:]+)\\]:([0-9]+)/\\?user=([^&]+)&ttl=([0-9]+)\\n"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this need any flexibility for future server-side changes? E.g., allow ttl "parameter" to be omitted, or allow additional parameters to be added?
Although, arguably, if additional parameters were added by the server, it might be safest to fail to parse the string on the client, as we can't guarantee that it would safe to simply ignore any extra parameters.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From server side's change, the field ttl is always, so I think the code is safe. About the flexibility, I think maybe we we can handle it in future if new field and related logic is introduced, right?
This pull request implements redirection protocol as discussed with community in https://jira.mariadb.org/browse/MDEV-15935.
The basic idea is leveraging OK packet last message to encapsulate the redirection information.