log_queries_not_using_indexes is not enabled because in MySQL it is *only*
a global variable, while in MariaDB is a global *and* session variable .
We believe it is not the time to create a lot of exceptions and complex logic
for conflicting backend implementations
* 'admin-ssl_keylog_file' variable has been introduced to allow users to specify the path for the SSLKEYLOG file. The file path can be an absolute path or relative to the ProxySQL data directory.
* Assigning an empty path to the 'admin-ssl_keylog_file' variable signifies that the SSLKEYLOG file feature is disabled.
* In case an invalid path is provided for the SSLKEYLOG file, ProxySQL will automatically revert to the last valid path value.
* 'PROXYSQL FLUSH LOGS' command can be used to rotate SSLKEYLOG file.
# Conflicts:
# lib/mysql_connection.cpp
Setting 'MySQL_Session::status', and 'client_myds::DSS' flags before a
call to 'RequestEnd' is redundant, and in some scenarios even dangerous.
'RequestEnd' should handle this for regular sessions.
Session 'status' and 'client_myds->DSS' should never be modified for a
regular session prior to calling 'RequestEnd'. It's 'RequestEnd'
responsibility to appropriately change these statuses after the rest of
cleanup operations for the request has taken place, including logging.
Now mysql_users.password can store the authentication_string as
in MySQL's mysql.user table.
Note: this commit also changes SALT_LEN_MAX in SHA-crypt code from
16 to 20 because MySQL caching_sha2_password uses 20 bytes salt
This commit also introduces 2 output for PROXYSQL INTERNAL SESSION:
- active_transactions
- transaction_started_at
Enhanced the TAP tests to also verify the above metrics
When receiving MYSQL_COM_BINLOG_DUMP , MYSQL_COM_BINLOG_DUMP_GTID or
MYSQL_COM_REGISTER_SLAVE , proxysql automatically switches to fast_forward .
Although it is important to correctly configure "encrypted" in the backend
data stream if needed.
Used PMC-10005 for reference , as this is implemented similarly in many
parts of the code.
During the switch proxy_info() now also reports the client and the
command received.
The destination hostgroup assigned from previous COM_QUERY commands is
the one used to establish the fast_forward connection. As a result,
multiple binlog clients can consume binlog events from different MySQL
hostgroups using the same username.
If mysql_hostgroup_attributes.multiplex:
- 0 : multiplexing is always disabled
- 1 : multiplexing is enabled for the hostgroup, but other criteria can disable multiplexing (transaction, temp tables, query rules, etc)
Fix honoring of 'connect_timeout_server_max' and
'connect_retries_on_failure' for 'fast_forward' sessions created by
'MYSQL_COM_BINLOG_DUMP' when session still doesn't own a backend
connection.
For commands BINLOG_DUMP, BINLOG_DUMP_GTID and REGISTER_SLAVE a lot of
the features provided by ProxySQL aren't useful, like multiplexing,
query parsing, etc. For this reason, ProxySQL enable fast_forward when
it receives these commands.
Otherwise, autocommit status flag is always zero, instead of displaying
its true value.
OK responses were reporting an invalid autocommit during handshake,
reset_connection and change_user petitions.
* Added forced triggering of DNS Cache Update on MySQL Servers and ProxySQL Servers table update.
* Direct DNS cache update via socket (connected peer ip) if record is not available in cache.
* Used strdup instead of realloc.
* DNS lookup only once for ProxySQL Cluster Nodes.
- Compression flag is now propagated from client to backend connection
when the backend connection is being created for a 'fast_forward'
session. In case of client trying to connect without compression, to
a server configured with compression, we fallback to an uncompressed
connection.
- After a 'MySQL_Session' has obtained a connection for a 'fast_forward'
session, i.e, the one-to-one relationship between the client and
backend connection has been stablished, we completely disable the
compression 'STATUS_MYSQL_CONNECTION_COMPRESSION' flag from the client
'MySQL_Connection'.
- Correct the behavior for 'connect_retries_on_failure' for
'fast_forward' sessions to match regular sessions, reusing the
same implementation based on 'MySQL_Data_Stream::max_connect_time'.
- Change 'connect_timeout' for 'fast_forward' sessions to be the
highest of 'connect_timeout_server' and 'connect_timeout_server_max'.
- Add handling for 'COM_QUIT' packets for 'fast_forward' sessions which
have not yet received a backend connection.
This forces the re-evaluation of the query digest for each
'STMT_EXECUTE' for impossing the required flags over the current
backend 'MySQL_Connection'.
This commit contains an implementation rework and a fix:
- Impl for 'auto_increment_delay_multiplex_timeout_ms' has been
reworked in favor of reusing 'wait_until' to share logic with
previous 'connection_delay_multiplex_ms' variable.
- Fix previous 'connection_delay_multiplex_ms' behavior preventing
connection retaining when traffic unrelated to target hostgroup is
being received by the session.
If any scenario is found in which we may want to consider a non
'ASYNC_IDLE' connection for expiring, this precondition shall be
removed, and checks should be responsible for ensuring 'ASYNC_IDLE'
state in the connection.
Because of MySQL bug https://bugs.mysql.com/bug.php?id=107875 ,
autocommit=0 can "create a transaction" even if SERVER_STATUS_IN_TRANS
is not set. This means that a SAVEPOINT can be created in a "transaction"
created with autocommit=0 but without SERVER_STATUS_IN_TRANS .
This commit takes also care of scenarios when autocommit=0 was switched back
to autocommit=1 when a SELECT was executed while variable
mysql-enforce_autocommit_on_reads was false.
MySQL_Session::NumActiveTransactions() now accepts a flag to check
for savepoints.
PMC-10003: Retrieved a resultset while running a simple command using async_send_simple_command() .
async_send_simple_command() is used by ProxySQL to configure the connection, thus it
shouldn't retrieve any resultset.
A common issue for triggering this error is to have configure mysql-init_connect to
run a statement that returns a resultset.
* uninitialized variables variables.read_only in Clickhouse
* generate_proxysql_internal_session_json() may try to access variables not set
This commit also prevents watchdog to restart ProxySQL if running under valgrind.
In debug build, the spinning loops also have a minor usleep.
This to prevent valgrind to loop for long time
Track NO_BACKSLASH_ESCAPES in case it is changed:
- using SET sql_mode by the client
- directly on the backend (for example default sql_mode, or an
sql_mode set from another variable)
New variables supported:
- lc_messages
- lc_time_names
- long_query_time
- max_execution_time
- max_heap_table_size
- max_sort_length
- optimizer_prune_level
- optimizer_search_depth
- optimizer_switch
- sort_buffer_size
- sql_big_selects
- timestamp
- tmp_table_size
Note: sql_big_selects is still not fully supported when
combined with max_join_size.
In set testing TAP ,set large max_execution_time.
If max_execution_time is too small, the TAP test may fails because the
queries will timeout.
Better parsing of SET SQL_LOG_BIN .
SQL_LOG_BIN is now managed by the same functions that handle boolean variables
instead of the now deprecated MySQL_Session::handler_WCD_SS_MCQ_qpo_Parse_SQL_LOG_BIN()
For naming convention, enum value SQL_LOG_BIN was renamed to SQL_SQL_LOG_BIN
In MySQL_Thread we also deprecated match_regexes[0] , previously
used to parse `set sql_log_bin`.
Functions Variable::fill_server_internal_session() and
Variable::fill_client_internal_session() seems to handle sql_log_bin as a
special value. This exception was removed.
Fixed a bug in MySQL_Session::generate_proxysql_internal_session_json() where
when backend variables needed to be generated, fill_client_internal_session()
was incorrectly called instead of fill_server_internal_session() , leading to
incorrect values reported by `PROXYSQL INTERNAL SESSION`
- Provided a new function to partially initialize 'MySQL_ResultSet'.
- Replaced 'generate_pkt_row' in favor of 'generate_pkt_row3' for
resulset writing.
Deprecated variables:
- net_write_timeout
Renamed set_testing-t.csv to set_testing-t.csv.obsolete , and removed net_write_timeout from set_testing-t.csv
Variables added to ignore list:
- net_write_timeout
- net_buffer_length
- read_buffer_size
- read_rnd_buffer_size
Added support for quoting with backtick
Renamed `enum variable_name` into `enum mysql_variable_name` for better readibility
`enum mysql_variable_name` has variable names alphabetically ordered after SQL_NAME_LAST_LOW_WM
`mysql_tracked_variables` has variable names alphabetically ordered after SQL_NAME_LAST_LOW_WM
A lot of new variables added in `mysql_tracked_variables` , although not all tracked yet (TODO)
In `MySQL_Variables::MySQL_Variables()`:
- if `internal_variable_name` in `mysql_tracked_variables` is NULL , it will be automatically initialized
- it performs some sanity check between `enum mysql_variable_name` and `mysql_tracked_variables`
Testing:
- refactored code in set_testing-t.cpp and set_testing-multi-t.cpp
- added set_testing-240-t.cpp to test improvements in 2.4.0
- generate_set_session_csv to automatically create set_testing-240.csv used by set_testing-240-t
This commits partially revert 0dde4adb21
It also improve the TAP test reg_test_3493-USE_with_comment-t.cpp with a
variety of combinations, that helped find a bug in the tokenizer
mysql_query_digest_and_first_comment()
Add initial support for FR limiting the number of connection errors that
can be initiated from a particular address before deniying future
connections from that address. Feature is controlled by new introduced
variables:
- mysql-client_host_error_counts
- mysql-client_host_cache_size
Command PROXYSQL RELOAD TLS is able to load new key/cert files and
create a new SSL context.
Loading of SSL can happens in two stages:
* during bootstrap: if it fails, proxysql dies
* running PROXYSQL RELOAD TLS: if it fails, proxysql will keep the old SSL context
This new method should successfully handle errors like missing or corrupted files.
We are also adding two buffers used to store the key/cert, to be used by the web interface.
This commit add the support of ERR packet in binary protocol resultset,
for example due to MAX_EXECUTION_TIME while running a prepared statement.
It also changes how EOF packets are added: instead of writing the EOF in the
resultset buffer, the EOF packet is written in its own packet. This allows to
easily remove it if needed.
It also fix what seems (not sure) a bug in MariaDB client library, where if a
prepared statement is interrupted it cannot be executed again
Added function MySQL_Session::detected_broken_connection() that unifies the way broken connections are logged.
It also logs username, and last time used.
Added also a new macro proxy_error_inline()
'CurrentQuery.QueryParserArgs.first_comment' needs to hold it's own copy
of 'first_comment', otherwise, the 'first_comment' from global 'stmt_info'
will be freed by 'Query_Info::end' at the end of the life of 'CurrentQuery'.
All variables that are not known by ProxySQL should fail to be parsed.
A best effor should also be done for tracking all the variables present
in a 'SET' statement prior to returning the parsing failure.