forked from gilbertwong96/mysql-otp
-
Notifications
You must be signed in to change notification settings - Fork 6
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
Sync upstream 1.8.0 #14
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
* Possibility to send numbers as decimals using {decimal, Value}. * New option {float_as_decimal, boolean() | non_neg_integer()} to do this automatically for floats, optionally rounded to a given number of decimals.
As per the mysql specs at https://dev.mysql.com/doc/internals/en/connection-phase-packets.html#packet-Protocol::HandshakeResponse. Fixes a handshake error with some mysql proxy.
…tp#190) If query/N or execute/N is called on a connection which is currently in a transaction owned by another process, `{error, busy}` is returned. If transaction/N is called is called on a connection which is currently in a transaction owned by another process, `{aborted, busy}` is returned. The other process and its transaction are unaffected.
MySQL < 5.7.0 and MariaDB < 10.1.0 only support tlsv1. In all other cases we use all TLS versions available in the running Erlang/OTP ssl application. This fixes problems such as this: > ssl:connect(Port, [{versions,[tlsv1]},{verify,verify_none},{active,false}], 5000) {error,{tls_alert,{bad_record_mac,"TLS client: In state hello at tls_record.erl:571 generated CLIENT ALERT: Fatal - Bad Record MAC\n {unsupported_version,{0,0}}"}}}
If a socket error occurs when fetching a response, the mysql connection exits with the socket error as the exit reason instead of a crash. Fixes mysql-otp#196.
* Fix undetected closing of connection * Non-normal exit when connection closed by server Co-authored-by: Maria Scott <maria-12648430@hnc-agency.org> Co-authored-by: Viktor Söderqvist <viktor.soderqvist@est.tech>
…ql-otp#194) The new option `{decode_decimal, auto | number | float | binary}` controls how a DECIMAL value is translated to an Erlang term. The default 'auto' is the legacy behaviour which returns an integer or a float when no precision loss can happen for the column and a binary otherwise. The options 'number' and 'float' may return a float even if it can result in precision loss, while 'binary' always returns the textual representation of the number.
This is to avoid creating atoms when making use of prepared statements. --------- Co-authored-by: Stefan Strigler <stefan@strigler.de>
Build and run tests in GitHub Actions. Docker is used to for starting MySQL or MariaDB. Additional changes: * Changed 0.0 matches to +0.0 to make it compile on OTP 27. * Fix test case to work with MySQL running remote (not localhost). * Update minimal Erlang/OTP version to 19. * Ensure database dropped before testing create. * Simplify test prep instructions in README and refer to scripts. * Add instructions how to run tests against MySQL or MariaDB in localhost.
* Delete backported code for OTP < 18 * Delete .travis.yml
Since we are now targeting OTP >= 21, we can remove the exception handling switch macros, as `Class:Reason:Stacktrace` is supported since OTP 21.
…/1,2` depending on OTP release (mysql-otp#212) We use the `gen_server:format_status/2` callback in order to hide sensitive data from logs. In OTP/25, another callback `format_status/1` was introduced which should replace `format_status/2`. In OTP/27, `format_status/2` was deprecated, and raises a compiler warning. This PR adds the `format_status/1` callback, and a conditional that adds the `format_status/2` callback for OTP<25, where `format_status/1` is absent. I also changed the behavior such that it _always_ hides the sensitive data, ie not only in case of crashes, because BSTS ;) If a user _needs_ the unobfuscated state, he can always use `sys:get_state`.
`mysql_protocol` uses `public_key:encrypt_public`, which was deprecated in OTP 27.0 for securtity reasons. This function was undeprecated again in OTP 27.1 because only `rsa_pkcs1_padding` (used in MySQL < 8.0.5) is unsafe, while `rsa_pkcs1_oaep_padding` (used in MySQL >= 8.0.5) is still safe. This commit works around the deprecation warning in OTP 27.0 and at the same time logs a warning when `rsa_pkcs1_padding` is used.
When a transaction caller process exits, `mysql_conn` will close the socket and stop itself. Prior to this fix, the socket close function call disregards the transport implementation module (`sockmod`), always calls `gen_tcp:close` and matches it against `ok`. This PR changes to `ok = SockMod:close(...),`. Additionally, the `flush` option is added to the `demonitor` call, when a transaction monitor is demonitored. Co-authored-by: Jan Uhlig <juhlig@hnc-agency.org>
`make docs` was failing because of these edoc syntax errors.
The socket backend that `mysql_tests/socket_backend_test` tests is only supported in OTP 23+, and still very unstable in 23. Therefore, the change in this PR skips the test on OTP =< 23. Also changed the level of logs emitted from the test suite from `info` to `notice`, because `info` is below the logging threshold in the default configuration, ie the minimum level is `notice`.
This PR includes OTP 27 in the CI, and makes some small cosmetic (naming) changes.
Replace all usages of `dict` with maps. Also streamlined `mysql_cache` a bit while I was at it.
a15c655
to
a9d1049
Compare
a9d1049
to
1f366ee
Compare
zmstone
approved these changes
Dec 5, 2024
thalesmg
added a commit
to thalesmg/emqx
that referenced
this pull request
Dec 9, 2024
- mysql-otp : emqx/mysql-otp#14 Brings several fixes from upstream, in particular a case clause error: ``` Generic server <0.23937.0> terminating. Reason: {{case_clause,{error,closed}},[{mysql_protocol,fetch_response,7,[{file,\"mysql_protocol.erl\"},{line,569}]},{mysql_conn,query,4,[{file,\"mysql_conn.erl\"},{line,648}]},{mysql_conn,handle_call,3,[{file,\"mysql_conn.erl\"},{line,316}]},{gen_server,try_handle_call,4,[{file,\"gen_server.erl\"},{line,1131}]},{gen_server,handle_msg,6,[{file,\"gen_server.erl\"},{line,1160}]},{proc_lib,init_p_do_apply,3,[{file,\"proc_lib.erl\"},{line,241}]}]}. ``` - ecpool : emqx/ecpool#57 Fixes that were missed from 0.5.12, to avoid crashing ecpool workers in a tight loop and reach maximum restart intensity.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
No description provided.