From d11c78ad802b277daa2a8c1287eb092945fa7f96 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20M=C3=A4kel=C3=A4?= Date: Mon, 10 Sep 2018 12:40:03 +0300 Subject: [PATCH] Format all sources with Uncrustify Formatted all sources and manually tuned some files to make the code look neater. --- include/maxscale/authenticator.h | 68 +- include/maxscale/config.h | 94 +- include/maxscale/dcb.h | 36 +- include/maxscale/filter.h | 18 +- include/maxscale/hint.h | 54 +- include/maxscale/listener.h | 24 +- include/maxscale/modinfo.h | 4 +- include/maxscale/monitor.h | 28 +- include/maxscale/protocol/mysql.h | 68 +- include/maxscale/router.h | 30 +- include/maxscale/server.h | 17 +- include/maxscale/server.hh | 2 +- include/maxscale/service.h | 102 +- include/maxscale/session.h | 78 +- include/maxscale/ssl.h | 22 +- maxscale-system-test/big_load.h | 2 +- maxscale-system-test/big_transaction.h | 2 +- .../binlog_big_transaction.cpp | 2 +- maxscale-system-test/binlog_change_master.cpp | 2 +- maxscale-system-test/binlog_failover.cpp | 2 +- maxscale-system-test/blob_test.h | 4 +- maxscale-system-test/bug469.cpp | 6 +- maxscale-system-test/bug471.cpp | 2 +- maxscale-system-test/bug479.cpp | 2 +- maxscale-system-test/bug488.cpp | 2 +- maxscale-system-test/bug495.cpp | 2 +- maxscale-system-test/bug507.cpp | 18 +- maxscale-system-test/bug509.cpp | 22 +- maxscale-system-test/bug529.cpp | 4 +- maxscale-system-test/bug587.cpp | 2 +- maxscale-system-test/bug592.cpp | 2 +- maxscale-system-test/bug601.cpp | 2 +- maxscale-system-test/bug643.cpp | 2 +- maxscale-system-test/bug643_1.cpp | 2 +- maxscale-system-test/bug650.cpp | 2 +- maxscale-system-test/bug653.cpp | 4 +- maxscale-system-test/bug654.cpp | 2 +- maxscale-system-test/bug656.cpp | 2 +- maxscale-system-test/bug662.cpp | 4 +- maxscale-system-test/bug670_sql.h | 2 +- maxscale-system-test/bug673.cpp | 2 +- maxscale-system-test/bug681.cpp | 2 +- maxscale-system-test/bug694.cpp | 2 +- maxscale-system-test/bug699.cpp | 38 +- maxscale-system-test/bug705.cpp | 15 +- maxscale-system-test/bug711.cpp | 2 +- maxscale-system-test/bug730.cpp | 2 +- maxscale-system-test/bulk_insert.cpp | 6 +- .../change_master_during_session.cpp | 2 +- maxscale-system-test/change_user.cpp | 4 +- maxscale-system-test/connection_limit.cpp | 2 +- maxscale-system-test/different_size.h | 4 +- maxscale-system-test/execute_cmd.h | 2 +- maxscale-system-test/failover_mysqlmon.cpp | 2 +- maxscale-system-test/fw_copy_rules.h | 2 +- maxscale-system-test/fwf.cpp | 6 +- maxscale-system-test/fwf2.cpp | 4 +- maxscale-system-test/get_com_select_insert.h | 2 +- maxscale-system-test/get_my_ip.h | 2 +- maxscale-system-test/keepalived_func.h | 2 +- maxscale-system-test/kerberos_setup.cpp | 27 +- maxscale-system-test/load_balancing.cpp | 6 +- .../load_balancing_galera.cpp | 6 +- maxscale-system-test/mariadb_func.h | 8 +- maxscale-system-test/mariadb_nodes.cpp | 11 +- maxscale-system-test/mariadb_nodes.h | 4 +- maxscale-system-test/maxadmin_operations.h | 4 +- maxscale-system-test/maxinfo_func.h | 2 +- maxscale-system-test/maxscales.h | 14 +- maxscale-system-test/mxs1045.cpp | 2 +- maxscale-system-test/mxs1071_maxrows.cpp | 2 +- maxscale-system-test/mxs1073_binlog_enc.cpp | 4 +- maxscale-system-test/mxs118.cpp | 2 +- maxscale-system-test/mxs127.cpp | 2 +- maxscale-system-test/mxs1476.cpp | 2 +- .../mxs244_prepared_stmt_loop.cpp | 2 +- .../mxs280_select_outfile.cpp | 2 +- .../mxs359_error_on_write.cpp | 4 +- .../mxs548_short_session_change_user.cpp | 2 +- maxscale-system-test/mxs564_big_dump.cpp | 2 +- .../mxs621_unreadable_cnf.cpp | 2 +- maxscale-system-test/mxs652_bad_ssl.cpp | 2 +- maxscale-system-test/mxs657_restart.cpp | 2 +- .../mxs657_restart_service.cpp | 2 +- maxscale-system-test/mxs710_bad_socket.cpp | 2 +- .../mxs720_line_with_no_equal.cpp | 4 +- maxscale-system-test/mxs720_wierd_line.cpp | 2 +- .../mxs781_binlog_wrong_passwrd.cpp | 2 +- maxscale-system-test/mxs812_2.cpp | 2 +- maxscale-system-test/mxs822_maxpasswd.cpp | 2 +- maxscale-system-test/mxs827_write_timeout.cpp | 2 +- maxscale-system-test/mxs872_roles.cpp | 6 +- maxscale-system-test/mysqlmon_multimaster.cpp | 4 +- maxscale-system-test/nodes.h | 2 +- maxscale-system-test/rds_vpc.h | 2 +- .../readconnrouter_master.cpp | 2 +- maxscale-system-test/readconnrouter_slave.cpp | 2 +- maxscale-system-test/regexfilter1.cpp | 2 +- maxscale-system-test/rw_select_insert.cpp | 4 +- maxscale-system-test/ses_bigmem.cpp | 2 +- maxscale-system-test/setup_binlog.cpp | 2 +- maxscale-system-test/short_sessions.cpp | 2 +- maxscale-system-test/show_monitor_crash.cpp | 2 +- maxscale-system-test/slave_failover.cpp | 2 +- maxscale-system-test/slave_lag.cpp | 2 +- maxscale-system-test/sql_const.h | 2 +- maxscale-system-test/sql_queries.cpp | 2 +- maxscale-system-test/sql_t1.h | 2 +- maxscale-system-test/sysbench_commands.h | 2 +- maxscale-system-test/test_binlog_fnc.h | 2 +- maxscale-system-test/testconnections.cpp | 24 +- maxscale-system-test/testconnections.h | 38 +- maxutils/maxbase/include/maxbase/cdefs.h | 6 +- maxutils/maxbase/src/logger.cc | 2 +- .../qc_sqlite/builtin_functions.c | 23 +- .../qc_sqlite/builtin_functions.h | 6 +- query_classifier/qc_sqlite/qc_sqlite.cc | 953 ++++++++++-------- rabbitmq_consumer/inih/cpp/INIReader.h | 2 +- server/core/config.cc | 216 ++-- server/core/config_runtime.cc | 9 +- server/core/dcb.cc | 8 +- server/core/load_utils.cc | 6 +- server/core/monitor.cc | 28 +- server/core/queryclassifier.cc | 6 +- server/core/server.cc | 18 +- server/core/service.cc | 4 +- server/core/session.cc | 5 +- server/core/test/test_buffer.cc | 4 +- server/core/test/test_modutil.cc | 14 +- server/core/test/test_trxtracking.cc | 40 +- server/inih/cpp/INIReader.h | 2 +- .../CDCPlainAuth/cdc_plain_auth.cc | 10 +- .../GSSAPI/GSSAPIAuth/gssapi_auth.cc | 6 +- .../GSSAPIBackendAuth/gssapi_backend_auth.cc | 4 +- .../authenticator/HTTPAuth/http_auth.cc | 4 +- .../MaxAdminAuth/max_admin_auth.cc | 4 +- .../authenticator/MySQLAuth/dbusers.cc | 2 +- .../authenticator/MySQLAuth/mysql_auth.cc | 4 +- .../authenticator/PAM/PAMAuth/pam_auth.cc | 4 +- .../PAM/PAMAuth/pam_client_session.cc | 2 +- .../PAM/PAMBackendAuth/pam_backend_auth.cc | 4 +- .../binlogfilter/binlogfiltersession.cc | 4 +- .../modules/filter/cache/cache_storage_api.h | 2 +- server/modules/filter/cache/cachefilter.h | 2 +- server/modules/filter/cache/rules.cc | 2 +- server/modules/filter/ccrfilter/ccrfilter.cc | 14 +- .../modules/filter/dbfwfilter/dbfwfilter.cc | 10 +- .../filter/insertstream/insertstream.cc | 30 +- server/modules/filter/luafilter/luafilter.cc | 4 +- .../modules/filter/masking/maskingfilter.cc | 9 +- server/modules/filter/masking/maskingrules.cc | 6 +- server/modules/filter/maxrows/maxrows.cc | 3 +- server/modules/filter/mqfilter/mqfilter.cc | 44 +- .../namedserverfilter/namedserverfilter.cc | 14 +- server/modules/filter/qlafilter/qlafilter.cc | 18 +- .../modules/filter/regexfilter/regexfilter.cc | 60 +- .../filter/throttlefilter/throttlefilter.cc | 3 +- server/modules/filter/topfilter/topfilter.cc | 31 +- server/modules/filter/tpmfilter/tpmfilter.cc | 27 +- .../monitor/mariadbmon/cluster_discovery.cc | 2 +- .../modules/monitor/mariadbmon/mariadbmon.cc | 164 ++- .../modules/monitor/mariadbmon/mariadbmon.hh | 70 +- .../monitor/mariadbmon/mariadbserver.cc | 12 +- .../monitor/mariadbmon/mariadbserver.hh | 10 +- .../mariadbmon/test/test_cycle_find.cc | 16 +- server/modules/monitor/mmmon/mmmon.cc | 6 +- server/modules/protocol/HTTPD/httpd.h | 2 +- .../MySQL/mariadbbackend/mysql_backend.cc | 6 +- .../MySQL/mariadbclient/mysql_client.cc | 6 +- .../modules/routing/avrorouter/avro_main.cc | 24 +- .../modules/routing/avrorouter/avrorouter.hh | 8 +- server/modules/routing/avrorouter/rpl.hh | 4 +- .../avrorouter/test/test_alter_parsing.cc | 125 +-- server/modules/routing/binlogrouter/blr.cc | 61 +- .../routing/binlogrouter/blr_master.cc | 4 +- .../modules/routing/binlogrouter/blr_slave.cc | 15 +- .../routing/binlogrouter/maxbinlogcheck.cc | 22 +- .../routing/binlogrouter/test/testbinlog.cc | 14 +- server/modules/routing/debugcli/debugcmd.cc | 48 +- .../routing/readconnroute/readconnroute.cc | 4 +- .../routing/readwritesplit/readwritesplit.cc | 72 +- .../readwritesplit/rwsplit_select_backends.cc | 2 +- .../routing/readwritesplit/rwsplitsession.hh | 98 +- 183 files changed, 1865 insertions(+), 1695 deletions(-) diff --git a/include/maxscale/authenticator.h b/include/maxscale/authenticator.h index 1971b123f..54ee35099 100644 --- a/include/maxscale/authenticator.h +++ b/include/maxscale/authenticator.h @@ -171,40 +171,40 @@ typedef enum ((s) == MXS_AUTH_STATE_INIT ? "MXS_AUTH_STATE_INIT" \ : ((s) == MXS_AUTH_STATE_PENDING_CONNECT ? "MXS_AUTH_STATE_PENDING_CONNECT" \ : ((s) \ - == MXS_AUTH_STATE_CONNECTED ? \ - "MXS_AUTH_STATE_CONNECTED" \ - : (( \ - s) \ - == \ - MXS_AUTH_STATE_MESSAGE_READ \ - ? \ - "MXS_AUTH_STATE_MESSAGE_READ" \ - : (( \ - s) \ - == \ - MXS_AUTH_STATE_RESPONSE_SENT \ - ? \ - "MXS_AUTH_STATE_RESPONSE_SENT" \ - : (( \ - s) \ - == \ - MXS_AUTH_STATE_FAILED \ - ? \ - "MXS_AUTH_STATE_FAILED" \ - : (( \ - s) \ - == \ - MXS_AUTH_STATE_HANDSHAKE_FAILED \ - ? \ - "MXS_AUTH_STATE_HANDSHAKE_FAILED" \ - : (( \ - s) \ - == \ - MXS_AUTH_STATE_COMPLETE \ - ? \ - "MXS_AUTH_STATE_COMPLETE" \ - : \ - "UNKNOWN AUTH STATE")))))))) + == MXS_AUTH_STATE_CONNECTED \ + ? "MXS_AUTH_STATE_CONNECTED" \ + : (( \ + s) \ + == \ + MXS_AUTH_STATE_MESSAGE_READ \ + ? \ + "MXS_AUTH_STATE_MESSAGE_READ" \ + : (( \ + s) \ + == \ + MXS_AUTH_STATE_RESPONSE_SENT \ + ? \ + "MXS_AUTH_STATE_RESPONSE_SENT" \ + : (( \ + s) \ + == \ + MXS_AUTH_STATE_FAILED \ + ? \ + "MXS_AUTH_STATE_FAILED" \ + : (( \ + s) \ + == \ + MXS_AUTH_STATE_HANDSHAKE_FAILED \ + ? \ + "MXS_AUTH_STATE_HANDSHAKE_FAILED" \ + : (( \ + s) \ + == \ + MXS_AUTH_STATE_COMPLETE \ + ? \ + "MXS_AUTH_STATE_COMPLETE" \ + : \ + "UNKNOWN AUTH STATE")))))))) /** * The MXS_AUTHENTICATOR version data. The following should be updated whenever diff --git a/include/maxscale/config.h b/include/maxscale/config.h index 8a2930b5d..db0f337c7 100644 --- a/include/maxscale/config.h +++ b/include/maxscale/config.h @@ -242,53 +242,53 @@ typedef struct config_context */ typedef struct { - bool config_check; /**< Only check config */ - int n_threads; /**< Number of polling threads */ - size_t thread_stack_size; /**< The stack size of each worker thread */ - char* version_string; /**< The version string of embedded db library */ - char release_string[RELEASE_STR_LENGTH]; /**< The release name string of the system */ - char sysname[SYSNAME_LEN]; /**< The OS name of the system */ - uint8_t mac_sha1[SHA_DIGEST_LENGTH]; /**< The SHA1 digest of an interface MAC address - * */ - unsigned int n_nbpoll; /**< Tune number of non-blocking polls */ - unsigned int pollsleep; /**< Wait time in blocking polls */ - int syslog; /**< Log to syslog */ - int maxlog; /**< Log to MaxScale's own logs */ - unsigned int auth_conn_timeout; /**< Connection timeout for the user - * authentication */ - unsigned int auth_read_timeout; /**< Read timeout for the user authentication */ - unsigned int auth_write_timeout; /**< Write timeout for the user authentication */ - bool skip_permission_checks; /**< Skip service and monitor permission checks */ - int32_t passive; /**< True if MaxScale is in passive mode */ - int64_t promoted_at; /**< Time when this Maxscale instance was - * promoted from a passive to an active */ - char qc_name[PATH_MAX]; /**< The name of the query classifier to load */ - char* qc_args; /**< Arguments for the query classifier */ - QC_CACHE_PROPERTIES qc_cache_properties; /**< The query classifier cache properties. */ - qc_sql_mode_t qc_sql_mode; /**< The query classifier sql mode */ - char admin_host[MAX_ADMIN_HOST_LEN]; /**< Admin interface host */ - uint16_t admin_port; /**< Admin interface port */ - bool admin_auth; /**< Admin interface authentication */ - bool admin_enabled; /**< Admin interface is enabled */ - bool admin_log_auth_failures; /**< Log admin interface authentication failures - * */ - char admin_ssl_key[PATH_MAX]; /**< Admin SSL key */ - char admin_ssl_cert[PATH_MAX]; /**< Admin SSL cert */ - char admin_ssl_ca_cert[PATH_MAX]; /**< Admin SSL CA cert */ - int query_retries; /**< Number of times a interrupted query is - * retried */ - time_t query_retry_timeout; /**< Timeout for query retries */ - bool substitute_variables; /**< Should environment variables be substituted - * */ - char* local_address; /**< Local address to use when connecting */ - time_t users_refresh_time; /**< How often the users can be refreshed */ - uint64_t writeq_high_water; /**< High water mark of dcb write queue */ - uint64_t writeq_low_water; /**< Low water mark of dcb write queue */ - char peer_hosts[MAX_ADMIN_HOST_LEN]; /**< The protocol, address and port for peers - * (currently only one) */ - char peer_user[MAX_ADMIN_HOST_LEN]; /**< Username for maxscale-to-maxscale traffic */ - char peer_password[MAX_ADMIN_HOST_LEN]; /**< Password for maxscale-to-maxscale traffic */ - mxb_log_target_t log_target; /**< Log type */ + bool config_check; /**< Only check config */ + int n_threads; /**< Number of polling threads */ + size_t thread_stack_size; /**< The stack size of each worker thread */ + char* version_string; /**< The version string of embedded db library */ + char release_string[RELEASE_STR_LENGTH]; /**< The release name string of the system */ + char sysname[SYSNAME_LEN]; /**< The OS name of the system */ + uint8_t mac_sha1[SHA_DIGEST_LENGTH]; /**< The SHA1 digest of an interface MAC address + * */ + unsigned int n_nbpoll; /**< Tune number of non-blocking polls */ + unsigned int pollsleep; /**< Wait time in blocking polls */ + int syslog; /**< Log to syslog */ + int maxlog; /**< Log to MaxScale's own logs */ + unsigned int auth_conn_timeout; /**< Connection timeout for the user + * authentication */ + unsigned int auth_read_timeout; /**< Read timeout for the user authentication */ + unsigned int auth_write_timeout; /**< Write timeout for the user authentication */ + bool skip_permission_checks; /**< Skip service and monitor permission checks */ + int32_t passive; /**< True if MaxScale is in passive mode */ + int64_t promoted_at; /**< Time when this Maxscale instance was + * promoted from a passive to an active */ + char qc_name[PATH_MAX]; /**< The name of the query classifier to load */ + char* qc_args; /**< Arguments for the query classifier */ + QC_CACHE_PROPERTIES qc_cache_properties; /**< The query classifier cache properties. */ + qc_sql_mode_t qc_sql_mode; /**< The query classifier sql mode */ + char admin_host[MAX_ADMIN_HOST_LEN]; /**< Admin interface host */ + uint16_t admin_port; /**< Admin interface port */ + bool admin_auth; /**< Admin interface authentication */ + bool admin_enabled; /**< Admin interface is enabled */ + bool admin_log_auth_failures; /**< Log admin interface authentication failures + * */ + char admin_ssl_key[PATH_MAX]; /**< Admin SSL key */ + char admin_ssl_cert[PATH_MAX]; /**< Admin SSL cert */ + char admin_ssl_ca_cert[PATH_MAX]; /**< Admin SSL CA cert */ + int query_retries; /**< Number of times a interrupted query is + * retried */ + time_t query_retry_timeout; /**< Timeout for query retries */ + bool substitute_variables; /**< Should environment variables be substituted + * */ + char* local_address; /**< Local address to use when connecting */ + time_t users_refresh_time; /**< How often the users can be refreshed */ + uint64_t writeq_high_water; /**< High water mark of dcb write queue */ + uint64_t writeq_low_water; /**< Low water mark of dcb write queue */ + char peer_hosts[MAX_ADMIN_HOST_LEN]; /**< The protocol, address and port for peers + * (currently only one) */ + char peer_user[MAX_ADMIN_HOST_LEN]; /**< Username for maxscale-to-maxscale traffic */ + char peer_password[MAX_ADMIN_HOST_LEN]; /**< Password for maxscale-to-maxscale traffic */ + mxb_log_target_t log_target; /**< Log type */ } MXS_CONFIG; /** diff --git a/include/maxscale/dcb.h b/include/maxscale/dcb.h index f44a6d9e3..822589760 100644 --- a/include/maxscale/dcb.h +++ b/include/maxscale/dcb.h @@ -102,16 +102,16 @@ typedef enum ((r) == DCB_ROLE_SERVICE_LISTENER ? "DCB_ROLE_SERVICE_LISTENER" \ : ((r) == DCB_ROLE_CLIENT_HANDLER ? "DCB_ROLE_CLIENT_HANDLER" \ : ((r) \ - == DCB_ROLE_BACKEND_HANDLER ? \ - "DCB_ROLE_BACKEND_HANDLER" \ - : (( \ - r) \ - == \ - DCB_ROLE_INTERNAL \ - ? \ - "DCB_ROLE_INTERNAL" \ - : \ - "UNKNOWN DCB ROLE")))) + == DCB_ROLE_BACKEND_HANDLER \ + ? "DCB_ROLE_BACKEND_HANDLER" \ + : (( \ + r) \ + == \ + DCB_ROLE_INTERNAL \ + ? \ + "DCB_ROLE_INTERNAL" \ + : \ + "UNKNOWN DCB ROLE")))) #define DCB_STRTYPE(dcb) \ (dcb->dcb_role == DCB_ROLE_CLIENT_HANDLER ? "Client DCB" \ @@ -193,14 +193,14 @@ typedef struct dcb MXS_PROTOCOL func; /**< The protocol functions for this descriptor */ MXS_AUTHENTICATOR authfunc; /**< The authenticator functions for this descriptor * */ - uint32_t writeqlen; /**< Current number of byes in the write queue */ - uint32_t high_water; /**< High water mark of write queue */ - uint32_t low_water; /**< Low water mark of write queue */ - GWBUF* writeq; /**< Write Data Queue */ - GWBUF* delayq; /**< Delay Backend Write Data Queue */ - GWBUF* readq; /**< Read queue for storing incomplete reads */ - GWBUF* fakeq; /**< Fake event queue for generated events */ - uint32_t fake_event; /**< Fake event to be delivered to handler */ + uint32_t writeqlen; /**< Current number of byes in the write queue */ + uint32_t high_water; /**< High water mark of write queue */ + uint32_t low_water; /**< Low water mark of write queue */ + GWBUF* writeq; /**< Write Data Queue */ + GWBUF* delayq; /**< Delay Backend Write Data Queue */ + GWBUF* readq; /**< Read queue for storing incomplete reads */ + GWBUF* fakeq; /**< Fake event queue for generated events */ + uint32_t fake_event; /**< Fake event to be delivered to handler */ DCBSTATS stats; /**< DCB related statistics */ struct dcb* nextpersistent; /**< Next DCB in the persistent pool for SERVER */ diff --git a/include/maxscale/filter.h b/include/maxscale/filter.h index 077138f25..6a24311bd 100644 --- a/include/maxscale/filter.h +++ b/include/maxscale/filter.h @@ -88,7 +88,7 @@ typedef struct mxs_filter_object * * @return New filter instance on NULL on error */ - MXS_FILTER*(*createInstance)(const char* name, MXS_CONFIG_PARAMETER* params); + MXS_FILTER*(*createInstance)(const char* name, MXS_CONFIG_PARAMETER * params); /** * Called to create a new user session within the filter @@ -103,7 +103,7 @@ typedef struct mxs_filter_object * * @return New filter session or NULL on error */ - MXS_FILTER_SESSION*(*newSession)(MXS_FILTER * instance, MXS_SESSION* session); + MXS_FILTER_SESSION*(*newSession)(MXS_FILTER * instance, MXS_SESSION * session); /** * @brief Called when a session is closed @@ -113,7 +113,7 @@ typedef struct mxs_filter_object * @param instance Filter instance * @param fsession Filter session */ - void (* closeSession)(MXS_FILTER* instance, MXS_FILTER_SESSION* fsession); + void (* closeSession)(MXS_FILTER * instance, MXS_FILTER_SESSION * fsession); /** * @brief Called when a session is freed @@ -123,7 +123,7 @@ typedef struct mxs_filter_object * @param instance Filter instance * @param fsession Filter session */ - void (* freeSession)(MXS_FILTER* instance, MXS_FILTER_SESSION* fsession); + void (* freeSession)(MXS_FILTER * instance, MXS_FILTER_SESSION * fsession); /** * @brief Sets the downstream component of the filter pipeline @@ -131,7 +131,7 @@ typedef struct mxs_filter_object * @param instance Filter instance * @param fsession Filter session */ - void (* setDownstream)(MXS_FILTER* instance, MXS_FILTER_SESSION* fsession, MXS_DOWNSTREAM* downstream); + void (* setDownstream)(MXS_FILTER * instance, MXS_FILTER_SESSION * fsession, MXS_DOWNSTREAM * downstream); /** * @brief Sets the upstream component of the filter pipeline @@ -139,7 +139,7 @@ typedef struct mxs_filter_object * @param instance Filter instance * @param fsession Filter session */ - void (* setUpstream)(MXS_FILTER* instance, MXS_FILTER_SESSION* fsession, MXS_UPSTREAM* downstream); + void (* setUpstream)(MXS_FILTER * instance, MXS_FILTER_SESSION * fsession, MXS_UPSTREAM * downstream); /** * @brief Called on each query that requires routing @@ -176,7 +176,7 @@ typedef struct mxs_filter_object * @param fsession Filter session, NULL if general information about the filter is queried * @param dcb DCB where the diagnostic information should be written */ - void (* diagnostics)(MXS_FILTER* instance, MXS_FILTER_SESSION* fsession, DCB* dcb); + void (* diagnostics)(MXS_FILTER * instance, MXS_FILTER_SESSION * fsession, DCB * dcb); /** * @brief Called for diagnostic output @@ -188,7 +188,7 @@ typedef struct mxs_filter_object * * @see jansson.h */ - json_t* (*diagnostics_json)(const MXS_FILTER * instance, const MXS_FILTER_SESSION* fsession); + json_t* (*diagnostics_json)(const MXS_FILTER * instance, const MXS_FILTER_SESSION * fsession); /** * @brief Called to obtain the capabilities of the filter @@ -204,7 +204,7 @@ typedef struct mxs_filter_object * * @param instance Filter instance */ - void (* destroyInstance)(MXS_FILTER* instance); + void (* destroyInstance)(MXS_FILTER * instance); } MXS_FILTER_OBJECT; /** diff --git a/include/maxscale/hint.h b/include/maxscale/hint.h index f64a0048a..83f48d7fb 100644 --- a/include/maxscale/hint.h +++ b/include/maxscale/hint.h @@ -38,33 +38,33 @@ typedef enum (t == HINT_ROUTE_TO_MASTER ? "HINT_ROUTE_TO_MASTER" \ : ((t) == HINT_ROUTE_TO_SLAVE ? "HINT_ROUTE_TO_SLAVE" \ : ((t) \ - == HINT_ROUTE_TO_NAMED_SERVER ? \ - "HINT_ROUTE_TO_NAMED_SERVER" \ - : ((t) \ - == \ - HINT_ROUTE_TO_UPTODATE_SERVER \ - ? \ - "HINT_ROUTE_TO_UPTODATE_SERVER" \ - : (( \ - t) \ - == \ - HINT_ROUTE_TO_ALL \ - ? \ - "HINT_ROUTE_TO_ALL" \ - : (( \ - t) \ - == \ - HINT_ROUTE_TO_LAST_USED \ - ? \ - "HINT_ROUTE_TO_LAST_USED" \ - : (( \ - t) \ - == \ - HINT_PARAMETER \ - ? \ - "HINT_PARAMETER" \ - : \ - "UNKNOWN HINT TYPE"))))))) + == HINT_ROUTE_TO_NAMED_SERVER \ + ? "HINT_ROUTE_TO_NAMED_SERVER" \ + : ((t) \ + == \ + HINT_ROUTE_TO_UPTODATE_SERVER \ + ? \ + "HINT_ROUTE_TO_UPTODATE_SERVER" \ + : (( \ + t) \ + == \ + HINT_ROUTE_TO_ALL \ + ? \ + "HINT_ROUTE_TO_ALL" \ + : (( \ + t) \ + == \ + HINT_ROUTE_TO_LAST_USED \ + ? \ + "HINT_ROUTE_TO_LAST_USED" \ + : (( \ + t) \ + == \ + HINT_PARAMETER \ + ? \ + "HINT_PARAMETER" \ + : \ + "UNKNOWN HINT TYPE"))))))) /** * A generic hint. diff --git a/include/maxscale/listener.h b/include/maxscale/listener.h index 3112d6f13..c3b14be70 100644 --- a/include/maxscale/listener.h +++ b/include/maxscale/listener.h @@ -34,18 +34,18 @@ struct service; */ typedef struct servlistener { - char* name; /**< Name of the listener */ - char* protocol; /**< Protocol module to load */ - unsigned short port; /**< Port to listen on */ - char* address; /**< Address to listen with */ - char* authenticator;/**< Name of authenticator */ - char* auth_options; /**< Authenticator options */ - void* auth_instance;/**< Authenticator instance created in MXS_AUTHENTICATOR::initialize() - * */ - SSL_LISTENER* ssl; /**< Structure of SSL data or NULL */ - struct dcb* listener; /**< The DCB for the listener */ - struct users* users; /**< The user data for this listener */ - struct service* service; /**< The service which used by this listener */ + char* name; /**< Name of the listener */ + char* protocol; /**< Protocol module to load */ + unsigned short port; /**< Port to listen on */ + char* address; /**< Address to listen with */ + char* authenticator; /**< Name of authenticator */ + char* auth_options; /**< Authenticator options */ + void* auth_instance; /**< Authenticator instance created in MXS_AUTHENTICATOR::initialize() + * */ + SSL_LISTENER* ssl; /**< Structure of SSL data or NULL */ + struct dcb* listener; /**< The DCB for the listener */ + struct users* users; /**< The user data for this listener */ + struct service* service; /**< The service which used by this listener */ SPINLOCK lock; int active; /**< True if the port has not been deleted */ struct servlistener* next; /**< Next service protocol */ diff --git a/include/maxscale/modinfo.h b/include/maxscale/modinfo.h index bfcb419df..a8bd30aa4 100644 --- a/include/maxscale/modinfo.h +++ b/include/maxscale/modinfo.h @@ -128,8 +128,8 @@ typedef struct mxs_module_param enum mxs_module_param_type type; /**< Type of the parameter */ const char* default_value; /**< Default value for the parameter, NULL for no default * value */ - uint64_t options; /**< Parameter options */ - const MXS_ENUM_VALUE* accepted_values; /**< Only for enum values */ + uint64_t options; /**< Parameter options */ + const MXS_ENUM_VALUE* accepted_values; /**< Only for enum values */ } MXS_MODULE_PARAM; /** Maximum number of parameters that modules can declare */ diff --git a/include/maxscale/monitor.h b/include/maxscale/monitor.h index 3d80cface..3fe2de6c1 100644 --- a/include/maxscale/monitor.h +++ b/include/maxscale/monitor.h @@ -90,7 +90,7 @@ typedef struct mxs_monitor_api * * @param monitor The monitor object. */ - void (* destroyInstance)(MXS_MONITOR_INSTANCE* monitor); + void (* destroyInstance)(MXS_MONITOR_INSTANCE * monitor); /** * @brief Start the monitor @@ -104,8 +104,8 @@ typedef struct mxs_monitor_api * * @return True, if the monitor could be started, false otherwise. */ - bool (* startMonitor)(MXS_MONITOR_INSTANCE* monitor, - const MXS_CONFIG_PARAMETER* params); + bool (* startMonitor)(MXS_MONITOR_INSTANCE * monitor, + const MXS_CONFIG_PARAMETER * params); /** * @brief Stop the monitor @@ -115,7 +115,7 @@ typedef struct mxs_monitor_api * * @param monitor The monitor object */ - void (* stopMonitor)(MXS_MONITOR_INSTANCE* monitor); + void (* stopMonitor)(MXS_MONITOR_INSTANCE * monitor); /** * @brief Write diagnostic information to a DCB. @@ -123,7 +123,7 @@ typedef struct mxs_monitor_api * @param monitor The monitor object. * @param dcb The dcb to write to. */ - void (* diagnostics)(const MXS_MONITOR_INSTANCE* monitor, DCB* dcb); + void (* diagnostics)(const MXS_MONITOR_INSTANCE * monitor, DCB * dcb); /** * @brief Return diagnostic information about the monitor @@ -244,20 +244,20 @@ struct mxs_monitor int connect_attempts; /**< How many times a connection is attempted */ int read_timeout; /**< Timeout in seconds to read from the server. * There are retries and the total effective - *timeout + * timeout * value is three times the option value. */ int write_timeout; /**< Timeout in seconds for each attempt to write * to the server. * There are retries and the total effective - *timeout value is + * timeout value is * two times the option value. */ - MXS_MONITOR_API* api; /**< The monitor api */ - char* module_name; /**< Name of the monitor module */ - MXS_MONITOR_INSTANCE* instance; /**< Instance returned from startMonitor */ - size_t interval; /**< The monitor interval */ - int check_maintenance_flag; /**< Set when admin requests a maintenance status + MXS_MONITOR_API* api; /**< The monitor api */ + char* module_name; /**< Name of the monitor module */ + MXS_MONITOR_INSTANCE* instance; /**< Instance returned from startMonitor */ + size_t interval; /**< The monitor interval */ + int check_maintenance_flag; /**< Set when admin requests a maintenance status * change. */ bool active; /**< True if monitor is active */ time_t journal_max_age; /**< Maximum age of journal file */ @@ -268,8 +268,8 @@ struct mxs_monitor MxsDiskSpaceThreshold* disk_space_threshold; /**< Disk space thresholds */ int64_t disk_space_check_interval; /**< How often should a disk space check be made * at most. */ - uint64_t ticks; /**< Number of performed monitoring intervals */ - struct mxs_monitor* next; /**< Next monitor in the linked list */ + uint64_t ticks; /**< Number of performed monitoring intervals */ + struct mxs_monitor* next; /**< Next monitor in the linked list */ }; /** diff --git a/include/maxscale/protocol/mysql.h b/include/maxscale/protocol/mysql.h index 35b50ec3f..4ce9cda88 100644 --- a/include/maxscale/protocol/mysql.h +++ b/include/maxscale/protocol/mysql.h @@ -219,37 +219,37 @@ typedef enum GW_MYSQL_CAPABILITIES_SSL_VERIFY_SERVER_CERT = (1 << 30), GW_MYSQL_CAPABILITIES_REMEMBER_OPTIONS = (1 << 31), GW_MYSQL_CAPABILITIES_CLIENT = ( - GW_MYSQL_CAPABILITIES_CLIENT_MYSQL - | GW_MYSQL_CAPABILITIES_FOUND_ROWS - | GW_MYSQL_CAPABILITIES_LONG_FLAG - | GW_MYSQL_CAPABILITIES_CONNECT_WITH_DB - | GW_MYSQL_CAPABILITIES_LOCAL_FILES - | GW_MYSQL_CAPABILITIES_PLUGIN_AUTH - | GW_MYSQL_CAPABILITIES_TRANSACTIONS - | GW_MYSQL_CAPABILITIES_PROTOCOL_41 - | GW_MYSQL_CAPABILITIES_MULTI_STATEMENTS - | GW_MYSQL_CAPABILITIES_MULTI_RESULTS - | GW_MYSQL_CAPABILITIES_PS_MULTI_RESULTS - | GW_MYSQL_CAPABILITIES_SECURE_CONNECTION), + GW_MYSQL_CAPABILITIES_CLIENT_MYSQL + | GW_MYSQL_CAPABILITIES_FOUND_ROWS + | GW_MYSQL_CAPABILITIES_LONG_FLAG + | GW_MYSQL_CAPABILITIES_CONNECT_WITH_DB + | GW_MYSQL_CAPABILITIES_LOCAL_FILES + | GW_MYSQL_CAPABILITIES_PLUGIN_AUTH + | GW_MYSQL_CAPABILITIES_TRANSACTIONS + | GW_MYSQL_CAPABILITIES_PROTOCOL_41 + | GW_MYSQL_CAPABILITIES_MULTI_STATEMENTS + | GW_MYSQL_CAPABILITIES_MULTI_RESULTS + | GW_MYSQL_CAPABILITIES_PS_MULTI_RESULTS + | GW_MYSQL_CAPABILITIES_SECURE_CONNECTION), GW_MYSQL_CAPABILITIES_SERVER = ( - GW_MYSQL_CAPABILITIES_CLIENT_MYSQL - | GW_MYSQL_CAPABILITIES_FOUND_ROWS - | GW_MYSQL_CAPABILITIES_LONG_FLAG - | GW_MYSQL_CAPABILITIES_CONNECT_WITH_DB - | GW_MYSQL_CAPABILITIES_NO_SCHEMA - | GW_MYSQL_CAPABILITIES_ODBC - | GW_MYSQL_CAPABILITIES_LOCAL_FILES - | GW_MYSQL_CAPABILITIES_IGNORE_SPACE - | GW_MYSQL_CAPABILITIES_PROTOCOL_41 - | GW_MYSQL_CAPABILITIES_INTERACTIVE - | GW_MYSQL_CAPABILITIES_IGNORE_SIGPIPE - | GW_MYSQL_CAPABILITIES_TRANSACTIONS - | GW_MYSQL_CAPABILITIES_RESERVED - | GW_MYSQL_CAPABILITIES_SECURE_CONNECTION - | GW_MYSQL_CAPABILITIES_MULTI_STATEMENTS - | GW_MYSQL_CAPABILITIES_MULTI_RESULTS - | GW_MYSQL_CAPABILITIES_PS_MULTI_RESULTS - | GW_MYSQL_CAPABILITIES_PLUGIN_AUTH), + GW_MYSQL_CAPABILITIES_CLIENT_MYSQL + | GW_MYSQL_CAPABILITIES_FOUND_ROWS + | GW_MYSQL_CAPABILITIES_LONG_FLAG + | GW_MYSQL_CAPABILITIES_CONNECT_WITH_DB + | GW_MYSQL_CAPABILITIES_NO_SCHEMA + | GW_MYSQL_CAPABILITIES_ODBC + | GW_MYSQL_CAPABILITIES_LOCAL_FILES + | GW_MYSQL_CAPABILITIES_IGNORE_SPACE + | GW_MYSQL_CAPABILITIES_PROTOCOL_41 + | GW_MYSQL_CAPABILITIES_INTERACTIVE + | GW_MYSQL_CAPABILITIES_IGNORE_SIGPIPE + | GW_MYSQL_CAPABILITIES_TRANSACTIONS + | GW_MYSQL_CAPABILITIES_RESERVED + | GW_MYSQL_CAPABILITIES_SECURE_CONNECTION + | GW_MYSQL_CAPABILITIES_MULTI_STATEMENTS + | GW_MYSQL_CAPABILITIES_MULTI_RESULTS + | GW_MYSQL_CAPABILITIES_PS_MULTI_RESULTS + | GW_MYSQL_CAPABILITIES_PLUGIN_AUTH), } gw_mysql_capabilities_t; /** @@ -332,10 +332,10 @@ typedef struct GWBUF* stored_query; /*< Temporarily stored queries */ bool collect_result; /*< Collect the next result set as one buffer */ bool changing_user; - uint32_t num_eof_packets; /*< Encountered eof packet number, used for check - * packet type */ - bool large_query; /*< Whether to ignore the command byte of the next - * packet*/ + uint32_t num_eof_packets; /*< Encountered eof packet number, used for check + * packet type */ + bool large_query; /*< Whether to ignore the command byte of the next + * packet*/ } MySQLProtocol; typedef struct diff --git a/include/maxscale/router.h b/include/maxscale/router.h index 29bcd9c3e..73eb71a0e 100644 --- a/include/maxscale/router.h +++ b/include/maxscale/router.h @@ -94,7 +94,7 @@ typedef struct mxs_router_object * * @return New router instance on NULL on error */ - MXS_ROUTER*(*createInstance)(SERVICE * service, MXS_CONFIG_PARAMETER* params); + MXS_ROUTER*(*createInstance)(SERVICE * service, MXS_CONFIG_PARAMETER * params); /** * Called to create a new user session within the router @@ -109,7 +109,7 @@ typedef struct mxs_router_object * * @return New router session or NULL on error */ - MXS_ROUTER_SESSION*(*newSession)(MXS_ROUTER * instance, MXS_SESSION* session); + MXS_ROUTER_SESSION*(*newSession)(MXS_ROUTER * instance, MXS_SESSION * session); /** * @brief Called when a session is closed @@ -119,7 +119,7 @@ typedef struct mxs_router_object * @param instance Router instance * @param router_session Router session */ - void (* closeSession)(MXS_ROUTER* instance, MXS_ROUTER_SESSION* router_session); + void (* closeSession)(MXS_ROUTER * instance, MXS_ROUTER_SESSION * router_session); /** * @brief Called when a session is freed @@ -129,7 +129,7 @@ typedef struct mxs_router_object * @param instance Router instance * @param router_session Router session */ - void (* freeSession)(MXS_ROUTER* instance, MXS_ROUTER_SESSION* router_session); + void (* freeSession)(MXS_ROUTER * instance, MXS_ROUTER_SESSION * router_session); /** * @brief Called on each query that requires routing @@ -152,7 +152,7 @@ typedef struct mxs_router_object * @param instance Router instance * @param dcb DCB where the diagnostic information should be written */ - void (* diagnostics)(MXS_ROUTER* instance, DCB* dcb); + void (* diagnostics)(MXS_ROUTER * instance, DCB * dcb); /** * @brief Called for diagnostic output @@ -175,10 +175,10 @@ typedef struct mxs_router_object * @param queue Response from the server * @param backend_dcb The backend DCB which responded to the query */ - void (* clientReply)(MXS_ROUTER* instance, - MXS_ROUTER_SESSION* router_session, - GWBUF* queue, - DCB* backend_dcb); + void (* clientReply)(MXS_ROUTER * instance, + MXS_ROUTER_SESSION * router_session, + GWBUF * queue, + DCB * backend_dcb); /** * @brief Called when a backend DCB has failed @@ -191,10 +191,10 @@ typedef struct mxs_router_object * * @param succp Pointer to a `bool` which should be set to true for success or false for error */ - void (* handleError)(MXS_ROUTER* instance, - MXS_ROUTER_SESSION* router_session, - GWBUF* errmsgbuf, - DCB* backend_dcb, + void (* handleError)(MXS_ROUTER * instance, + MXS_ROUTER_SESSION * router_session, + GWBUF * errmsgbuf, + DCB * backend_dcb, mxs_error_action_t action, bool* succp); @@ -212,7 +212,7 @@ typedef struct mxs_router_object * * @param instance Router instance */ - void (* destroyInstance)(MXS_ROUTER* instance); + void (* destroyInstance)(MXS_ROUTER * instance); /** * @brief Configure router instance at runtime @@ -233,7 +233,7 @@ typedef struct mxs_router_object * failed. If reconfiguration failed, the state of the router * instance should not be modified. */ - bool (* configureInstance)(MXS_ROUTER* instance, MXS_CONFIG_PARAMETER* params); + bool (* configureInstance)(MXS_ROUTER * instance, MXS_CONFIG_PARAMETER * params); } MXS_ROUTER_OBJECT; /** diff --git a/include/maxscale/server.h b/include/maxscale/server.h index 4791ecaf6..c1a209b3d 100644 --- a/include/maxscale/server.h +++ b/include/maxscale/server.h @@ -195,26 +195,21 @@ typedef struct server : (server_is_ndb(s) \ ? "RUNNING NDB" \ : (( \ - server_is_running( \ - s) \ + server_is_running(s) \ && \ - server_is_in_maint( \ - s)) \ + server_is_in_maint(s)) \ ? \ "RUNNING MAINTENANCE" \ : ( \ - server_is_relay( \ - s) \ + server_is_relay(s) \ ? \ "RUNNING RELAY" \ : ( \ - server_is_usable( \ - s) \ + server_is_usable(s) \ ? \ "RUNNING (only)" \ : ( \ - server_is_down( \ - s) \ + server_is_down(s) \ ? \ "DOWN" \ : \ @@ -524,7 +519,7 @@ extern void dprintServer(DCB*, const SERVER*); extern void dprintPersistentDCBs(DCB*, const SERVER*); extern void dListServers(DCB*); -int server_response_time_num_samples(const SERVER* server); +int server_response_time_num_samples(const SERVER* server); double server_response_time_average(const SERVER* server); MXS_END_DECLS diff --git a/include/maxscale/server.hh b/include/maxscale/server.hh index 0ab7807ae..824bd97e2 100644 --- a/include/maxscale/server.hh +++ b/include/maxscale/server.hh @@ -32,7 +32,7 @@ bool server_clear_status(SERVER* server, int bit, std::string* errmsg_out = NULL */ inline bool almost_equal_server_scores(double lhs, double rhs) { - constexpr double div = 100; // within 1% of each other. + constexpr double div = 100; // within 1% of each other. return std::abs((long)(lhs - rhs)) < std::abs((long)std::max(lhs, rhs)) * (1 / div); } } diff --git a/include/maxscale/service.h b/include/maxscale/service.h index 2bcaf5db2..ac80c0dab 100644 --- a/include/maxscale/service.h +++ b/include/maxscale/service.h @@ -100,57 +100,57 @@ typedef struct server_ref_t */ typedef struct service { - const char* name; /**< The service name */ - int state; /**< The service state */ - int client_count; /**< Number of connected clients */ - int max_connections; /**< Maximum client connections */ - SERV_LISTENER* ports; /**< Linked list of ports and - * protocols - * that this service will listen on */ - const char* routerModule; /**< Name of router module to use */ - struct mxs_router_object* router; /**< The router we are using */ - struct mxs_router* router_instance; /**< The router instance for this - * service */ - char version_string[MAX_SERVICE_VERSION_LEN]; /**< version string for this service - * listeners */ - SERVER_REF* dbref; /**< server references */ - int n_dbref; /**< Number of server references */ - char user[MAX_SERVICE_USER_LEN]; /**< The user name to use to extract - * information */ - char password[MAX_SERVICE_PASSWORD_LEN]; /**< The authentication data requied - * */ - SERVICE_STATS stats; /**< The service statistics */ - bool enable_root; /**< Allow root user access */ - bool localhost_match_wildcard_host; /**< Match localhost against wildcard - * */ - MXS_CONFIG_PARAMETER* svc_config_param; /**< list of config params and values - * */ - int svc_config_version; /**< Version number of configuration - * */ - bool svc_do_shutdown; /**< tells the service to exit loops - * etc. */ - bool users_from_all; /**< Load users from one server or all - * of them */ - bool strip_db_esc; /**< Remove the '\' characters from - * database names - * when querying them from the server. - *MySQL Workbench seems - * to escape at least the underscore - *character. */ - int64_t conn_idle_timeout; /**< Session timeout in seconds */ - char weightby[MAX_SERVICE_WEIGHTBY_LEN]; /**< Service weighting parameter name - * */ - bool retry_start; /**< If starting of the service should - * be retried later */ - bool log_auth_warnings; /**< Log authentication failures and - * warnings */ - uint64_t capabilities; /**< The capabilities of the service, - * @see enum routing_capability */ - int max_retry_interval; /**< Maximum retry interval */ - bool session_track_trx_state; /**< Get transaction state via session - * track mechanism */ - int active; /**< Whether the service is still - * active */ + const char* name; /**< The service name */ + int state; /**< The service state */ + int client_count; /**< Number of connected clients */ + int max_connections; /**< Maximum client connections */ + SERV_LISTENER* ports; /**< Linked list of ports and + * protocols + * that this service will listen on */ + const char* routerModule; /**< Name of router module to use */ + struct mxs_router_object* router; /**< The router we are using */ + struct mxs_router* router_instance; /**< The router instance for this + * service */ + char version_string[MAX_SERVICE_VERSION_LEN]; /**< version string for this service + * listeners */ + SERVER_REF* dbref; /**< server references */ + int n_dbref; /**< Number of server references */ + char user[MAX_SERVICE_USER_LEN]; /**< The user name to use to extract + * information */ + char password[MAX_SERVICE_PASSWORD_LEN]; /**< The authentication data requied + * */ + SERVICE_STATS stats; /**< The service statistics */ + bool enable_root; /**< Allow root user access */ + bool localhost_match_wildcard_host; /**< Match localhost against wildcard + * */ + MXS_CONFIG_PARAMETER* svc_config_param; /**< list of config params and values + * */ + int svc_config_version; /**< Version number of configuration + * */ + bool svc_do_shutdown; /**< tells the service to exit loops + * etc. */ + bool users_from_all; /**< Load users from one server or all + * of them */ + bool strip_db_esc; /**< Remove the '\' characters from + * database names + * when querying them from the server. + * MySQL Workbench seems + * to escape at least the underscore + * character. */ + int64_t conn_idle_timeout; /**< Session timeout in seconds */ + char weightby[MAX_SERVICE_WEIGHTBY_LEN]; /**< Service weighting parameter name + * */ + bool retry_start; /**< If starting of the service should + * be retried later */ + bool log_auth_warnings; /**< Log authentication failures and + * warnings */ + uint64_t capabilities; /**< The capabilities of the service, + * @see enum routing_capability */ + int max_retry_interval; /**< Maximum retry interval */ + bool session_track_trx_state; /**< Get transaction state via session + * track mechanism */ + int active; /**< Whether the service is still + * active */ } SERVICE; typedef enum count_spec_t diff --git a/include/maxscale/session.h b/include/maxscale/session.h index 33bba17c7..66ddac241 100644 --- a/include/maxscale/session.h +++ b/include/maxscale/session.h @@ -54,45 +54,45 @@ typedef enum ((s) == SESSION_STATE_ALLOC ? "SESSION_STATE_ALLOC" \ : ((s) == SESSION_STATE_READY ? "SESSION_STATE_READY" \ : ((s) \ - == SESSION_STATE_ROUTER_READY ? \ - "SESSION_STATE_ROUTER_READY" \ - : ((s) \ - == \ - SESSION_STATE_STOPPING \ - ? \ - "SESSION_STATE_STOPPING" \ - : (( \ - s) \ - == \ - SESSION_STATE_LISTENER \ - ? \ - "SESSION_STATE_LISTENER" \ - : (( \ - s) \ - == \ - SESSION_STATE_LISTENER_STOPPED \ - ? \ - "SESSION_STATE_LISTENER_STOPPED" \ - : (( \ - s) \ - == \ - SESSION_STATE_TO_BE_FREED \ - ? \ - "SESSION_STATE_TO_BE_FREED" \ - : (( \ - s) \ - == \ - SESSION_STATE_FREE \ - ? \ - "SESSION_STATE_TO_BE_FREE" \ - : (( \ - s) \ - == \ - SESSION_STATE_DUMMY \ - ? \ - "SESSION_STATE_DUMMY" \ - : \ - "SESSION_STATE_UNKNOWN"))))))))) + == SESSION_STATE_ROUTER_READY \ + ? "SESSION_STATE_ROUTER_READY" \ + : ((s) \ + == \ + SESSION_STATE_STOPPING \ + ? \ + "SESSION_STATE_STOPPING" \ + : (( \ + s) \ + == \ + SESSION_STATE_LISTENER \ + ? \ + "SESSION_STATE_LISTENER" \ + : (( \ + s) \ + == \ + SESSION_STATE_LISTENER_STOPPED \ + ? \ + "SESSION_STATE_LISTENER_STOPPED" \ + : (( \ + s) \ + == \ + SESSION_STATE_TO_BE_FREED \ + ? \ + "SESSION_STATE_TO_BE_FREED" \ + : (( \ + s) \ + == \ + SESSION_STATE_FREE \ + ? \ + "SESSION_STATE_TO_BE_FREE" \ + : (( \ + s) \ + == \ + SESSION_STATE_DUMMY \ + ? \ + "SESSION_STATE_DUMMY" \ + : \ + "SESSION_STATE_UNKNOWN"))))))))) typedef enum { diff --git a/include/maxscale/ssl.h b/include/maxscale/ssl.h index 845446482..ceb9d73e1 100644 --- a/include/maxscale/ssl.h +++ b/include/maxscale/ssl.h @@ -58,17 +58,17 @@ typedef enum ssl_method_type typedef struct ssl_listener { SSL_CTX* ctx; - SSL_METHOD* method; /*< SSLv3 or TLS1.0/1.1/1.2 methods - * see: https://www.openssl.org/docs/ssl/SSL_CTX_new.html - **/ - int ssl_cert_verify_depth; /*< SSL certificate verification depth */ - ssl_method_type_t ssl_method_type; /*< Which of the SSLv3 or TLS1.0/1.1/1.2 methods to use */ - char* ssl_cert; /*< SSL certificate */ - char* ssl_key; /*< SSL private key */ - char* ssl_ca_cert; /*< SSL CA certificate */ - bool ssl_init_done; /*< If SSL has already been initialized for this service - * */ - bool ssl_verify_peer_certificate; /*< Enable peer certificate verification */ + SSL_METHOD* method; /*< SSLv3 or TLS1.0/1.1/1.2 methods + * see: https://www.openssl.org/docs/ssl/SSL_CTX_new.html + **/ + int ssl_cert_verify_depth;/*< SSL certificate verification depth */ + ssl_method_type_t ssl_method_type; /*< Which of the SSLv3 or TLS1.0/1.1/1.2 methods to use */ + char* ssl_cert; /*< SSL certificate */ + char* ssl_key; /*< SSL private key */ + char* ssl_ca_cert; /*< SSL CA certificate */ + bool ssl_init_done; /*< If SSL has already been initialized for this service + * */ + bool ssl_verify_peer_certificate; /*< Enable peer certificate verification */ struct ssl_listener * next; /*< Next SSL configuration, currently used to store obsolete configurations */ } SSL_LISTENER; diff --git a/maxscale-system-test/big_load.h b/maxscale-system-test/big_load.h index 80548a359..b804f8aff 100644 --- a/maxscale-system-test/big_load.h +++ b/maxscale-system-test/big_load.h @@ -45,4 +45,4 @@ void load(long* new_inserts, bool galera, bool report_errors); -#endif // BIG_LOAD_H +#endif // BIG_LOAD_H diff --git a/maxscale-system-test/big_transaction.h b/maxscale-system-test/big_transaction.h index a1735d3a1..ccc400d87 100644 --- a/maxscale-system-test/big_transaction.h +++ b/maxscale-system-test/big_transaction.h @@ -14,4 +14,4 @@ */ int big_transaction(MYSQL* conn, int N); -#endif // BIG_TRANSACTION_H +#endif // BIG_TRANSACTION_H diff --git a/maxscale-system-test/binlog_big_transaction.cpp b/maxscale-system-test/binlog_big_transaction.cpp index e3f2cdea9..c55970f14 100644 --- a/maxscale-system-test/binlog_big_transaction.cpp +++ b/maxscale-system-test/binlog_big_transaction.cpp @@ -1,6 +1,6 @@ /** * @file binlog_big_transaction.cpp test of simple binlog router setup and execute a number of big - *transactions + * transactions */ diff --git a/maxscale-system-test/binlog_change_master.cpp b/maxscale-system-test/binlog_change_master.cpp index 4cc7bf9ab..fee8ce869 100644 --- a/maxscale-system-test/binlog_change_master.cpp +++ b/maxscale-system-test/binlog_change_master.cpp @@ -1,6 +1,6 @@ /** * @file binlog_change_master.cpp In the binlog router setup stop Master and promote one of the Slaves to be - *new Master + * new Master * - setup binlog * - start thread wich executes transactions * - block master diff --git a/maxscale-system-test/binlog_failover.cpp b/maxscale-system-test/binlog_failover.cpp index 8255aa5da..eae238878 100644 --- a/maxscale-system-test/binlog_failover.cpp +++ b/maxscale-system-test/binlog_failover.cpp @@ -10,7 +10,7 @@ * - stop all Maxscale machines with STOP SLAVE command * - check which Maxscale machine contains most recent data (let's call this machine 'most_recent_maxscale') * - use CHANGE MASETER on the second Maxscale machine to point it to the Maxscale machine from the previous - *step ('most_recent_maxscale') + * step ('most_recent_maxscale') * - wait until second Maxscale is in sync with 'most_recent_maxscale' (use SHOW MASTER STATUS) * - select new master (HOW??) * - set all Maxscale machines to be a slaves of new master diff --git a/maxscale-system-test/blob_test.h b/maxscale-system-test/blob_test.h index 6ba4e3d92..fddc17d15 100644 --- a/maxscale-system-test/blob_test.h +++ b/maxscale-system-test/blob_test.h @@ -23,7 +23,7 @@ int test_longblob(TestConnections* Test, /** * @brief check_longblob_data Does SELECT against table created by test_longblob() and cheks that data are - *correct + * correct * @param Test TestConnection object * @param conn MYSQL connection handler * @param chunk_size size of one data chunk (in sizeof(long usingned)) @@ -37,4 +37,4 @@ int check_longblob_data(TestConnections* Test, int chunks, int rows); -#endif // BLOB_TEST_H +#endif // BLOB_TEST_H diff --git a/maxscale-system-test/bug469.cpp b/maxscale-system-test/bug469.cpp index bde23a250..32eac7619 100644 --- a/maxscale-system-test/bug469.cpp +++ b/maxscale-system-test/bug469.cpp @@ -1,11 +1,11 @@ /** * @file bug469 bug469 regression test case ("rwsplit counts every connection twice in master - counnection - *counts leak") + * counts leak") * - use maxadmin command "show server server1" and check "Current no. of conns" and "Number of connections" - - *both should be 0 + * both should be 0 * - execute simple query against RWSplit * - use maxadmin command "show server server1" and check "Current no. of conns" (should be 0) and "Number of - *connections" (should be 1) + * connections" (should be 1) */ diff --git a/maxscale-system-test/bug471.cpp b/maxscale-system-test/bug471.cpp index 888f47b45..7989d6ac1 100644 --- a/maxscale-system-test/bug471.cpp +++ b/maxscale-system-test/bug471.cpp @@ -2,7 +2,7 @@ * @file bug471.cpp bug471 regression case ( Routing Hints route to server sometimes doesn't work ) * * - try "select @@server_id; -- maxscale route to server server%d" (where %d - server number) and compares - *result + * result * with "select @@server_id;" sent directly to backend node. * - do it 25 times. */ diff --git a/maxscale-system-test/bug479.cpp b/maxscale-system-test/bug479.cpp index 12518ed88..035aaaf95 100644 --- a/maxscale-system-test/bug479.cpp +++ b/maxscale-system-test/bug479.cpp @@ -2,7 +2,7 @@ * @file bug479.cpp regression case for bug 479 ( Undefined filter reference in MaxScale.cnf causes a crash) * * - Maxscale.cnf with "filters=non existing filter | не существуюший фильтер", cheks error log for warnings - *and + * and * - check if Maxscale is alive */ diff --git a/maxscale-system-test/bug488.cpp b/maxscale-system-test/bug488.cpp index 1a5198cc8..e310d00d2 100644 --- a/maxscale-system-test/bug488.cpp +++ b/maxscale-system-test/bug488.cpp @@ -1,6 +1,6 @@ /** * @file bug488.cpp regression case for bug 488 ("SHOW VARIABLES randomly failing with "Lost connection to - *MySQL server") + * MySQL server") * * - try "SHOW VARIABLES;" 100 times against all Maxscale services * First round: 100 iterations for RWSplit, then ReadConn Master, then ReadConn Slave diff --git a/maxscale-system-test/bug495.cpp b/maxscale-system-test/bug495.cpp index 52cfe682c..9af389725 100644 --- a/maxscale-system-test/bug495.cpp +++ b/maxscale-system-test/bug495.cpp @@ -1,6 +1,6 @@ /** * @file bug495.cpp regression case for bug 495 ( Referring to a nonexisting server in servers=... doesn't - *even raise a warning ) + * even raise a warning ) * * - Maxscale.cnf with "servers= server1, server2,server3 ,server4,server5" * but 'server5' is not defined. Test checks error log for proper error message. diff --git a/maxscale-system-test/bug507.cpp b/maxscale-system-test/bug507.cpp index a050024a9..72a2afcd4 100644 --- a/maxscale-system-test/bug507.cpp +++ b/maxscale-system-test/bug507.cpp @@ -98,17 +98,15 @@ int main(int argc, char* argv[]) char last_insert_id1[1024]; char last_insert_id2[1024]; if (( - find_field( - Test->maxscales->conn_rwsplit[0], - sel1, - "@@server_id", - &last_insert_id1[0]) + find_field(Test->maxscales->conn_rwsplit[0], + sel1, + "@@server_id", + &last_insert_id1[0]) != 0 ) || ( - find_field( - Test->repl->nodes[0], - sel1, - "@@server_id", - &last_insert_id2[0]) + find_field(Test->repl->nodes[0], + sel1, + "@@server_id", + &last_insert_id2[0]) != 0 )) { Test->tprintf("@@server_id fied not found!!\n"); diff --git a/maxscale-system-test/bug509.cpp b/maxscale-system-test/bug509.cpp index e7f7a61b0..035a706af 100644 --- a/maxscale-system-test/bug509.cpp +++ b/maxscale-system-test/bug509.cpp @@ -1,12 +1,12 @@ /** * @file bug509.cpp regression case for bug 509 and 507 ( "Referring to a nonexisting server in servers=... - *doesn't even raise a warning" + * doesn't even raise a warning" * and "rw-split router does not send last_insert_id() to master" ) * * - "CREATE TABLE t2 (id INT(10) NOT NULL AUTO_INCREMENT, x int, PRIMARY KEY (id));", * - do a number of INSERTs first using RWsplit, then directly Galera nodes. * - do "select @@wsrep_node_address, last_insert_id();" and "select last_insert_id(), @@wsrep_node_address;" - *and compares results. + * and compares results. * - do "insert into t2 (x) values (i);" 1000 times and compares results of * "select @@wsrep_node_address, last_insert_id();" and "select last_insert_id(), @@wsrep_node_address;" * @@ -86,17 +86,15 @@ int main(int argc, char* argv[]) char last_insert_id1[1024]; char last_insert_id2[1024]; if (( - find_field( - Test->maxscales->conn_rwsplit[0], - sel1, - "last_insert_id()", - &last_insert_id1[0]) + find_field(Test->maxscales->conn_rwsplit[0], + sel1, + "last_insert_id()", + &last_insert_id1[0]) != 0 ) || ( - find_field( - Test->maxscales->conn_rwsplit[0], - sel2, - "last_insert_id()", - &last_insert_id2[0]) + find_field(Test->maxscales->conn_rwsplit[0], + sel2, + "last_insert_id()", + &last_insert_id2[0]) != 0 )) { Test->tprintf("last_insert_id() fied not found!!\n"); diff --git a/maxscale-system-test/bug529.cpp b/maxscale-system-test/bug529.cpp index 16c24add5..7bbe419c9 100644 --- a/maxscale-system-test/bug529.cpp +++ b/maxscale-system-test/bug529.cpp @@ -5,11 +5,11 @@ * - check number of connections to Master - failure if there are more then 100 connections to master. * - close RWSptit and ReadConn master connections and check connections to master again. * - create 50 ReadConn slave connection in parallel threads, execute "SELECT * FROM t1" ones for every - *connections, then + * connections, then * start using one of connections to create "SELECT" load. * - check number of connections to Master again, wait 5 seconds and check number of connections to * master ones more time: now expecting 0 connections to master (fail if there is a least one connection to - *master). + * master). * - close and reopens all ReadConn slave connections in the main thread and check connections to master again * - close all connection in all threads, close parallel thread * - do final 'connections to master' check diff --git a/maxscale-system-test/bug587.cpp b/maxscale-system-test/bug587.cpp index 5f9622785..e0177d0fb 100644 --- a/maxscale-system-test/bug587.cpp +++ b/maxscale-system-test/bug587.cpp @@ -1,6 +1,6 @@ /** * @file bug587.cpp regression case for the bug 587 ( "Hint filter don't work if listed before regex filter - *in configuration file" ) + * in configuration file" ) * * - Maxscale.cnf * @verbatim diff --git a/maxscale-system-test/bug592.cpp b/maxscale-system-test/bug592.cpp index cfd823500..fd4d57318 100644 --- a/maxscale-system-test/bug592.cpp +++ b/maxscale-system-test/bug592.cpp @@ -2,7 +2,7 @@ * @file bug592.cpp regression case for bug 592 ( "slave in "Running" state breaks authorization" ) MXS-326 * * - stop all slaves: "stop slave;" directly to every node (now they are in "Running" state, not in "Russning, - *Slave") + * Slave") * - via RWSplit "CREATE USER 'test_user'@'%' IDENTIFIED BY 'pass'" * - try to connect using 'test_user' (expecting success) * - start all slaves: "start slave;" directly to every node diff --git a/maxscale-system-test/bug601.cpp b/maxscale-system-test/bug601.cpp index 08d2dfba5..cbbafc09d 100644 --- a/maxscale-system-test/bug601.cpp +++ b/maxscale-system-test/bug601.cpp @@ -1,6 +1,6 @@ /** * @file bug601.cpp regression case for bug 601 ("COM_CHANGE_USER fails with correct user/pwd if executed - *during authentication") + * during authentication") * - configure Maxscale.cnf to use only one thread * - in 100 parallel threads start to open/close session * - do change_user 2000 times diff --git a/maxscale-system-test/bug643.cpp b/maxscale-system-test/bug643.cpp index a9a157e7b..195ad40b8 100644 --- a/maxscale-system-test/bug643.cpp +++ b/maxscale-system-test/bug643.cpp @@ -1,6 +1,6 @@ /** * @file bug643.cpp regression case for bugs 643 ("Hints, RWSplit: MaxScale goes into infinite loop and - *crashes") and bug645 + * crashes") and bug645 * - setup RWSplit in the following way for bug643 * @verbatim * [RW Split Router] diff --git a/maxscale-system-test/bug643_1.cpp b/maxscale-system-test/bug643_1.cpp index 6e86c7318..24b57096a 100644 --- a/maxscale-system-test/bug643_1.cpp +++ b/maxscale-system-test/bug643_1.cpp @@ -1,6 +1,6 @@ /** * @file bug643.cpp regression case for bugs 643 ("Hints, RWSplit: MaxScale goes into infinite loop and - *crashes") and bug645 + * crashes") and bug645 * - setup RWSplit in the following way for bug643 * @verbatim * [hints] diff --git a/maxscale-system-test/bug650.cpp b/maxscale-system-test/bug650.cpp index 025b5b07a..46ebc6848 100644 --- a/maxscale-system-test/bug650.cpp +++ b/maxscale-system-test/bug650.cpp @@ -1,6 +1,6 @@ /** * @file bug650.cpp regression case for bug 650 ("Hints, RWSplit: MaxScale goes into infinite loop and - *crashes") and bug645 + * crashes") and bug645 * - try simple query using all services * - check for errors in the log */ diff --git a/maxscale-system-test/bug653.cpp b/maxscale-system-test/bug653.cpp index bbc97c181..688f1a6fb 100644 --- a/maxscale-system-test/bug653.cpp +++ b/maxscale-system-test/bug653.cpp @@ -1,10 +1,10 @@ /** * @file bug653.cpp regression case for bug 653 ("Memory corruption when users with long hostnames that can - *no the resolved are loaded into MaxScale") + * no the resolved are loaded into MaxScale") * * - CREATE USER *'user_with_very_long_hostname'@'very_long_hostname_that_can_not_be_resolved_and_it_probably_caused_crash.com.net.org' - *IDENTIFIED BY 'old'; + * IDENTIFIED BY 'old'; * - try to connect using user 'user_with_very_long_hostname' * - DROP USER *'user_with_very_long_hostname'@'very_long_hostname_that_can_not_be_resolved_and_it_probably_caused_crash.com.net.org' diff --git a/maxscale-system-test/bug654.cpp b/maxscale-system-test/bug654.cpp index 7fb9c0ceb..0c022202c 100644 --- a/maxscale-system-test/bug654.cpp +++ b/maxscale-system-test/bug654.cpp @@ -1,6 +1,6 @@ /** * @file bug654.cpp regression case for bug654 abd 698 ("maxadm: show dbusers causes SEGFAULT", "Using invalid parameter in many maxadmin commands causes MaxScale to fail") + * quotation> causes SEGFAULT", "Using invalid parameter in many maxadmin commands causes MaxScale to fail") * * - execute maxadmin command show dbusers RW Split Router and show dbusers "RW Split Router" * . execute different maxadmin commands with wrong parameters diff --git a/maxscale-system-test/bug656.cpp b/maxscale-system-test/bug656.cpp index e6111a345..f3ecc3976 100644 --- a/maxscale-system-test/bug656.cpp +++ b/maxscale-system-test/bug656.cpp @@ -1,6 +1,6 @@ /** * @file bug656.cpp Checks Maxscale behaviour in case if Master node is blocked - NOT NEEDED BECAUSE IT IS - *ALREADY CHECKED BY OTHER TESTS!!!! + * ALREADY CHECKED BY OTHER TESTS!!!! * * - ConnecT to RWSplit * - block Mariadb server on Master node by Firewall diff --git a/maxscale-system-test/bug662.cpp b/maxscale-system-test/bug662.cpp index 52b4abc53..ae7502739 100644 --- a/maxscale-system-test/bug662.cpp +++ b/maxscale-system-test/bug662.cpp @@ -1,7 +1,7 @@ /** * @file bug662.cpp regression case for bug 662 ("MaxScale hangs in startup if backend server is not - *responsive"), covers also bug680 ("RWSplit can't load DB user if backend is not available at MaxScale - *start") + * responsive"), covers also bug680 ("RWSplit can't load DB user if backend is not available at MaxScale + * start") * * - Block all Mariadb servers * - Restart MaxScale diff --git a/maxscale-system-test/bug670_sql.h b/maxscale-system-test/bug670_sql.h index 6facb6026..c3cf88f78 100644 --- a/maxscale-system-test/bug670_sql.h +++ b/maxscale-system-test/bug670_sql.h @@ -41,4 +41,4 @@ const char* bug670_sql delete from mysql.t1 where id = 7; \ select 1 as \"endof cycle\" from dual;\n"; -#endif // BUG670_SQL_H +#endif // BUG670_SQL_H diff --git a/maxscale-system-test/bug673.cpp b/maxscale-system-test/bug673.cpp index de8327652..9b9cad231 100644 --- a/maxscale-system-test/bug673.cpp +++ b/maxscale-system-test/bug673.cpp @@ -1,6 +1,6 @@ /** * @file bug673.cpp regression case for bug673 ("MaxScale crashes if "Users table data" is empty and "show - *dbusers" is executed in maxadmin") + * dbusers" is executed in maxadmin") * * - Configure wrong IP for all backends * - Execute maxadmin command show dbusers "RW Split Router" diff --git a/maxscale-system-test/bug681.cpp b/maxscale-system-test/bug681.cpp index a2bc37386..595da8961 100644 --- a/maxscale-system-test/bug681.cpp +++ b/maxscale-system-test/bug681.cpp @@ -1,6 +1,6 @@ /** * @file bug681.cpp - regression test for bug681 ("crash if max_slave_connections=10% and 4 or less backends - *are configured") + * are configured") * * - Configure RWSplit with max_slave_connections=10% * - check ReadConn master and ReadConn slave are alive and RWSplit is not started diff --git a/maxscale-system-test/bug694.cpp b/maxscale-system-test/bug694.cpp index 0d7e552be..351c9efb6 100644 --- a/maxscale-system-test/bug694.cpp +++ b/maxscale-system-test/bug694.cpp @@ -1,6 +1,6 @@ /** * @file bug694.cpp - regression test for bug694 ("RWSplit: SELECT @a:=@a+1 as a, test.b FROM test breaks - *client session") + * client session") * * - set use_sql_variables_in=all in MaxScale.cnf * - connect to readwritesplit router and execute: diff --git a/maxscale-system-test/bug699.cpp b/maxscale-system-test/bug699.cpp index 1b4fb5769..ec9e4f86b 100644 --- a/maxscale-system-test/bug699.cpp +++ b/maxscale-system-test/bug699.cpp @@ -1,6 +1,6 @@ /** * @file bug699.cpp regression case for bug 699 ( "rw-split sensitive to order of terms in field list of - *SELECT (round 2)" ) + * SELECT (round 2)" ) * * - compare @@hostname from "select @@wsrep_node_name, @@hostname" and "select @@hostname, *@@wsrep_node_name" @@ -223,17 +223,15 @@ int main(int argc, char* argv[]) char serverid2[1024]; if (( - find_field( - Test->maxscales->conn_rwsplit[0], - sel3, - "@@server_id", - &serverid1[0]) + find_field(Test->maxscales->conn_rwsplit[0], + sel3, + "@@server_id", + &serverid1[0]) != 0 ) || ( - find_field( - Test->maxscales->conn_rwsplit[0], - sel4, - "@@server_id", - &serverid2[0]) + find_field(Test->maxscales->conn_rwsplit[0], + sel4, + "@@server_id", + &serverid2[0]) != 0 )) { Test->add_result(1, "@@server_id field not found!!\n"); @@ -249,17 +247,15 @@ int main(int argc, char* argv[]) } if (( - find_field( - Test->maxscales->conn_rwsplit[0], - sel1, - "@@hostname", - &serverid1[0]) + find_field(Test->maxscales->conn_rwsplit[0], + sel1, + "@@hostname", + &serverid1[0]) != 0 ) || ( - find_field( - Test->maxscales->conn_rwsplit[0], - sel2, - "@@hostname", - &serverid2[0]) + find_field(Test->maxscales->conn_rwsplit[0], + sel2, + "@@hostname", + &serverid2[0]) != 0 )) { Test->add_result(1, "@@hostname field not found!!\n"); diff --git a/maxscale-system-test/bug705.cpp b/maxscale-system-test/bug705.cpp index 744fc696d..0f1fc383a 100644 --- a/maxscale-system-test/bug705.cpp +++ b/maxscale-system-test/bug705.cpp @@ -1,6 +1,6 @@ /** * @file bug705.cpp regression case for bug 705 ("Authentication fails when the user connects to a database - *when the SQL mode includes ANSI_QUOTES") + * when the SQL mode includes ANSI_QUOTES") * * - use only one backend * - derectly to backend SET GLOBAL sql_mode="ANSI" @@ -117,11 +117,11 @@ | | mysql root@centos-7-minimal:[Mon Jan 26 14:27:33 2015][(none)]> SET SESSION sql_mode = "POSTGRESQL"; |select @@sql_mode; - | - | - | - | - | + | + | + | + | + | | Query |OK, 0 rows affected (0.00 sec) | @@ -197,7 +197,8 @@ |via mysql client | Comment 5 ivan.stoykov@skysql.com 2015-01-26 16:37:32 UTC | There is at least one case that after setting the sql_mode to string : - | "REAL_AS_FLOAT,PIPES_AS_CONCAT,ANSI_QUOTES,IGNORE_SPACE,ONLY_FULL_GROUP_BY,ANSI,STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION" + | + |"REAL_AS_FLOAT,PIPES_AS_CONCAT,ANSI_QUOTES,IGNORE_SPACE,ONLY_FULL_GROUP_BY,ANSI,STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION" |at 10.0.15-MariaDB-wsrep-log , using maxscale in this way returned an error. | | $ mysql --host max-scale-host --user=test --password=xxx --port 4449 mysqlslap diff --git a/maxscale-system-test/bug711.cpp b/maxscale-system-test/bug711.cpp index 592e540fa..d73427af0 100644 --- a/maxscale-system-test/bug711.cpp +++ b/maxscale-system-test/bug711.cpp @@ -1,6 +1,6 @@ /** * @file bug711.cpp bug711 regression case (Some MySQL Workbench Management actions hang with R/W split - *router) + * router) * - configure rwsplit with use_sql_variables_in=all * - try SHOW GLOBAL STATUS with all maxscales->routers[0] * - check if Maxscale is still alive diff --git a/maxscale-system-test/bug730.cpp b/maxscale-system-test/bug730.cpp index f92022ef2..40e95e78d 100644 --- a/maxscale-system-test/bug730.cpp +++ b/maxscale-system-test/bug730.cpp @@ -1,6 +1,6 @@ /** * @file bug730.cpp regression case for bug 730 ("Regex filter and shorter than original replacement queries - *MaxScale") + * MaxScale") * * - setup regex filter, add it to all maxscales->routers[0] * @verbatim diff --git a/maxscale-system-test/bulk_insert.cpp b/maxscale-system-test/bulk_insert.cpp index 78b385806..9edf1562d 100644 --- a/maxscale-system-test/bulk_insert.cpp +++ b/maxscale-system-test/bulk_insert.cpp @@ -123,9 +123,9 @@ int bind_by_row(MYSQL* mysql) struct st_data data[] = { - {0, STMT_INDICATOR_NULL, "Monty", STMT_INDICATOR_NTS, "Widenius", STMT_INDICATOR_NTS }, - {0, STMT_INDICATOR_NULL, "David", STMT_INDICATOR_NTS, "Axmark", STMT_INDICATOR_NTS }, - {0, STMT_INDICATOR_NULL, "default", STMT_INDICATOR_DEFAULT, "N.N.", STMT_INDICATOR_NTS }, + {0, STMT_INDICATOR_NULL, "Monty", STMT_INDICATOR_NTS, "Widenius", STMT_INDICATOR_NTS}, + {0, STMT_INDICATOR_NULL, "David", STMT_INDICATOR_NTS, "Axmark", STMT_INDICATOR_NTS}, + {0, STMT_INDICATOR_NULL, "default", STMT_INDICATOR_DEFAULT, "N.N.", STMT_INDICATOR_NTS}, }; unsigned int array_size = 3; diff --git a/maxscale-system-test/change_master_during_session.cpp b/maxscale-system-test/change_master_during_session.cpp index bdfa6cb4f..d24602617 100644 --- a/maxscale-system-test/change_master_during_session.cpp +++ b/maxscale-system-test/change_master_during_session.cpp @@ -1,6 +1,6 @@ /** * @file change_master_during_seesion.cpp Tries to reconfigure replication setup to use another node as a - *Master + * Master * - connect to RWSplit * - reconfugure backend * - checks that after time > monitor_interval everything is ok diff --git a/maxscale-system-test/change_user.cpp b/maxscale-system-test/change_user.cpp index db3817333..eccf90200 100644 --- a/maxscale-system-test/change_user.cpp +++ b/maxscale-system-test/change_user.cpp @@ -2,13 +2,13 @@ * @file change_user.cpp mysql_change_user test * * - using RWSplit and user 'skysql': GRANT SELECT ON test.* TO user@'%' identified by 'pass2'; FLUSH - *PRIVILEGES; + * PRIVILEGES; * - create a new connection to RSplit as 'user' * - try INSERT expecting 'access denied' * - call mysql_change_user() to change user to 'skysql' * - try INSERT again expecting success * - try to execute mysql_change_user() to switch to user 'user' but use rong password (expecting access - *denied) + * denied) * - try INSERT again expecting success (user should not be changed) */ diff --git a/maxscale-system-test/connection_limit.cpp b/maxscale-system-test/connection_limit.cpp index 9a863cca7..73ab49977 100644 --- a/maxscale-system-test/connection_limit.cpp +++ b/maxscale-system-test/connection_limit.cpp @@ -2,7 +2,7 @@ * @file connection_limit.cpp connection_limit check if max_connections parameter works * * - Maxscale.cnf contains max_connections=10 for RWSplit, max_connections=20 for ReadConn master and - *max_connections=25 for ReadConn slave + * max_connections=25 for ReadConn slave * - create max num of connections and check tha N+1 connection fails */ diff --git a/maxscale-system-test/different_size.h b/maxscale-system-test/different_size.h index cecb4afab..c970835a1 100644 --- a/maxscale-system-test/different_size.h +++ b/maxscale-system-test/different_size.h @@ -22,7 +22,7 @@ MYSQL* connect_to_serv(TestConnections* Test, bool binlog); /** * @brief set_max_packet Executes 'cmd' on Master of RWSplit ('cmd' should be 'set global - *max_paxket_size=...') + * max_paxket_size=...') * @param Test TestConnections object * @param binlog if true - connects to Master, otherwise - to RWSplit router * @param cmd command to execute @@ -36,4 +36,4 @@ void set_max_packet(TestConnections* Test, bool binlog, char* cmd); */ void different_packet_size(TestConnections* Test, bool binlog); -#endif // DIFFERENT_SIZE_H +#endif // DIFFERENT_SIZE_H diff --git a/maxscale-system-test/execute_cmd.h b/maxscale-system-test/execute_cmd.h index 5c0867efa..ef0248ffa 100644 --- a/maxscale-system-test/execute_cmd.h +++ b/maxscale-system-test/execute_cmd.h @@ -14,4 +14,4 @@ using namespace std; */ int execute_cmd(char* cmd, char** res); -#endif // EXECUTE_CMD_H +#endif // EXECUTE_CMD_H diff --git a/maxscale-system-test/failover_mysqlmon.cpp b/maxscale-system-test/failover_mysqlmon.cpp index b6407cdb1..50a5698ac 100644 --- a/maxscale-system-test/failover_mysqlmon.cpp +++ b/maxscale-system-test/failover_mysqlmon.cpp @@ -7,7 +7,7 @@ * - unblock backend nodes * - wait for monitor * - check that we are still using the last node to which we failed over to and that the old nodes are in - *maintenance mode + * maintenance mode */ diff --git a/maxscale-system-test/fw_copy_rules.h b/maxscale-system-test/fw_copy_rules.h index fb3437270..7cdf59855 100644 --- a/maxscale-system-test/fw_copy_rules.h +++ b/maxscale-system-test/fw_copy_rules.h @@ -11,4 +11,4 @@ */ void copy_rules(TestConnections* Test, const char* rules_name, const char* rules_dir); -#endif // FW_COPY_RULES_H +#endif // FW_COPY_RULES_H diff --git a/maxscale-system-test/fwf.cpp b/maxscale-system-test/fwf.cpp index fbbcc2810..af7cd6f1a 100644 --- a/maxscale-system-test/fwf.cpp +++ b/maxscale-system-test/fwf.cpp @@ -1,16 +1,16 @@ /** * @file fwf - Firewall filter test (also regression test for MXS-683 "qc_mysqlembedded reports as-name - *instead of original-name") + * instead of original-name") * - setup Firewall filter to use rules from rule file fw/ruleXX, where XX - number of sub-test * - execute queries for fw/passXX file, expect OK * - execute queries from fw/denyXX, expect Access Denied error (mysql_error 1141) * - repeat for all XX * - setup Firewall filter to block queries next 2 minutes using 'at_time' statement (see template - *fw/rules_at_time) + * fw/rules_at_time) * - start sending queries, expect Access Denied now and OK after two mintes * - setup Firewall filter to limit a number of queries during certain time * - start sending queries as fast as possible, expect OK for N first quries and Access Denied for next - *queries + * queries * - wait, start sending queries again, but only one query per second, expect OK * - try to load rules with syntax error, expect failure for all sessions and queries */ diff --git a/maxscale-system-test/fwf2.cpp b/maxscale-system-test/fwf2.cpp index ef4ae6587..e14b696fd 100644 --- a/maxscale-system-test/fwf2.cpp +++ b/maxscale-system-test/fwf2.cpp @@ -5,11 +5,11 @@ * - execute queries from fw/denyXX, expect Access Denied error (mysql_error 1141) * - repeat for all XX * - setup Firewall filter to block queries next 2 minutes using 'at_time' statement (see template - *fw/rules_at_time) + * fw/rules_at_time) * - start sending queries, expect Access Denied now and OK after two mintes * - setup Firewall filter to limit a number of queries during certain time * - start sending queries as fast as possible, expect OK for N first quries and Access Denied for next - *queries + * queries * - wait, start sending queries again, but only one query per second, expect OK * - try to load rules with syntax error, expect failure for all sessions and queries */ diff --git a/maxscale-system-test/get_com_select_insert.h b/maxscale-system-test/get_com_select_insert.h index 176a425a9..0ce5f3270 100644 --- a/maxscale-system-test/get_com_select_insert.h +++ b/maxscale-system-test/get_com_select_insert.h @@ -30,4 +30,4 @@ int print_delta(long int* new_selects, int nodes_num); -#endif // GET_COM_SELECT_INSERT_H +#endif // GET_COM_SELECT_INSERT_H diff --git a/maxscale-system-test/get_my_ip.h b/maxscale-system-test/get_my_ip.h index 0a0582450..7747db3d8 100644 --- a/maxscale-system-test/get_my_ip.h +++ b/maxscale-system-test/get_my_ip.h @@ -10,4 +10,4 @@ */ int get_my_ip(char* remote_ip, char* my_ip); -#endif // GET_MY_IP_H +#endif // GET_MY_IP_H diff --git a/maxscale-system-test/keepalived_func.h b/maxscale-system-test/keepalived_func.h index 34d5183a2..13fc3487e 100644 --- a/maxscale-system-test/keepalived_func.h +++ b/maxscale-system-test/keepalived_func.h @@ -9,4 +9,4 @@ char virtual_ip[16]; char* print_version_string(TestConnections* Test); void configure_keepalived(TestConnections* Test, char* keepalived_file); -#endif // KEEPALIVED_FUNC_H +#endif // KEEPALIVED_FUNC_H diff --git a/maxscale-system-test/kerberos_setup.cpp b/maxscale-system-test/kerberos_setup.cpp index 49bd8b1be..89cf295f6 100644 --- a/maxscale-system-test/kerberos_setup.cpp +++ b/maxscale-system-test/kerberos_setup.cpp @@ -157,23 +157,20 @@ int main(int argc, char* argv[]) Test->repl->close_connections(); Test->tprintf("Trying use usr1 to execute query: RW Split\n"); - Test->add_result( - Test->repl->ssh_node(1, - "echo select User,Host from mysql.user | mysql -uusr1 -h maxscale.maxscale.test -P 4006", - false), - "Error executing query against RW Split\n"); + Test->add_result(Test->repl->ssh_node(1, + "echo select User,Host from mysql.user | mysql -uusr1 -h maxscale.maxscale.test -P 4006", + false), + "Error executing query against RW Split\n"); Test->tprintf("Trying use usr1 to execute query: Read Connection Master\n"); - Test->add_result( - Test->repl->ssh_node(1, - "echo select User,Host from mysql.user | mysql -uusr1 -h maxscale.maxscale.test -P 4008", - false), - "Error executing query against Read Connection Master\n"); + Test->add_result(Test->repl->ssh_node(1, + "echo select User,Host from mysql.user | mysql -uusr1 -h maxscale.maxscale.test -P 4008", + false), + "Error executing query against Read Connection Master\n"); Test->tprintf("Trying use usr1 to execute query: Read Connection Slave\n"); - Test->add_result( - Test->repl->ssh_node(1, - "echo select User,Host from mysql.user | mysql -uusr1 -h maxscale.maxscale.test -P 4009", - false), - "Error executing query against Read Connection Slave\n"); + Test->add_result(Test->repl->ssh_node(1, + "echo select User,Host from mysql.user | mysql -uusr1 -h maxscale.maxscale.test -P 4009", + false), + "Error executing query against Read Connection Slave\n"); for (int i = 0; i < Test->repl->N; i++) { diff --git a/maxscale-system-test/load_balancing.cpp b/maxscale-system-test/load_balancing.cpp index b6e37d11b..79efa6bd8 100644 --- a/maxscale-system-test/load_balancing.cpp +++ b/maxscale-system-test/load_balancing.cpp @@ -5,12 +5,12 @@ *'persistpoolmax=10' for all servers) * * - start two groups of threads: each group consists of 25 threads, each thread creates connections to - *RWSplit, + * RWSplit, * threads from first group try to execute as many SELECTs as possible, from second group - one query per - *second + * second * - after 100 seconds all threads are stopped * - check number of connections to every slave: test PASSED if COM_SELECT difference between slaves is not - *greater then 3 times and no + * greater then 3 times and no * more then 10% of quesries went to Master */ diff --git a/maxscale-system-test/load_balancing_galera.cpp b/maxscale-system-test/load_balancing_galera.cpp index ea65033c5..6c0c9ccc4 100644 --- a/maxscale-system-test/load_balancing_galera.cpp +++ b/maxscale-system-test/load_balancing_galera.cpp @@ -5,12 +5,12 @@ *'persistpoolmax=1' and 'persistpoolmax=10' for all servers) * * - start two groups of threads: each group consists of 25 threads, each thread creates connections to - *RWSplit, + * RWSplit, * threads from first group try to execute as many SELECTs as possible, from second group - one query per - *second + * second * - after 100 seconds all threads are stopped * - check number of connections to every slave: test PASSED if COM_SELECT difference between slaves is not - *greater then 3 times and no + * greater then 3 times and no * more then 10% of quesries went to Master */ diff --git a/maxscale-system-test/mariadb_func.h b/maxscale-system-test/mariadb_func.h index 94dfec507..99124a6c9 100644 --- a/maxscale-system-test/mariadb_func.h +++ b/maxscale-system-test/mariadb_func.h @@ -134,7 +134,7 @@ static MYSQL* open_conn_no_db(int port, /** * @brief Executes SQL query. Function also executes mysql_store_result() and mysql_free_result() to clean up - *returns + * returns * @param conn MYSQL connection * @param format SQL string with printf style formatting * @param ... Parameters for @c format @@ -144,7 +144,7 @@ int execute_query(MYSQL* conn, const char* format, ...) mxb_attribute((format(pr /** * @brief execute_query_from_file Read a line from a file, trim leading and trailing whitespace and execute - *it. + * it. * @param conn MYSQL handler * @param file file handler * @return 0 in case of success @@ -153,7 +153,7 @@ int execute_query_from_file(MYSQL* conn, FILE* file); /** * @brief Executes SQL query. Function also executes mysql_store_result() and mysql_free_result() to clean up - *returns + * returns * @param conn MYSQL connection struct * @param sql SQL string * @return 0 in case of success @@ -344,4 +344,4 @@ private: MYSQL* m_conn = nullptr; }; -#endif // MARIADB_FUNC_H +#endif // MARIADB_FUNC_H diff --git a/maxscale-system-test/mariadb_nodes.cpp b/maxscale-system-test/mariadb_nodes.cpp index 453233f7f..49d7f7954 100644 --- a/maxscale-system-test/mariadb_nodes.cpp +++ b/maxscale-system-test/mariadb_nodes.cpp @@ -228,12 +228,11 @@ int Mariadb_nodes::find_master() int master_node = 255; while ((found == 0) && (i < N)) { - if (find_field( - nodes[i], - (char*) "show slave status;", - (char*) "Master_Host", - &str[0] - ) == 0) + if (find_field(nodes[i], + (char*) "show slave status;", + (char*) "Master_Host", + &str[0] + ) == 0) { found = 1; strcpy(master_IP, str); diff --git a/maxscale-system-test/mariadb_nodes.h b/maxscale-system-test/mariadb_nodes.h index 1a9760b72..093ac5e9e 100644 --- a/maxscale-system-test/mariadb_nodes.h +++ b/maxscale-system-test/mariadb_nodes.h @@ -344,7 +344,7 @@ public: /** * @brief disable_ssl Modifies my.cnf in order to get rid of ssl, redefine access user to allow - *connections without ssl + * connections without ssl * @return 0 if success */ int disable_ssl(); @@ -485,4 +485,4 @@ public: // } }; -#endif // MARIADB_NODES_H +#endif // MARIADB_NODES_H diff --git a/maxscale-system-test/maxadmin_operations.h b/maxscale-system-test/maxadmin_operations.h index 861de08e3..dce0adfd6 100644 --- a/maxscale-system-test/maxadmin_operations.h +++ b/maxscale-system-test/maxadmin_operations.h @@ -66,7 +66,7 @@ int sendCommand(int so, char* cmd, char* buf); /** * @brief Send a comamnd using the MaxScaled protocol, search for certain numeric parameter in MaxScaled - *output. + * output. * * Input terminates with a lien containing just the text OK * @@ -108,4 +108,4 @@ int execute_maxadmin_command_tcp(char* hostname, char* user, char* password, cha */ int execute_maxadmin_command_print_pcp(char* hostname, char* user, char* password, char* cmd); -#endif // MAXADMIN_OPERATIONS_H +#endif // MAXADMIN_OPERATIONS_H diff --git a/maxscale-system-test/maxinfo_func.h b/maxscale-system-test/maxinfo_func.h index f25ca1d28..b08085bb6 100644 --- a/maxscale-system-test/maxinfo_func.h +++ b/maxscale-system-test/maxinfo_func.h @@ -22,4 +22,4 @@ int setnonblocking(int sock); int get_x_fl_from_json(char* line, long long int* x1, long long int* fl); -#endif // MAXINFO_FUNC_H +#endif // MAXINFO_FUNC_H diff --git a/maxscale-system-test/maxscales.h b/maxscale-system-test/maxscales.h index 89c704e1c..0e58ab704 100644 --- a/maxscale-system-test/maxscales.h +++ b/maxscale-system-test/maxscales.h @@ -108,10 +108,10 @@ public: /** * @brief ConnectMaxscale Opens connections to RWSplit, ReadConn master and ReadConn slave Maxscale - *services + * services * Opens connections to RWSplit, ReadConn master and ReadConn slave Maxscale services * Connections stored in maxscales->conn_rwsplit[0], maxscales->conn_master[0] and - *maxscales->conn_slave[0] MYSQL structs + * maxscales->conn_slave[0] MYSQL structs * @return 0 in case of success */ int connect_maxscale(int m = 0); @@ -132,21 +132,21 @@ public: /** * @brief ConnectRWSplit Opens connections to RWSplit and store MYSQL struct in - *maxscales->conn_rwsplit[0] + * maxscales->conn_rwsplit[0] * @return 0 in case of success */ int connect_rwsplit(int m = 0); /** * @brief ConnectReadMaster Opens connections to ReadConn master and store MYSQL struct in - *maxscales->conn_master[0] + * maxscales->conn_master[0] * @return 0 in case of success */ int connect_readconn_master(int m = 0); /** * @brief ConnectReadSlave Opens connections to ReadConn slave and store MYSQL struct in - *maxscales->conn_slave[0] + * maxscales->conn_slave[0] * @return 0 in case of success */ int connect_readconn_slave(int m = 0); @@ -280,7 +280,7 @@ public: /** * @brief find_master_maxadmin Tries to find node with 'Master' status using Maxadmin connand 'show - *server' + * server' * @param nodes Mariadb_nodes object * @return node index if one master found, -1 if no master found or several masters found */ @@ -309,4 +309,4 @@ public: void wait_for_monitor(int intervals = 1, int m = 0); }; -#endif // MAXSCALES_H +#endif // MAXSCALES_H diff --git a/maxscale-system-test/mxs1045.cpp b/maxscale-system-test/mxs1045.cpp index 42ea37fcf..66d79b89c 100644 --- a/maxscale-system-test/mxs1045.cpp +++ b/maxscale-system-test/mxs1045.cpp @@ -1,6 +1,6 @@ /** * @file mxs1045.cpp Regression case for the bug "Defunct processes after maxscale have executed script during - *failover" + * failover" * - configure monitor: * @verbatim * script=/bin/sh -c "echo hello world!" diff --git a/maxscale-system-test/mxs1071_maxrows.cpp b/maxscale-system-test/mxs1071_maxrows.cpp index b9d81cb50..5399ad7cb 100644 --- a/maxscale-system-test/mxs1071_maxrows.cpp +++ b/maxscale-system-test/mxs1071_maxrows.cpp @@ -236,7 +236,7 @@ int compare_expected(TestConnections* Test, const char* sql, my_ulonglong exp_i, /** * @brief compare_stmt_expected Execute prepared statement and compare number of rows in every result set with - *expected values + * expected values * This function uses mysql_stmt-* functions (COM_STMT_EXECUTE, COM_STMT_FETCH) * @param Test TestConnections object * @param stmt MYSQL_STMT prepared statement handler diff --git a/maxscale-system-test/mxs1073_binlog_enc.cpp b/maxscale-system-test/mxs1073_binlog_enc.cpp index b4437f402..d4f2ebabf 100644 --- a/maxscale-system-test/mxs1073_binlog_enc.cpp +++ b/maxscale-system-test/mxs1073_binlog_enc.cpp @@ -8,7 +8,7 @@ * - check that all slave have the same data * - 'maxbinlogcheck' against Maxscale binlog file * - check 'maxbinlogcheck' output for lack of errors and presence of 'Decrypting binlog file with algorithm' - *message + * message * - try remote access to Maxscale binlog with 'mysqlbinlog' * - copy Maxscale binlogs to Master and check output of 'show binary logs' before and after copying * (expect same file name and size, but different checksums) @@ -22,7 +22,7 @@ /** * @brief get_first_binlog_file Get name, size and checksum of first binlog file from 'show binary logs' - *output list + * output list * @param Test TestConnections object * @param name string for file name * @param size variable for file size diff --git a/maxscale-system-test/mxs118.cpp b/maxscale-system-test/mxs118.cpp index ff1645702..db1aa46f1 100644 --- a/maxscale-system-test/mxs118.cpp +++ b/maxscale-system-test/mxs118.cpp @@ -1,6 +1,6 @@ /** * @file mxs118.cpp bug mxs118 regression case ("Two monitors loaded at the same time result into not working - *installation") + * installation") * * - Configure two monitors using same backend serves * - try to connect to maxscale diff --git a/maxscale-system-test/mxs127.cpp b/maxscale-system-test/mxs127.cpp index 05ce26d71..3c5694fde 100644 --- a/maxscale-system-test/mxs127.cpp +++ b/maxscale-system-test/mxs127.cpp @@ -1,6 +1,6 @@ /** * @file mxs127.cpp - bug mxs-127 regression case ("disable_sescmd_history causes MaxScale to crash under - *load") + * load") * - execute set @test=%d 10000 times against RWSplit, ReadConn Master and ReadConn Slave */ diff --git a/maxscale-system-test/mxs1476.cpp b/maxscale-system-test/mxs1476.cpp index 903a3210c..b197f867f 100644 --- a/maxscale-system-test/mxs1476.cpp +++ b/maxscale-system-test/mxs1476.cpp @@ -1,6 +1,6 @@ /** * MXS-1476: priority value ignored when a Galera node rejoins with a lower wsrep_local_index than current - *master + * master * * https://jira.mariadb.org/browse/MXS-1476 */ diff --git a/maxscale-system-test/mxs244_prepared_stmt_loop.cpp b/maxscale-system-test/mxs244_prepared_stmt_loop.cpp index cb3a2f8a3..4bbd3fb62 100644 --- a/maxscale-system-test/mxs244_prepared_stmt_loop.cpp +++ b/maxscale-system-test/mxs244_prepared_stmt_loop.cpp @@ -1,6 +1,6 @@ /** * @file mxs244_prepared_stmt_loop.cpp mxs244_prepared_stmt_loop executed following statements in the loop - *against all maxscales->routers[0]: + * against all maxscales->routers[0]: * @verbatim * SET NAMES "UTF8"; * PREPARE s1 FROM 'SHOW GLOBAL STATUS WHERE variable_name = ?'; diff --git a/maxscale-system-test/mxs280_select_outfile.cpp b/maxscale-system-test/mxs280_select_outfile.cpp index 7be7015ba..b5e62498e 100644 --- a/maxscale-system-test/mxs280_select_outfile.cpp +++ b/maxscale-system-test/mxs280_select_outfile.cpp @@ -1,6 +1,6 @@ /** * @file mxs280_select_outfile.cpp bug mxs280 regression case ("SELECT INTO OUTFILE query succeeds even if - *backed fails") + * backed fails") * * - Create /tmp/t1.csv on all backends * - creat t1 table, put some data into it diff --git a/maxscale-system-test/mxs359_error_on_write.cpp b/maxscale-system-test/mxs359_error_on_write.cpp index 0940257d2..8a3162383 100644 --- a/maxscale-system-test/mxs359_error_on_write.cpp +++ b/maxscale-system-test/mxs359_error_on_write.cpp @@ -51,8 +51,8 @@ int main(int argc, char** argv) TestConnections test(argc, argv); self = &test; - Queries rw_ok({{"INSERT INTO test.t1 VALUES (1)", true}, {"SELECT * FROM test.t1", true}}); - Queries rw_err({{"INSERT INTO test.t1 VALUES (1)", false}, {"SELECT * FROM test.t1", true}}); + Queries rw_ok({ {"INSERT INTO test.t1 VALUES (1)", true}, {"SELECT * FROM test.t1", true}}); + Queries rw_err({ {"INSERT INTO test.t1 VALUES (1)", false}, {"SELECT * FROM test.t1", true}}); Func block_master = [&test]() { test.repl->block_node(0); diff --git a/maxscale-system-test/mxs548_short_session_change_user.cpp b/maxscale-system-test/mxs548_short_session_change_user.cpp index 13c8059f2..74737e7c6 100644 --- a/maxscale-system-test/mxs548_short_session_change_user.cpp +++ b/maxscale-system-test/mxs548_short_session_change_user.cpp @@ -4,7 +4,7 @@ * - create 'user' with password 'pass2' * - create load on Master (3 threads are inserting data into 't1' in the loop) * - in 40 parallel threads open connection, execute change_user to 'user', execute change_user to default - *user, close connection + * user, close connection * - repeat test first only for RWSplit and second for all maxscales->routers[0] * - check logs for lack of "Unable to write to backend 'server2' due to authentication failure" errors * - check for lack of crashes in the log diff --git a/maxscale-system-test/mxs564_big_dump.cpp b/maxscale-system-test/mxs564_big_dump.cpp index 57f969121..e21606b05 100644 --- a/maxscale-system-test/mxs564_big_dump.cpp +++ b/maxscale-system-test/mxs564_big_dump.cpp @@ -2,7 +2,7 @@ * @file mxs564_big_dump.cpp MXS-564 regression case ("Loading database dump through readwritesplit fails") * - configure Maxscale to use Galera cluster * - start several threads which are executing session command and then sending INSERT queries agaist RWSplit - *router + * router * - after a while block first slave * - after a while block second slave * - check that all INSERTs are ok diff --git a/maxscale-system-test/mxs621_unreadable_cnf.cpp b/maxscale-system-test/mxs621_unreadable_cnf.cpp index 1876e1dc2..92269fc10 100644 --- a/maxscale-system-test/mxs621_unreadable_cnf.cpp +++ b/maxscale-system-test/mxs621_unreadable_cnf.cpp @@ -1,6 +1,6 @@ /** * @file max621_unreadable_cnf.cpp mxs621 regression case ("MaxScale fails to start silently if config file is - *not readable") + * not readable") * * - make maxscale.cnf unreadable * - try to restart Maxscale diff --git a/maxscale-system-test/mxs652_bad_ssl.cpp b/maxscale-system-test/mxs652_bad_ssl.cpp index e4c93ea8b..8d60f7687 100644 --- a/maxscale-system-test/mxs652_bad_ssl.cpp +++ b/maxscale-system-test/mxs652_bad_ssl.cpp @@ -1,6 +1,6 @@ /** * @file mxs652_bad_ssl.cpp mxs652 regression case ("ssl is configured in a wrong way, but Maxscale can be - *started and works") + * started and works") * * - Maxscale.cnf contains ssl configuration for all services in 'router' section instead of 'listener' with *'ssl=require' diff --git a/maxscale-system-test/mxs657_restart.cpp b/maxscale-system-test/mxs657_restart.cpp index 2af186900..5783d4d01 100644 --- a/maxscale-system-test/mxs657_restart.cpp +++ b/maxscale-system-test/mxs657_restart.cpp @@ -1,6 +1,6 @@ /** * @file mxs657_restart.cpp Regression case for MXS-657 ("Debug assertion when service is shut down and - *restarted repeatedly") + * restarted repeatedly") * - playing with 'restart service' and restart Maxscale under load */ diff --git a/maxscale-system-test/mxs657_restart_service.cpp b/maxscale-system-test/mxs657_restart_service.cpp index 8c0a2e77d..1cdea5048 100644 --- a/maxscale-system-test/mxs657_restart_service.cpp +++ b/maxscale-system-test/mxs657_restart_service.cpp @@ -1,6 +1,6 @@ /** * @file mxs657_restart_service.cpp mxs657 regression case ("Debug assertion when service is shut down and - *restarted repeatedly") + * restarted repeatedly") * * - shutdown and restart RW Split Router in the loop from a number of threads * Note: does not work crash reliable way with 'smoke' option diff --git a/maxscale-system-test/mxs710_bad_socket.cpp b/maxscale-system-test/mxs710_bad_socket.cpp index ffce5c7c1..d18b1af1c 100644 --- a/maxscale-system-test/mxs710_bad_socket.cpp +++ b/maxscale-system-test/mxs710_bad_socket.cpp @@ -1,6 +1,6 @@ /** * @file mxs710_bad_socket.cpp mxs710_bad_socket regression case (Maxscale does not startup properly and - *crashes after trying to login to database) + * crashes after trying to login to database) * - try to start maxscale with "socket=/var/lib/mysqld/mysql.sock" in the listener definition * - do not expect crash * - try the same with two listers for one service, one of them uses unreachable port diff --git a/maxscale-system-test/mxs720_line_with_no_equal.cpp b/maxscale-system-test/mxs720_line_with_no_equal.cpp index de4ec614f..ba804470a 100644 --- a/maxscale-system-test/mxs720_line_with_no_equal.cpp +++ b/maxscale-system-test/mxs720_line_with_no_equal.cpp @@ -1,7 +1,7 @@ /** * @file max720_line_with_no_equal.cpp mxs720 regression case - first part: line without "=", second - weird - *lines ("MaxScale fails to start and doesn't log any useful message when there are spurious characters in - *the config file") + * lines ("MaxScale fails to start and doesn't log any useful message when there are spurious characters in + * the config file") * * - use incorrect maxscale.cnf * - check log for error diff --git a/maxscale-system-test/mxs720_wierd_line.cpp b/maxscale-system-test/mxs720_wierd_line.cpp index 2e755ae1d..577923738 100644 --- a/maxscale-system-test/mxs720_wierd_line.cpp +++ b/maxscale-system-test/mxs720_wierd_line.cpp @@ -1,6 +1,6 @@ /** * @file max720_wierd_line.cpp mxs720 regression case - second part: weird lines ("MaxScale fails to start - *and doesn't log any useful message when there are spurious characters in the config file") + * and doesn't log any useful message when there are spurious characters in the config file") * * - use incorrect maxscale.cnf * - check log for error diff --git a/maxscale-system-test/mxs781_binlog_wrong_passwrd.cpp b/maxscale-system-test/mxs781_binlog_wrong_passwrd.cpp index ec6f7b347..2e20b36d2 100644 --- a/maxscale-system-test/mxs781_binlog_wrong_passwrd.cpp +++ b/maxscale-system-test/mxs781_binlog_wrong_passwrd.cpp @@ -1,6 +1,6 @@ /** * @file mxs781_binlog_wrong_passwrd.cpp Try to configure binlog router to use wrong password for Master and - *check 'slave status' on binlog + * check 'slave status' on binlog * - try to put wrong password when connect binlog router to real master * - check binlog router status using 'show slave status', expect 'Slave stopped' */ diff --git a/maxscale-system-test/mxs812_2.cpp b/maxscale-system-test/mxs812_2.cpp index ab868328d..b6807c017 100644 --- a/maxscale-system-test/mxs812_2.cpp +++ b/maxscale-system-test/mxs812_2.cpp @@ -1,6 +1,6 @@ /** * @file mxs812_2.cpp - Execute binary protocol prepared statements while master is blocked, checks "Current - *no. of conns" after the test + * no. of conns" after the test * - start threads which prepares and executes simple statement in the loop * - every 5 seconds block and after another 5 seconds unblock Master * - checks "Current no. of conns" after the test, expect 0 diff --git a/maxscale-system-test/mxs822_maxpasswd.cpp b/maxscale-system-test/mxs822_maxpasswd.cpp index aff4ed61d..81a457bb4 100644 --- a/maxscale-system-test/mxs822_maxpasswd.cpp +++ b/maxscale-system-test/mxs822_maxpasswd.cpp @@ -1,6 +1,6 @@ /** * @file mxs822_maxpasswd.cpp Regression test for bug MXS-822 ("encrypted passwords containing special - *characters appear to not work") + * characters appear to not work") * - create .secret with maxkeys * - generate encripted password with maxpasswd, use password with special characters * - replace passwords in maxscale.cnf with generated encripted password diff --git a/maxscale-system-test/mxs827_write_timeout.cpp b/maxscale-system-test/mxs827_write_timeout.cpp index c8763060c..ca6c58000 100644 --- a/maxscale-system-test/mxs827_write_timeout.cpp +++ b/maxscale-system-test/mxs827_write_timeout.cpp @@ -1,6 +1,6 @@ /** * @file mxs827_write_timeout "ReadWriteSplit only keeps used connection alive, query crashes after unused - *connection times out" + * connection times out" * - SET wait_timeout=20 * - do only SELECT during 30 seconds * - try INSERT diff --git a/maxscale-system-test/mxs872_roles.cpp b/maxscale-system-test/mxs872_roles.cpp index 73186b1ac..1aa205e13 100644 --- a/maxscale-system-test/mxs872_roles.cpp +++ b/maxscale-system-test/mxs872_roles.cpp @@ -25,8 +25,7 @@ int main(int argc, char** argv) "CREATE USER 'test2'@'%' IDENTIFIED BY 'test2'", "GRANT dba TO 'test'@'%'", "GRANT dba TO 'test2'@'%'", - "SET DEFAULT ROLE dba FOR 'test'@'%'" - })) + "SET DEFAULT ROLE dba FOR 'test'@'%'"})) { test.try_query(test.repl->nodes[0], "%s", a.c_str()); } @@ -52,8 +51,7 @@ int main(int argc, char** argv) for (auto a : vector({"DROP DATABASE IF EXISTS my_db", "DROP ROLE IF EXISTS dba", "DROP USER 'test'@'%'", - "DROP USER 'test2'@'%'" - })) + "DROP USER 'test2'@'%'"})) { execute_query_silent(test.repl->nodes[0], "%s", a.c_str()); } diff --git a/maxscale-system-test/mysqlmon_multimaster.cpp b/maxscale-system-test/mysqlmon_multimaster.cpp index 4577a6a6d..9b8aaf09a 100644 --- a/maxscale-system-test/mysqlmon_multimaster.cpp +++ b/maxscale-system-test/mysqlmon_multimaster.cpp @@ -5,12 +5,12 @@ * - Set nodes 0 and 1 into read-only mode * - repeat status check * - Configure nodes 1 and 2 (server2 and server3) into a master-master pair, make node 0 a slave of node 1 - *and node 3 a slave of node 2 + * and node 3 a slave of node 2 * - repeat status check * - Set node 1 into read-only mode * - repeat status check * - Create two distinct groups (server1 and server2 are masters for eache others and same for server3 and - *server4) + * server4) * - repeat status check * - Set nodes 1 and 3 (server2 and server4) into read-only mode */ diff --git a/maxscale-system-test/nodes.h b/maxscale-system-test/nodes.h index 1bde47d13..9cfe9a1b7 100644 --- a/maxscale-system-test/nodes.h +++ b/maxscale-system-test/nodes.h @@ -178,4 +178,4 @@ private: int check_node_ssh(int node); }; -#endif // NODES_H +#endif // NODES_H diff --git a/maxscale-system-test/rds_vpc.h b/maxscale-system-test/rds_vpc.h index 45d4ec0ed..fc9a1fd3c 100644 --- a/maxscale-system-test/rds_vpc.h +++ b/maxscale-system-test/rds_vpc.h @@ -260,4 +260,4 @@ public: const char* sg_intern; }; -#endif // RDS_VPC_H +#endif // RDS_VPC_H diff --git a/maxscale-system-test/readconnrouter_master.cpp b/maxscale-system-test/readconnrouter_master.cpp index 01ecb02bd..c279aacf4 100644 --- a/maxscale-system-test/readconnrouter_master.cpp +++ b/maxscale-system-test/readconnrouter_master.cpp @@ -1,6 +1,6 @@ /** * @file readconnrouter_master.cpp Connect to ReadConn in master mode and check if there is only one backend - *connection to master + * connection to master * * - connect to ReadCon master * - expect only 1 connection to node 0 and no connections to ther nodes diff --git a/maxscale-system-test/readconnrouter_slave.cpp b/maxscale-system-test/readconnrouter_slave.cpp index 9e699110b..4aa6fbd31 100644 --- a/maxscale-system-test/readconnrouter_slave.cpp +++ b/maxscale-system-test/readconnrouter_slave.cpp @@ -1,6 +1,6 @@ /** * @file readconnrouter_slave.cpp Creates 100 connections to ReadConn in slave mode and check if connections - *are distributed among all slaves + * are distributed among all slaves * * - create 100 connections to ReadConn slave * - check if all slave have equal number of connections (+-1) diff --git a/maxscale-system-test/regexfilter1.cpp b/maxscale-system-test/regexfilter1.cpp index f65f8e600..75a58a128 100644 --- a/maxscale-system-test/regexfilter1.cpp +++ b/maxscale-system-test/regexfilter1.cpp @@ -1,6 +1,6 @@ /** * @file regexfilter1.cpp Simple regexfilter tests; aslo regression case for mxs508 ("regex filter ignores - *username") + * username") * * Three services are configured with regexfilter, each with different parameters. * All services are queried with SELECT 123. The first service should replace it diff --git a/maxscale-system-test/rw_select_insert.cpp b/maxscale-system-test/rw_select_insert.cpp index 343552f7d..cd4761d86 100644 --- a/maxscale-system-test/rw_select_insert.cpp +++ b/maxscale-system-test/rw_select_insert.cpp @@ -1,6 +1,6 @@ /** * @file rw_select_insert.cpp Checks changes of COM_SELECT and COM_INSERT after queris to check if RWSplit - *sends queries to master or to slave depending on if it is write or read only query + * sends queries to master or to slave depending on if it is write or read only query * - connect to RWSplit, create table * - execute SELECT using RWSplit * - check COM_SELECT and COM_INSERT change on all nodes @@ -18,7 +18,7 @@ /** * @brief check_com_select Checks if COM_SELECT increase takes place only on one slave node and there is no - *COM_INSERT increase + * COM_INSERT increase * @param new_selects COM_SELECT after query * @param new_inserts COM_INSERT after query * @param selects COM_SELECT before query diff --git a/maxscale-system-test/ses_bigmem.cpp b/maxscale-system-test/ses_bigmem.cpp index e7b31b50a..15ccc9fa4 100644 --- a/maxscale-system-test/ses_bigmem.cpp +++ b/maxscale-system-test/ses_bigmem.cpp @@ -1,6 +1,6 @@ /** * @file ses_bigmem Executes a lot of session commands with "disable_sescmd_history=true" and check that - *memory consumption is not increasing + * memory consumption is not increasing * (relates to MXS-672 "maxscale possible memory leak" */ diff --git a/maxscale-system-test/setup_binlog.cpp b/maxscale-system-test/setup_binlog.cpp index f29e98ff9..d7aeb238e 100644 --- a/maxscale-system-test/setup_binlog.cpp +++ b/maxscale-system-test/setup_binlog.cpp @@ -25,7 +25,7 @@ * - check data on all nodes * - chack sha1 * - repeat last test with FLUSH LOGS on master 1. before putting data to Master 2. after putting data to - *master + * master */ diff --git a/maxscale-system-test/short_sessions.cpp b/maxscale-system-test/short_sessions.cpp index bb1fa7f4f..5651fd812 100644 --- a/maxscale-system-test/short_sessions.cpp +++ b/maxscale-system-test/short_sessions.cpp @@ -1,6 +1,6 @@ /** * @file short_sessions.cpp Executes a lof of short queries, use own short session for every query (some - *relations to bug#424) + * relations to bug#424) * * - using RSplit create table * - close connection diff --git a/maxscale-system-test/show_monitor_crash.cpp b/maxscale-system-test/show_monitor_crash.cpp index 38ab90769..d9465e3dd 100644 --- a/maxscale-system-test/show_monitor_crash.cpp +++ b/maxscale-system-test/show_monitor_crash.cpp @@ -1,6 +1,6 @@ /** * @file show_monitor_crash.cpp show_monitor_crash regression case for crash if maxadmin 'show monitors' - *command is issued, but no monitor is not running + * command is issued, but no monitor is not running * * - maxscale.cnf contains wrong monitor config (user name is wrong) * - issue 'show monitors' maxadmin command diff --git a/maxscale-system-test/slave_failover.cpp b/maxscale-system-test/slave_failover.cpp index f7c179bf4..bfdfc2f9b 100644 --- a/maxscale-system-test/slave_failover.cpp +++ b/maxscale-system-test/slave_failover.cpp @@ -1,6 +1,6 @@ /** * @file slave_failover.cpp Check how Maxscale works in case of one slave failure, only one slave is - *configured + * configured * * - Connect to RWSplit * - find which backend slave is used for connection diff --git a/maxscale-system-test/slave_lag.cpp b/maxscale-system-test/slave_lag.cpp index 87b9aff80..4a4c40296 100644 --- a/maxscale-system-test/slave_lag.cpp +++ b/maxscale-system-test/slave_lag.cpp @@ -1,6 +1,6 @@ /** * @file server_lag.cpp Create high INSERT load to create slave lag and check that Maxscale start routing - *queries to Master + * queries to Master * * - in Maxscqale.cnf set max_slave_replication_lag=20 * - in parallel thread execute as many INSERTs as possible diff --git a/maxscale-system-test/sql_const.h b/maxscale-system-test/sql_const.h index bd355cb6f..d64e397b1 100644 --- a/maxscale-system-test/sql_const.h +++ b/maxscale-system-test/sql_const.h @@ -22,4 +22,4 @@ const char* setup_slave_no_pos "MASTER_PORT=%d"; -#endif // SQL_CONST_H +#endif // SQL_CONST_H diff --git a/maxscale-system-test/sql_queries.cpp b/maxscale-system-test/sql_queries.cpp index b3e008a30..d9cca03f0 100644 --- a/maxscale-system-test/sql_queries.cpp +++ b/maxscale-system-test/sql_queries.cpp @@ -1,6 +1,6 @@ /** * @file sql_queries.cpp Execute long sql queries as well as "use" command (also used for bug648 "use - *database is sent forever with tee filter to a readwrite split service") + * database is sent forever with tee filter to a readwrite split service") * - also used for 'sql_queries_pers1' and 'sql_queries_pers10' tests (with 'persistpoolmax=1' and *'persistpoolmax=10' for all servers) * - for bug648: diff --git a/maxscale-system-test/sql_t1.h b/maxscale-system-test/sql_t1.h index caaba0738..f8359dcae 100644 --- a/maxscale-system-test/sql_t1.h +++ b/maxscale-system-test/sql_t1.h @@ -74,4 +74,4 @@ int select_from_t1(MYSQL* conn, int N); */ int check_if_t1_exists(MYSQL* conn); -#endif // SQL_T1_H +#endif // SQL_T1_H diff --git a/maxscale-system-test/sysbench_commands.h b/maxscale-system-test/sysbench_commands.h index f60f17189..630c3a628 100644 --- a/maxscale-system-test/sysbench_commands.h +++ b/maxscale-system-test/sysbench_commands.h @@ -75,4 +75,4 @@ const char* sysbench_command_short -#endif // SYSBENCH_COMMANDS_H +#endif // SYSBENCH_COMMANDS_H diff --git a/maxscale-system-test/test_binlog_fnc.h b/maxscale-system-test/test_binlog_fnc.h index 86a2ca411..8e31d53c1 100644 --- a/maxscale-system-test/test_binlog_fnc.h +++ b/maxscale-system-test/test_binlog_fnc.h @@ -27,4 +27,4 @@ int start_transaction(TestConnections* Test); */ void test_binlog(TestConnections* Test); -#endif // TEST_BINLOG_FNC_H +#endif // TEST_BINLOG_FNC_H diff --git a/maxscale-system-test/testconnections.cpp b/maxscale-system-test/testconnections.cpp index 90110a751..581a1e8ed 100644 --- a/maxscale-system-test/testconnections.cpp +++ b/maxscale-system-test/testconnections.cpp @@ -107,18 +107,18 @@ TestConnections::TestConnections(int argc, char* argv[]) static struct option long_options[] = { - {"help", no_argument, 0, 'h'}, - {"verbose", no_argument, 0, 'v'}, - {"silent", no_argument, 0, 'n'}, - {"quiet", no_argument, 0, 'q'}, - {"no-maxscale-start", no_argument, 0, 's'}, - {"no-maxscale-init", no_argument, 0, 'i'}, - {"no-nodes-check", no_argument, 0, 'r'}, - {"restart-galera", no_argument, 0, 'g'}, - {"no-timeouts", no_argument, 0, 'z'}, - {"no-galera", no_argument, 0, 'y'}, - {"local-maxscale", no_argument, 0, 'l'}, - {0, 0, 0, 0 } + {"help", no_argument, 0, 'h' }, + {"verbose", no_argument, 0, 'v' }, + {"silent", no_argument, 0, 'n' }, + {"quiet", no_argument, 0, 'q' }, + {"no-maxscale-start", no_argument, 0, 's' }, + {"no-maxscale-init", no_argument, 0, 'i' }, + {"no-nodes-check", no_argument, 0, 'r' }, + {"restart-galera", no_argument, 0, 'g' }, + {"no-timeouts", no_argument, 0, 'z' }, + {"no-galera", no_argument, 0, 'y' }, + {"local-maxscale", no_argument, 0, 'l' }, + {0, 0, 0, 0 } }; int c; diff --git a/maxscale-system-test/testconnections.h b/maxscale-system-test/testconnections.h index 8d6b788af..1555bd105 100644 --- a/maxscale-system-test/testconnections.h +++ b/maxscale-system-test/testconnections.h @@ -29,11 +29,11 @@ typedef std::set StringSet; * - Maxscale_sshkey - ssh key for Maxscale machine * - maxscale_cnf - name of maxscale .cnf file (full) * - KillVMCommand - Command to kill a node (should handle one parameter: IP address of virtual machine to - *kill) + * kill) * - StartVMCommand - Command to restart virtual machine (should handle one parameter: IP address of virtual - *machine to kill) + * machine to kill) * - GetLogsCommand - Command to copy log files from node virtual machines (should handle one parameter: IP - *address of virtual machine to kill) + * address of virtual machine to kill) * - SysbenchDir - path to SysBench directory (sysbanch should be >= 0.5) * - node_N - Number of Master/Slave setup nodes * - node_NNN - IP address of node NNN (NNN - 3 digits node index starting from 000) @@ -42,7 +42,7 @@ typedef std::set StringSet; * - node_User - User name to access Master/Slav setup * - node_Password - Password to access Master/Slave setup * - galera_N, galera_NNN, galera_port_NNN, galera_sshkey_NNN, galera_User, galera_Password - same for Galera - *setup + * setup * */ class TestConnections @@ -54,7 +54,7 @@ private: public: /** * @brief TestConnections constructor: reads environmental variables, copies MaxScale.cnf for MaxScale - *machine + * machine * @param test_exec_name Path to currect executable */ TestConnections(int argc, char* argv[]); @@ -108,7 +108,7 @@ public: /** * @brief GetLogsCommand Command to copy log files from node virtual machines (should handle one - *parameter: IP address of virtual machine to kill) + * parameter: IP address of virtual machine to kill) */ char get_logs_command[4096]; @@ -287,7 +287,7 @@ public: /** * @brief start_binlog configure first node as Master, Second as slave connected to Master and others as - *slave connected to MaxScale binlog router + * slave connected to MaxScale binlog router * @return 0 in case of success */ int start_binlog(int m = 0); @@ -321,7 +321,7 @@ public: /** * @brief copy_all_logs_periodic Copies all MaxScale logs and (if happens) core to current workspace and - *sends time stemp to log copying script + * sends time stemp to log copying script */ int copy_all_logs_periodic(); @@ -335,11 +335,11 @@ public: /** * @brief Test that connections to MaxScale are in the expected state * @param rw_split State of the MaxScale connection to Readwritesplit. True for working connection, false - *for no connection. + * for no connection. * @param rc_master State of the MaxScale connection to Readconnroute Master. True for working connection, - *false for no connection. + * false for no connection. * @param rc_slave State of the MaxScale connection to Readconnroute Slave. True for working connection, - *false for no connection. + * false for no connection. * @return 0 if connections are in the expected state */ int test_maxscale_connections(int m, @@ -351,11 +351,11 @@ public: * @brief Create a number of connections to all services, run simple query, close all connections * @param conn_N number of connections * @param rwsplit_flag if true connections to RWSplit router will be created, if false - no connections to - *RWSplit + * RWSplit * @param master_flag if true connections to ReadConn master router will be created, if false - no - *connections to ReadConn master + * connections to ReadConn master * @param slave_flag if true connections to ReadConn slave router will be created, if false - no - *connections to ReadConn slave + * connections to ReadConn slave * @param galera_flag if true connections to RWSplit router with Galera backend will be created, if false *- no connections to RWSplit with Galera backend * @return 0 in case of success @@ -402,10 +402,10 @@ public: /** * @brief Creats t1 table, insert data into it and checks if data can be correctly read from all Maxscale - *services + * services * @param Test Pointer to TestConnections object that contains references to test setup * @param N number of INSERTs; every next INSERT is longer 16 times in compare with previous one: for N=4 - *last INSERT is about 700kb long + * last INSERT is about 700kb long * @return 0 in case of no error and all checks are ok */ int insert_select(int m, int N); @@ -432,7 +432,7 @@ public: * @param err_msg Error message to search in the log * @param expected TRUE if err_msg is expedted in the log, false if err_msg should NOT be in the log * @return 0 if (err_msg is found AND expected is TRUE) OR (err_msg is NOT found in the log AND expected - *is false) + * is false) */ void check_log_err(int m, const char* err_msg, bool expected); @@ -470,7 +470,7 @@ public: /** * @brief CheckMaxscaleAlive Checks if MaxScale is alive * Reads test setup info from enviromental variables and tries to connect to all Maxscale services to - *check if i is alive. + * check if i is alive. * Also 'show processlist' query is executed using all services * @return 0 in case if success */ @@ -598,4 +598,4 @@ void* log_copy_thread(void* ptr); */ std::string dump_status(const StringSet& current, const StringSet& expected); -#endif // TESTCONNECTIONS_H +#endif // TESTCONNECTIONS_H diff --git a/maxutils/maxbase/include/maxbase/cdefs.h b/maxutils/maxbase/include/maxbase/cdefs.h index 1060b1d18..65b920115 100644 --- a/maxutils/maxbase/include/maxbase/cdefs.h +++ b/maxutils/maxbase/include/maxbase/cdefs.h @@ -86,7 +86,7 @@ #include #endif -#else // __STDC_VERSION >= 201112 +#else // __STDC_VERSION >= 201112 #if defined (__GNUC__) #define thread_local __thread @@ -96,7 +96,7 @@ #endif -#else // __cplusplus +#else // __cplusplus // GCC 4.8 added support for native thread_local. #if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 8) @@ -109,4 +109,4 @@ #endif -#endif // __cplusplus +#endif // __cplusplus diff --git a/maxutils/maxbase/src/logger.cc b/maxutils/maxbase/src/logger.cc index 807f3f216..e733cf3b7 100644 --- a/maxutils/maxbase/src/logger.cc +++ b/maxutils/maxbase/src/logger.cc @@ -211,7 +211,7 @@ bool FileLogger::write_header() asctime_r(&tm, time_string); size_t size = ident.length() + 2 * sizeof(' ') + m_filename.length() + 2 * sizeof(' ') + strlen( - time_string); + time_string); char header[size + 2 + 1]; // For the 2 newlines and the trailing NULL. sprintf(header, "\n\n%s %s %s", ident.c_str(), m_filename.c_str(), time_string); diff --git a/query_classifier/qc_sqlite/builtin_functions.c b/query_classifier/qc_sqlite/builtin_functions.c index d59d64477..7c2f185bc 100644 --- a/query_classifier/qc_sqlite/builtin_functions.c +++ b/query_classifier/qc_sqlite/builtin_functions.c @@ -19,7 +19,7 @@ static struct { bool inited; -} unit = { false }; +} unit = {false}; // The functions have been taken from: // https://mariadb.com/kb/en/mariadb/functions-and-operators/ @@ -441,8 +441,8 @@ static const char* BUILTIN_10_2_3_FUNCTIONS[] = "row_number", }; -const size_t N_BUILTIN_10_2_3_FUNCTIONS = - sizeof(BUILTIN_10_2_3_FUNCTIONS) / sizeof(BUILTIN_10_2_3_FUNCTIONS[0]); +const size_t N_BUILTIN_10_2_3_FUNCTIONS + = sizeof(BUILTIN_10_2_3_FUNCTIONS) / sizeof(BUILTIN_10_2_3_FUNCTIONS[0]); static const char* ORACLE_FUNCTIONS[] = { @@ -486,7 +486,9 @@ void finish_builtin_functions() } bool is_builtin_readonly_function(const char* key, - uint32_t major, uint32_t minor, uint32_t patch, + uint32_t major, + uint32_t minor, + uint32_t patch, bool check_oracle) { mxb_assert(unit.inited); @@ -495,12 +497,15 @@ bool is_builtin_readonly_function(const char* key, if (!value) { - if ((major > 10) || - ((major == 10) && (minor > 2)) || - ((major == 10) && (minor == 2) && (patch >= 3))) + if ((major > 10) + || ((major == 10) && (minor > 2)) + || ((major == 10) && (minor == 2) && (patch >= 3))) { - value = bsearch(key, BUILTIN_10_2_3_FUNCTIONS, N_BUILTIN_10_2_3_FUNCTIONS, - sizeof(char*), search_compare); + value = bsearch(key, + BUILTIN_10_2_3_FUNCTIONS, + N_BUILTIN_10_2_3_FUNCTIONS, + sizeof(char*), + search_compare); } } diff --git a/query_classifier/qc_sqlite/builtin_functions.h b/query_classifier/qc_sqlite/builtin_functions.h index 146c04f42..e64d83595 100644 --- a/query_classifier/qc_sqlite/builtin_functions.h +++ b/query_classifier/qc_sqlite/builtin_functions.h @@ -10,7 +10,7 @@ * of this software will be governed by version 2 or later of the General * Public License. */ - #pragma once +#pragma once #include #include @@ -23,7 +23,9 @@ void init_builtin_functions(); void finish_builtin_functions(); bool is_builtin_readonly_function(const char* zToken, - uint32_t major, uint32_t minor, uint32_t patch, + uint32_t major, + uint32_t minor, + uint32_t patch, bool check_oracle); #ifdef __cplusplus diff --git a/query_classifier/qc_sqlite/qc_sqlite.cc b/query_classifier/qc_sqlite/qc_sqlite.cc index 7080e83eb..6fcf32e04 100644 --- a/query_classifier/qc_sqlite/qc_sqlite.cc +++ b/query_classifier/qc_sqlite/qc_sqlite.cc @@ -40,23 +40,23 @@ using std::vector; -//#define QC_TRACE_ENABLED +// #define QC_TRACE_ENABLED #undef QC_TRACE_ENABLED -#if defined(QC_TRACE_ENABLED) +#if defined (QC_TRACE_ENABLED) #define QC_TRACE() MXS_NOTICE(__func__) #else #define QC_TRACE() #endif -#define QC_EXCEPTION_GUARD(statement)\ - do { try { statement; }\ - catch (const std::bad_alloc&) { \ - MXS_OOM(); pInfo->m_status = QC_QUERY_INVALID; } \ - catch (const std::exception& x) { \ - MXS_ERROR("Caught standard exception: %s", x.what()); pInfo->m_status = QC_QUERY_INVALID; } \ - catch (...) { \ - MXS_ERROR("Caught unknown exception."); pInfo->m_status = QC_QUERY_INVALID; } } while (false) +#define QC_EXCEPTION_GUARD(statement) \ + do {try {statement;} \ + catch (const std::bad_alloc&) { \ + MXS_OOM(); pInfo->m_status = QC_QUERY_INVALID;} \ + catch (const std::exception& x) { \ + MXS_ERROR("Caught standard exception: %s", x.what()); pInfo->m_status = QC_QUERY_INVALID;} \ + catch (...) { \ + MXS_ERROR("Caught unknown exception."); pInfo->m_status = QC_QUERY_INVALID;}} while (false) static inline bool qc_info_was_tokenized(qc_parse_result_t status) { @@ -78,8 +78,8 @@ typedef enum qc_log_level typedef enum qc_parse_as { - QC_PARSE_AS_DEFAULT, // Parse as embedded lib does before 10.3 - QC_PARSE_AS_103 // Parse as embedded lib does in 10.3 + QC_PARSE_AS_DEFAULT,// Parse as embedded lib does before 10.3 + QC_PARSE_AS_103 // Parse as embedded lib does in 10.3 } qc_parse_as_t; /** @@ -93,21 +93,21 @@ typedef struct qc_name_mapping static QC_NAME_MAPPING function_name_mappings_default[] = { - { NULL, NULL } + {NULL, NULL} }; static QC_NAME_MAPPING function_name_mappings_103[] = { // NOTE: If something is added here, add it to function_name_mappings_oracle as well. - { "now", "current_timestamp" }, - { NULL, NULL } + {"now", "current_timestamp"}, + {NULL, NULL } }; static QC_NAME_MAPPING function_name_mappings_oracle[] = { - { "now", "current_timestamp" }, - { "nvl", "ifnull" }, - { NULL, NULL } + {"now", "current_timestamp"}, + {"nvl", "ifnull" }, + {NULL, NULL } }; /** @@ -137,13 +137,13 @@ typedef std::map QcAliases; */ static struct { - bool initialized; - bool setup; - qc_log_level_t log_level; - qc_sql_mode_t sql_mode; - qc_parse_as_t parse_as; + bool initialized; + bool setup; + qc_log_level_t log_level; + qc_sql_mode_t sql_mode; + qc_parse_as_t parse_as; QC_NAME_MAPPING* pFunction_name_mappings; - std::mutex lock; + std::mutex lock; } this_unit; /** @@ -153,15 +153,15 @@ class QcSqliteInfo; static thread_local struct { - bool initialized; // Whether the thread specific data has been initialized. - sqlite3* pDb; // Thread specific database handle. - qc_sql_mode_t sql_mode; // What sql_mode is used. - QcSqliteInfo* pInfo; // The information for the current statement being classified. - uint64_t version; // Encoded version number - uint32_t version_major; - uint32_t version_minor; - uint32_t version_patch; - QC_NAME_MAPPING* pFunction_name_mappings; // How function names should be mapped. + bool initialized; // Whether the thread specific data has been initialized. + sqlite3* pDb; // Thread specific database handle. + qc_sql_mode_t sql_mode; // What sql_mode is used. + QcSqliteInfo* pInfo; // The information for the current statement being classified. + uint64_t version; // Encoded version number + uint32_t version_major; + uint32_t version_minor; + uint32_t version_patch; + QC_NAME_MAPPING* pFunction_name_mappings; // How function names should be mapped. } this_thread; const uint64_t VERSION_103 = 10 * 10000 + 3 * 100; @@ -172,66 +172,65 @@ const uint64_t VERSION_103 = 10 * 10000 + 3 * 100; typedef enum qc_token_position { - QC_TOKEN_MIDDLE, // In the middle or irrelevant, e.g.: "=" in "a = b". - QC_TOKEN_LEFT, // To the left, e.g.: "a" in "a = b". - QC_TOKEN_RIGHT, // To the right, e.g: "b" in "a = b". + QC_TOKEN_MIDDLE, // In the middle or irrelevant, e.g.: "=" in "a = b". + QC_TOKEN_LEFT, // To the left, e.g.: "a" in "a = b". + QC_TOKEN_RIGHT, // To the right, e.g: "b" in "a = b". } qc_token_position_t; -static void buffer_object_free(void* data); -static void enlarge_string_array(size_t n, size_t len, char*** ppzStrings, size_t* pCapacity); -static bool ensure_query_is_parsed(GWBUF* query, uint32_t collect); -static void log_invalid_data(GWBUF* query, const char* message); +static void buffer_object_free(void* data); +static void enlarge_string_array(size_t n, size_t len, char*** ppzStrings, size_t* pCapacity); +static bool ensure_query_is_parsed(GWBUF* query, uint32_t collect); +static void log_invalid_data(GWBUF* query, const char* message); static const char* map_function_name(QC_NAME_MAPPING* function_name_mappings, const char* name); -static bool parse_query(GWBUF* query, uint32_t collect); -static void parse_query_string(const char* query, int len, bool suppress_logging); -static bool query_is_parsed(GWBUF* query, uint32_t collect); -static bool should_exclude(const char* zName, const ExprList* pExclude); +static bool parse_query(GWBUF* query, uint32_t collect); +static void parse_query_string(const char* query, int len, bool suppress_logging); +static bool query_is_parsed(GWBUF* query, uint32_t collect); +static bool should_exclude(const char* zName, const ExprList* pExclude); static const char* get_token_symbol(int token); // Defined in parse.y extern "C" { -extern void exposed_sqlite3ExprDelete(sqlite3 *db, Expr *pExpr); -extern void exposed_sqlite3ExprListDelete(sqlite3 *db, ExprList *pList); -extern void exposed_sqlite3IdListDelete(sqlite3 *db, IdList *pList); -extern void exposed_sqlite3SrcListDelete(sqlite3 *db, SrcList *pList); -extern void exposed_sqlite3SelectDelete(sqlite3 *db, Select *p); - -extern void exposed_sqlite3BeginTrigger(Parse *pParse, - Token *pName1, - Token *pName2, - int tr_tm, - int op, - IdList *pColumns, - SrcList *pTableName, - Expr *pWhen, - int isTemp, - int noErr); -extern void exposed_sqlite3FinishTrigger(Parse *pParse, - TriggerStep *pStepList, - Token *pAll); -extern int exposed_sqlite3Dequote(char *z); -extern int exposed_sqlite3EndTable(Parse*, Token*, Token*, u8, Select*); -extern void exposed_sqlite3Insert(Parse* pParse, - SrcList* pTabList, - Select* pSelect, - IdList* pColumns, - int onError); -extern int exposed_sqlite3Select(Parse* pParse, Select* p, SelectDest* pDest); -extern void exposed_sqlite3StartTable(Parse *pParse, /* Parser context */ - Token *pName1, /* First part of the name of the table or view */ - Token *pName2, /* Second part of the name of the table or view */ - int isTemp, /* True if this is a TEMP table */ - int isView, /* True if this is a VIEW */ - int isVirtual, /* True if this is a VIRTUAL table */ - int noErr); /* Do nothing if table already exists */ -extern void exposed_sqlite3Update(Parse* pParse, - SrcList* pTabList, - ExprList* pChanges, - Expr* pWhere, - int onError); + extern void exposed_sqlite3ExprDelete(sqlite3* db, Expr* pExpr); + extern void exposed_sqlite3ExprListDelete(sqlite3* db, ExprList* pList); + extern void exposed_sqlite3IdListDelete(sqlite3* db, IdList* pList); + extern void exposed_sqlite3SrcListDelete(sqlite3* db, SrcList* pList); + extern void exposed_sqlite3SelectDelete(sqlite3* db, Select* p); + extern void exposed_sqlite3BeginTrigger(Parse* pParse, + Token* pName1, + Token* pName2, + int tr_tm, + int op, + IdList* pColumns, + SrcList* pTableName, + Expr* pWhen, + int isTemp, + int noErr); + extern void exposed_sqlite3FinishTrigger(Parse* pParse, + TriggerStep* pStepList, + Token* pAll); + extern int exposed_sqlite3Dequote(char* z); + extern int exposed_sqlite3EndTable(Parse*, Token*, Token*, u8, Select*); + extern void exposed_sqlite3Insert(Parse* pParse, + SrcList* pTabList, + Select* pSelect, + IdList* pColumns, + int onError); + extern int exposed_sqlite3Select(Parse* pParse, Select* p, SelectDest* pDest); + extern void exposed_sqlite3StartTable(Parse* pParse,/* Parser context */ + Token* pName1,/* First part of the name of the table or view */ + Token* pName2,/* Second part of the name of the table or view */ + int isTemp, /* True if this is a TEMP table */ + int isView, /* True if this is a VIEW */ + int isVirtual,/* True if this is a VIRTUAL table */ + int noErr); /* Do nothing if table already exists */ + extern void exposed_sqlite3Update(Parse* pParse, + SrcList* pTabList, + ExprList* pChanges, + Expr* pWhere, + int onError); } /** @@ -240,7 +239,7 @@ extern void exposed_sqlite3Update(Parse* pParse, class QcSqliteInfo : public QC_STMT_INFO { QcSqliteInfo(const QcSqliteInfo&); - QcSqliteInfo& operator = (const QcSqliteInfo&); + QcSqliteInfo& operator=(const QcSqliteInfo&); public: void inc_ref() @@ -260,7 +259,7 @@ public: static QcSqliteInfo* create(uint32_t collect) { - QcSqliteInfo* pInfo = new (std::nothrow) QcSqliteInfo(collect); + QcSqliteInfo* pInfo = new( std::nothrow) QcSqliteInfo(collect); mxb_assert(pInfo); return pInfo; } @@ -497,10 +496,9 @@ public: */ bool must_check_sequence_related_functions() const { - return - (m_sql_mode == QC_SQL_MODE_ORACLE) || - (this_unit.parse_as == QC_PARSE_AS_103) || - (this_thread.version >= VERSION_103); + return (m_sql_mode == QC_SQL_MODE_ORACLE) + || (this_unit.parse_as == QC_PARSE_AS_103) + || (this_thread.version >= VERSION_103); } /** @@ -530,9 +528,9 @@ public: { // In Oracle mode we ignore the pseudocolumns "currval" and "nextval". // We also exclude "lastval", the 10.3 equivalent of "currval". - if ((strcasecmp(zFunc_name, "currval") == 0) || - (strcasecmp(zFunc_name, "nextval") == 0) || - (strcasecmp(zFunc_name, "lastval") == 0)) + if ((strcasecmp(zFunc_name, "currval") == 0) + || (strcasecmp(zFunc_name, "nextval") == 0) + || (strcasecmp(zFunc_name, "lastval") == 0)) { rv = true; } @@ -540,8 +538,8 @@ public: if (!rv && ((this_unit.parse_as == QC_PARSE_AS_103) || (this_thread.version >= VERSION_103))) { - if ((strcasecmp(zFunc_name, "lastval") == 0) || - (strcasecmp(zFunc_name, "nextval") == 0)) + if ((strcasecmp(zFunc_name, "lastval") == 0) + || (strcasecmp(zFunc_name, "nextval") == 0)) { rv = true; } @@ -587,7 +585,8 @@ public: } } - template // QC_FIELD_NAME or QC_FIELD_INFO + // QC_FIELD_NAME or QC_FIELD_INFO + template class MatchFieldName : public std::unary_function { public: @@ -618,9 +617,9 @@ public: { rv = true; } - else if (m_zDatabase && - t.database && - (strcasecmp(m_zDatabase, t.database) == 0)) + else if (m_zDatabase + && t.database + && (strcasecmp(m_zDatabase, t.database) == 0)) { rv = true; } @@ -646,8 +645,8 @@ public: // NOTE: This must be first, so that the type mask is properly updated // NOTE: in case zColumn is "currval" etc. - if (must_check_sequence_related_functions() && - is_sequence_related_field(zDatabase, zTable, zColumn)) + if (must_check_sequence_related_functions() + && is_sequence_related_field(zDatabase, zTable, zColumn)) { m_type_mask |= QUERY_TYPE_WRITE; return; @@ -668,7 +667,7 @@ public: m_field_infos.end(), predicate); - if (i == m_field_infos.end()) // If true, the field was not present already. + if (i == m_field_infos.end()) // If true, the field was not present already. { // If only a column is specified, but not a table or database and we // have a list of expressions that should be excluded, we check if the column @@ -699,8 +698,8 @@ public: bool should_collect_alias = pAliases && zAlias && should_collect(QC_COLLECT_FIELDS); bool should_collect_table = should_collect_alias || should_collect(QC_COLLECT_TABLES); - bool should_collect_database = zDatabase && - (should_collect_alias || should_collect(QC_COLLECT_DATABASES)); + bool should_collect_database = zDatabase + && (should_collect_alias || should_collect(QC_COLLECT_DATABASES)); if (should_collect_table || should_collect_database) { @@ -813,15 +812,15 @@ public: switch (pExpr->op) { - case TK_ASTERISK: // select * + case TK_ASTERISK: // select * update_field_infos_from_expr(pAliases, pExpr, pExclude); break; - case TK_DOT: // select a.b ... select a.b.c + case TK_DOT: // select a.b ... select a.b.c update_field_infos_from_expr(pAliases, pExpr, pExclude); break; - case TK_ID: // select a + case TK_ID: // select a update_field_infos_from_expr(pAliases, pExpr, pExclude); break; @@ -833,15 +832,15 @@ public: { // TODO: This should actually be "... && (m_operation == QUERY_OP_SET)" // TODO: but there is no QUERY_OP_SET at the moment. - if ((prev_token == TK_EQ) && (pos == QC_TOKEN_LEFT) && - (m_operation != QUERY_OP_SELECT)) + if ((prev_token == TK_EQ) && (pos == QC_TOKEN_LEFT) + && (m_operation != QUERY_OP_SELECT)) { m_type_mask |= QUERY_TYPE_GSYSVAR_WRITE; } else { - if ((strcasecmp(&zToken[2], "identity") == 0) || - (strcasecmp(&zToken[2], "last_insert_id") == 0)) + if ((strcasecmp(&zToken[2], "identity") == 0) + || (strcasecmp(&zToken[2], "last_insert_id") == 0)) { m_type_mask |= QUERY_TYPE_MASTER_READ; } @@ -872,7 +871,8 @@ public: default: MXS_DEBUG("Token %d not handled explicitly.", pExpr->op); - // Fallthrough intended. + + // Fallthrough intended. case TK_BETWEEN: case TK_CASE: case TK_EXISTS: @@ -923,7 +923,7 @@ public: QC_FUNCTION_INFO& info = m_function_infos[i]; info.fields = &fields[0]; - info.n_fields = fields.size(); + info.n_fields = fields.size(); } } } @@ -932,12 +932,12 @@ public: case TK_REM: if (m_sql_mode == QC_SQL_MODE_ORACLE) { - if ((pLeft && (pLeft->op == TK_ID)) && - (pRight && (pRight->op == TK_ID)) && - (strcasecmp(pLeft->u.zToken, "sql") == 0) && - (strcasecmp(pRight->u.zToken, "rowcount") == 0)) + if ((pLeft && (pLeft->op == TK_ID)) + && (pRight && (pRight->op == TK_ID)) + && (strcasecmp(pLeft->u.zToken, "sql") == 0) + && (strcasecmp(pRight->u.zToken, "rowcount") == 0)) { - char sqlrowcount[13]; // strlen("sql") + strlen("%") + strlen("rowcount") + 1 + char sqlrowcount[13]; // strlen("sql") + strlen("%") + strlen("rowcount") + 1 sprintf(sqlrowcount, "%s%%%s", pLeft->u.zToken, pRight->u.zToken); update_function_info(pAliases, sqlrowcount, pExclude); @@ -1052,8 +1052,10 @@ public: if (zName) { - update_function_info(pAliases, zName, - pExpr->x.pSelect->pEList, pExclude); + update_function_info(pAliases, + zName, + pExpr->x.pSelect->pEList, + pExclude); } } else @@ -1062,8 +1064,10 @@ public: if (zName) { - update_function_info(pAliases, zName, - pExpr->x.pList, pExclude); + update_function_info(pAliases, + zName, + pExpr->x.pList, + pExclude); } } } @@ -1098,8 +1102,8 @@ public: } else if (pExpr->op == TK_DOT) { - if (pExpr->pLeft->op == TK_ID && - (pExpr->pRight->op == TK_ID || pExpr->pRight->op == TK_ASTERISK)) + if (pExpr->pLeft->op == TK_ID + && (pExpr->pRight->op == TK_ID || pExpr->pRight->op == TK_ASTERISK)) { // select a.b from... zTable = pExpr->pLeft->u.zToken; @@ -1112,10 +1116,10 @@ public: zColumn = (char*)"*"; } } - else if (pExpr->pLeft->op == TK_ID && - pExpr->pRight->op == TK_DOT && - pExpr->pRight->pLeft->op == TK_ID && - (pExpr->pRight->pRight->op == TK_ID || pExpr->pRight->pRight->op == TK_ASTERISK)) + else if (pExpr->pLeft->op == TK_ID + && pExpr->pRight->op == TK_DOT + && pExpr->pRight->pLeft->op == TK_ID + && (pExpr->pRight->pRight->op == TK_ID || pExpr->pRight->pRight->op == TK_ASTERISK)) { // select a.b.c from... zDatabase = pExpr->pLeft->u.zToken; @@ -1240,19 +1244,23 @@ public: { m_has_clause = true; update_field_infos(&aliases, - 0, pSelect->pWhere, QC_TOKEN_MIDDLE, pSelect->pEList); + 0, + pSelect->pWhere, + QC_TOKEN_MIDDLE, + pSelect->pEList); } if (pSelect->pGroupBy) { update_field_infos_from_exprlist(&aliases, - pSelect->pGroupBy, pSelect->pEList); + pSelect->pGroupBy, + pSelect->pEList); } if (pSelect->pHaving) { m_has_clause = true; -#if defined(COLLECT_HAVING_AS_WELL) +#if defined (COLLECT_HAVING_AS_WELL) // A HAVING clause can only refer to fields that already have been // mentioned. Consequently, they need not be collected. update_field_infos(aliases, 0, pSelect->pHaving, 0, QC_TOKEN_MIDDLE, pSelect->pEList); @@ -1272,7 +1280,9 @@ public: while (pPrior) { - update_field_infos_from_subselect(aliases, pPrior, pExclude, + update_field_infos_from_subselect(aliases, + pPrior, + pExclude, IGNORE_COMPOUND_SELECTS); pPrior = pPrior->pPrior; } @@ -1335,9 +1345,9 @@ public: vector::iterator i = find_if(fields.begin(), fields.end(), predicate); - if (i == fields.end()) // Not present + if (i == fields.end()) // Not present { - //TODO: Add exclusion? + // TODO: Add exclusion? QC_FIELD_INFO item; item.database = zDatabase ? MXS_STRDUP(zDatabase) : NULL; @@ -1384,8 +1394,8 @@ public: } static void update_function_fields(const QcAliases* pAliases, - const ExprList* pEList, - const ExprList* pExclude, + const ExprList* pEList, + const ExprList* pExclude, vector& fields) { for (int i = 0; i < pEList->nExpr; ++i) @@ -1415,7 +1425,7 @@ public: name = map_function_name(m_pFunction_name_mappings, name); - QC_FUNCTION_INFO item = { (char*)name }; + QC_FUNCTION_INFO item = {(char*)name}; size_t i; for (i = 0; i < m_function_infos.size(); ++i) @@ -1428,7 +1438,7 @@ public: } } - if (i == m_function_infos.size()) // If true, the function was not present already. + if (i == m_function_infos.size()) // If true, the function was not present already. { mxb_assert(item.name); item.name = MXS_STRDUP(item.name); @@ -1461,7 +1471,7 @@ public: if (fields.size() != 0) { info.fields = &fields[0]; - info.n_fields = fields.size(); + info.n_fields = fields.size(); } } @@ -1537,16 +1547,18 @@ public: } } - void mxs_sqlite3BeginTrigger(Parse *pParse, /* The parse context of the CREATE TRIGGER statement */ - Token *pName1, /* The name of the trigger */ - Token *pName2, /* The name of the trigger */ - int tr_tm, /* One of TK_BEFORE, TK_AFTER, TK_INSTEAD */ - int op, /* One of TK_INSERT, TK_UPDATE, TK_DELETE */ - IdList *pColumns, /* column list if this is an UPDATE OF trigger */ - SrcList *pTableName,/* The name of the table/view the trigger applies to */ - Expr *pWhen, /* WHEN clause */ - int isTemp, /* True if the TEMPORARY keyword is present */ - int noErr) /* Suppress errors if the trigger already exists */ + void mxs_sqlite3BeginTrigger(Parse* pParse, /* The parse context of the CREATE TRIGGER statement + * */ + Token* pName1, /* The name of the trigger */ + Token* pName2, /* The name of the trigger */ + int tr_tm, /* One of TK_BEFORE, TK_AFTER, TK_INSTEAD */ + int op, /* One of TK_INSERT, TK_UPDATE, TK_DELETE */ + IdList* pColumns, /* column list if this is an UPDATE OF trigger */ + SrcList* pTableName, /* The name of the table/view the trigger applies to + * */ + Expr* pWhen, /* WHEN clause */ + int isTemp, /* True if the TEMPORARY keyword is present */ + int noErr) /* Suppress errors if the trigger already exists */ { mxb_assert(this_thread.initialized); @@ -1567,8 +1579,16 @@ public: } // We need to call this, otherwise finish trigger will not be called. - exposed_sqlite3BeginTrigger(pParse, pName1, pName2, tr_tm, op, pColumns, - pTableName, pWhen, isTemp, noErr); + exposed_sqlite3BeginTrigger(pParse, + pName1, + pName2, + tr_tm, + op, + pColumns, + pTableName, + pWhen, + isTemp, + noErr); } void mxs_sqlite3CommitTransaction(Parse* pParse) @@ -1579,16 +1599,16 @@ public: m_type_mask = QUERY_TYPE_COMMIT; } - void mxs_sqlite3CreateIndex(Parse *pParse, /* All information about this parse */ - Token *pName1, /* First part of index name. May be NULL */ - Token *pName2, /* Second part of index name. May be NULL */ - SrcList *pTblName, /* Table to index. Use pParse->pNewTable if 0 */ - ExprList *pList, /* A list of columns to be indexed */ - int onError, /* OE_Abort, OE_Ignore, OE_Replace, or OE_None */ - Token *pStart, /* The CREATE token that begins this statement */ - Expr *pPIWhere, /* WHERE clause for partial indices */ - int sortOrder, /* Sort order of primary key when pList==NULL */ - int ifNotExist) /* Omit error if index already exists */ + void mxs_sqlite3CreateIndex(Parse* pParse, /* All information about this parse */ + Token* pName1, /* First part of index name. May be NULL */ + Token* pName2, /* Second part of index name. May be NULL */ + SrcList* pTblName, /* Table to index. Use pParse->pNewTable if 0 */ + ExprList* pList, /* A list of columns to be indexed */ + int onError, /* OE_Abort, OE_Ignore, OE_Replace, or OE_None */ + Token* pStart, /* The CREATE token that begins this statement */ + Expr* pPIWhere, /* WHERE clause for partial indices */ + int sortOrder, /* Sort order of primary key when pList==NULL */ + int ifNotExist) /* Omit error if index already exists */ { mxb_assert(this_thread.initialized); @@ -1610,14 +1630,14 @@ public: exposed_sqlite3SrcListDelete(pParse->db, pTblName); } - void mxs_sqlite3CreateView(Parse *pParse, /* The parsing context */ - Token *pBegin, /* The CREATE token that begins the statement */ - Token *pName1, /* The token that holds the name of the view */ - Token *pName2, /* The token that holds the name of the view */ - ExprList *pCNames, /* Optional list of view column names */ - Select *pSelect, /* A SELECT statement that will become the new view */ - int isTemp, /* TRUE for a TEMPORARY view */ - int noErr) /* Suppress error messages if VIEW already exists */ + void mxs_sqlite3CreateView(Parse* pParse, /* The parsing context */ + Token* pBegin, /* The CREATE token that begins the statement */ + Token* pName1, /* The token that holds the name of the view */ + Token* pName2, /* The token that holds the name of the view */ + ExprList* pCNames, /* Optional list of view column names */ + Select* pSelect, /* A SELECT statement that will become the new view */ + int isTemp, /* TRUE for a TEMPORARY view */ + int noErr) /* Suppress error messages if VIEW already exists */ { mxb_assert(this_thread.initialized); @@ -1742,7 +1762,7 @@ public: exposed_sqlite3SrcListDelete(pParse->db, pTable); } - void mxs_sqlite3DropTable(Parse *pParse, SrcList *pName, int isView, int noErr, int isTemp) + void mxs_sqlite3DropTable(Parse* pParse, SrcList* pName, int isView, int noErr, int isTemp) { mxb_assert(this_thread.initialized); @@ -1762,12 +1782,12 @@ public: exposed_sqlite3SrcListDelete(pParse->db, pName); } - void mxs_sqlite3EndTable(Parse *pParse, /* Parse context */ - Token *pCons, /* The ',' token after the last column defn. */ - Token *pEnd, /* The ')' before options in the CREATE TABLE */ - u8 tabOpts, /* Extra table options. Usually 0. */ - Select *pSelect, /* Select from a "CREATE ... AS SELECT" */ - SrcList* pOldTable) /* The old table in "CREATE ... LIKE OldTable" */ + void mxs_sqlite3EndTable(Parse* pParse, /* Parse context */ + Token* pCons, /* The ',' token after the last column defn. */ + Token* pEnd, /* The ')' before options in the CREATE TABLE */ + u8 tabOpts, /* Extra table options. Usually 0. */ + Select* pSelect, /* Select from a "CREATE ... AS SELECT" */ + SrcList* pOldTable)/* The old table in "CREATE ... LIKE OldTable" */ { mxb_assert(this_thread.initialized); @@ -1785,8 +1805,8 @@ public: void mxs_sqlite3Insert(Parse* pParse, SrcList* pTabList, - Select* pSelect, - IdList* pColumns, + Select* pSelect, + IdList* pColumns, int onError, ExprList* pSet) { @@ -1825,7 +1845,7 @@ public: QC_FUNCTION_INFO& info = m_function_infos[i]; info.fields = &fields[0]; - info.n_fields = fields.size(); + info.n_fields = fields.size(); } } } @@ -1870,9 +1890,9 @@ public: // NOTE: By convention, the select is deleted in parse.y. } - void mxs_sqlite3StartTable(Parse *pParse, /* Parser context */ - Token *pName1, /* First part of the name of the table or view */ - Token *pName2, /* Second part of the name of the table or view */ + void mxs_sqlite3StartTable(Parse* pParse, /* Parser context */ + Token* pName1, /* First part of the name of the table or view */ + Token* pName2, /* Second part of the name of the table or view */ int isTemp, /* True if this is a TEMP table */ int isView, /* True if this is a VIEW */ int isVirtual, /* True if this is a VIRTUAL table */ @@ -1952,7 +1972,10 @@ public: ExprList::ExprList_item* pItem = &pChanges->a[i]; update_field_infos(&aliases, - 0, pItem->pExpr, QC_TOKEN_MIDDLE, NULL); + 0, + pItem->pExpr, + QC_TOKEN_MIDDLE, + NULL); } } @@ -1967,7 +1990,7 @@ public: exposed_sqlite3ExprDelete(pParse->db, pWhere); } - void mxs_sqlite3Savepoint(Parse *pParse, int op, Token *pName) + void mxs_sqlite3Savepoint(Parse* pParse, int op, Token* pName) { mxb_assert(this_thread.initialized); @@ -1996,10 +2019,10 @@ public: update_field_infos_from_select(aliases, pSelect, NULL); } - void maxscaleAlterTable(Parse *pParse, /* Parser context. */ + void maxscaleAlterTable(Parse* pParse, /* Parser context. */ mxs_alter_t command, - SrcList *pSrc, /* The table to rename. */ - Token *pName) /* The new table name (RENAME). */ + SrcList* pSrc, /* The table to rename. */ + Token* pName) /* The new table name (RENAME). */ { mxb_assert(this_thread.initialized); @@ -2245,17 +2268,17 @@ public: { if (pNext->z) { - const char EXTENDED[] = "EXTENDED"; + const char EXTENDED[] = "EXTENDED"; const char PARTITIONS[] = "PARTITIONS"; - const char FORMAT[] = "FORMAT"; - const char FOR[] = "FOR"; + const char FORMAT[] = "FORMAT"; + const char FOR[] = "FOR"; -#define MATCHES_KEYWORD(t, k) ((t->n == sizeof(k) - 1) && (strncasecmp(t->z, k, t->n) == 0)) +#define MATCHES_KEYWORD(t, k) ((t->n == sizeof(k) - 1) && (strncasecmp(t->z, k, t->n) == 0)) - if (MATCHES_KEYWORD(pNext, EXTENDED) || - MATCHES_KEYWORD(pNext, PARTITIONS) || - MATCHES_KEYWORD(pNext, FORMAT) || - MATCHES_KEYWORD(pNext, FOR)) + if (MATCHES_KEYWORD(pNext, EXTENDED) + || MATCHES_KEYWORD(pNext, PARTITIONS) + || MATCHES_KEYWORD(pNext, FORMAT) + || MATCHES_KEYWORD(pNext, FOR)) { m_operation = QUERY_OP_EXPLAIN; } @@ -2315,7 +2338,7 @@ public: m_status = QC_QUERY_PARSED; m_type_mask = QUERY_TYPE_WRITE; - m_operation = local ? QUERY_OP_LOAD_LOCAL: QUERY_OP_LOAD; + m_operation = local ? QUERY_OP_LOAD_LOCAL : QUERY_OP_LOAD; if (pFullName) { @@ -2622,7 +2645,7 @@ public: mxb_assert(pItem->zAlias); update_names(pItem->zDatabase, pItem->zName, NULL, NULL); - update_names(NULL, pItem->zAlias, NULL, NULL); // The new name is passed in the alias field. + update_names(NULL, pItem->zAlias, NULL, NULL); // The new name is passed in the alias field. } exposed_sqlite3SrcListDelete(pParse->db, pTables); @@ -2720,7 +2743,7 @@ public: mxb_assert(this_thread.initialized); m_status = QC_QUERY_PARSED; - m_type_mask = 0; // Reset what was set in maxscaleKeyword + m_type_mask = 0; // Reset what was set in maxscaleKeyword switch (kind) { @@ -3015,9 +3038,11 @@ private: , m_has_clause(false) , m_zCreated_table_name(NULL) , m_is_drop_table(false) - , m_keyword_1(0) // Sqlite3 starts numbering tokens from 1, so 0 means - , m_keyword_2(0) // that we have not seen a keyword. - , m_zPrepare_name(NULL) + , m_keyword_1(0) + , // Sqlite3 starts numbering tokens from 1, so 0 means + m_keyword_2(0) + , // that we have not seen a keyword. + m_zPrepare_name(NULL) , m_pPreparable_stmt(NULL) , m_sql_mode(this_thread.sql_mode) , m_pFunction_name_mappings(this_thread.pFunction_name_mappings) @@ -3043,7 +3068,7 @@ private: private: bool should_collect(qc_collect_info_t collect) const { - return ((m_collect & collect) && !(m_collected & collect)); + return (m_collect & collect) && !(m_collected & collect); } static void free_field_infos(QC_FIELD_INFO* pInfos, size_t nInfos) @@ -3144,8 +3169,10 @@ private: return (i != m_database_names.size()) ? m_database_names[i] : NULL; } - const char* update_table_names(const char* zDatabase, size_t nDatabase, - const char* zTable, size_t nTable) + const char* update_table_names(const char* zDatabase, + size_t nDatabase, + const char* zTable, + size_t nTable) { mxb_assert(zTable && nTable); @@ -3212,85 +3239,101 @@ public: const char* m_pQuery; // The query passed to sqlite. size_t m_nQuery; // The length of the query. - uint32_t m_type_mask; // The type mask of the query. - qc_query_op_t m_operation; // The operation in question. - bool m_has_clause; // Has WHERE or HAVING. - vector m_table_names; // Vector of table names used in the query. - vector m_table_fullnames; // Vector of qualified table names used in the query. - char* m_zCreated_table_name; // The name of a created table. - bool m_is_drop_table; // Is the query a DROP TABLE. - vector m_database_names; // Vector of database names used in the query. - int m_keyword_1; // The first encountered keyword. - int m_keyword_2; // The second encountered keyword. - char* m_zPrepare_name; // The name of a prepared statement. - GWBUF* m_pPreparable_stmt; // The preparable statement. - vector m_field_infos; // Vector of fields used by the statement. - vector m_function_infos; // Vector of functions used by the statement. - vector > m_function_field_usage; // Vector of vector fields used by functions - // of the statement. Data referred to from - // m_function_infos - size_t m_function_infos_len; // The used entries in function_infos. - size_t m_function_infos_capacity; // The capacity of the function_infos array. - qc_sql_mode_t m_sql_mode; // The current sql_mode. - QC_NAME_MAPPING* m_pFunction_name_mappings; // How function names should be mapped. + uint32_t m_type_mask; // The type mask of the query. + qc_query_op_t m_operation; // The operation in question. + bool m_has_clause; // Has WHERE or HAVING. + vector m_table_names; // Vector of table names used in the query. + vector m_table_fullnames; // Vector of qualified table names used in the + // query. + char* m_zCreated_table_name; // The name of a created table. + bool m_is_drop_table; // Is the query a DROP TABLE. + vector m_database_names; // Vector of database names used in the query. + int m_keyword_1; // The first encountered keyword. + int m_keyword_2; // The second encountered keyword. + char* m_zPrepare_name; // The name of a prepared statement. + GWBUF* m_pPreparable_stmt; // The preparable statement. + vector m_field_infos; // Vector of fields used by the statement. + vector m_function_infos; // Vector of functions used by the statement. + vector> m_function_field_usage; // Vector of vector fields used by functions + // of the statement. Data referred to from + // m_function_infos + size_t m_function_infos_len; // The used entries in function_infos. + size_t m_function_infos_capacity; // The capacity of the function_infos array. + qc_sql_mode_t m_sql_mode; // The current sql_mode. + QC_NAME_MAPPING* m_pFunction_name_mappings; // How function names should be mapped. }; extern "C" { -extern void mxs_sqlite3AlterFinishAddColumn(Parse *, Token *); -extern void mxs_sqlite3AlterBeginAddColumn(Parse *, SrcList *); -extern void mxs_sqlite3Analyze(Parse *, SrcList *); -extern void mxs_sqlite3BeginTransaction(Parse*, int token, int type); -extern void mxs_sqlite3CommitTransaction(Parse*); -extern void mxs_sqlite3CreateIndex(Parse*,Token*,Token*,SrcList*,ExprList*,int,Token*, - Expr*, int, int); -extern void mxs_sqlite3BeginTrigger(Parse*, Token*,Token*,int,int,IdList*,SrcList*, - Expr*,int, int); -extern void mxs_sqlite3FinishTrigger(Parse*, TriggerStep*, Token*); -extern void mxs_sqlite3CreateView(Parse*,Token*,Token*,Token*,ExprList*,Select*,int,int); -extern void mxs_sqlite3DeleteFrom(Parse* pParse, SrcList* pTabList, Expr* pWhere, SrcList* pUsing); -extern void mxs_sqlite3DropIndex(Parse*, SrcList*, SrcList*,int); -extern void mxs_sqlite3DropTable(Parse*, SrcList*, int, int, int); -extern void mxs_sqlite3EndTable(Parse*, Token*, Token*, u8, Select*, SrcList*); -extern void mxs_sqlite3Insert(Parse*, SrcList*, Select*, IdList*, int,ExprList*); -extern void mxs_sqlite3RollbackTransaction(Parse*); -extern void mxs_sqlite3Savepoint(Parse *pParse, int op, Token *pName); -extern int mxs_sqlite3Select(Parse*, Select*, SelectDest*); -extern void mxs_sqlite3StartTable(Parse*,Token*,Token*,int,int,int,int); -extern void mxs_sqlite3Update(Parse*, SrcList*, ExprList*, Expr*, int); + extern void mxs_sqlite3AlterFinishAddColumn(Parse*, Token*); + extern void mxs_sqlite3AlterBeginAddColumn(Parse*, SrcList*); + extern void mxs_sqlite3Analyze(Parse*, SrcList*); + extern void mxs_sqlite3BeginTransaction(Parse*, int token, int type); + extern void mxs_sqlite3CommitTransaction(Parse*); + extern void mxs_sqlite3CreateIndex(Parse*, + Token*, + Token*, + SrcList*, + ExprList*, + int, + Token*, + Expr*, + int, + int); + extern void mxs_sqlite3BeginTrigger(Parse*, + Token*, + Token*, + int, + int, + IdList*, + SrcList*, + Expr*, + int, + int); + extern void mxs_sqlite3FinishTrigger(Parse*, TriggerStep*, Token*); + extern void mxs_sqlite3CreateView(Parse*, Token*, Token*, Token*, ExprList*, Select*, int, int); + extern void mxs_sqlite3DeleteFrom(Parse* pParse, SrcList* pTabList, Expr* pWhere, SrcList* pUsing); + extern void mxs_sqlite3DropIndex(Parse*, SrcList*, SrcList*, int); + extern void mxs_sqlite3DropTable(Parse*, SrcList*, int, int, int); + extern void mxs_sqlite3EndTable(Parse*, Token*, Token*, u8, Select*, SrcList*); + extern void mxs_sqlite3Insert(Parse*, SrcList*, Select*, IdList*, int, ExprList*); + extern void mxs_sqlite3RollbackTransaction(Parse*); + extern void mxs_sqlite3Savepoint(Parse* pParse, int op, Token* pName); + extern int mxs_sqlite3Select(Parse*, Select*, SelectDest*); + extern void mxs_sqlite3StartTable(Parse*, Token*, Token*, int, int, int, int); + extern void mxs_sqlite3Update(Parse*, SrcList*, ExprList*, Expr*, int); -extern void maxscaleCollectInfoFromSelect(Parse*, Select*, int); + extern void maxscaleCollectInfoFromSelect(Parse*, Select*, int); -extern void maxscaleAlterTable(Parse*, mxs_alter_t command, SrcList*, Token*); -extern void maxscaleCall(Parse*, SrcList* pName, ExprList* pExprList); -extern void maxscaleCheckTable(Parse*, SrcList* pTables); -extern void maxscaleCreateSequence(Parse*, Token* pDatabase, Token* pTable); -extern void maxscaleDeclare(Parse* pParse); -extern void maxscaleDeallocate(Parse*, Token* pName); -extern void maxscaleDo(Parse*, ExprList* pEList); -extern void maxscaleDrop(Parse*, int what, Token* pDatabase, Token* pName); -extern void maxscaleExecute(Parse*, Token* pName, int type_mask); -extern void maxscaleExecuteImmediate(Parse*, Token* pName, ExprSpan* pExprSpan, int type_mask); -extern void maxscaleExplain(Parse*, Token* pNext); -extern void maxscaleFlush(Parse*, Token* pWhat); -extern void maxscaleHandler(Parse*, mxs_handler_t, SrcList* pFullName, Token* pName); -extern void maxscaleLoadData(Parse*, SrcList* pFullName, int local); -extern void maxscaleLock(Parse*, mxs_lock_t, SrcList*); -extern void maxscalePrepare(Parse*, Token* pName, Expr* pStmt); -extern void maxscalePrivileges(Parse*, int kind); -extern void maxscaleRenameTable(Parse*, SrcList* pTables); -extern void maxscaleSet(Parse*, int scope, mxs_set_t kind, ExprList*); -extern void maxscaleShow(Parse*, MxsShow* pShow); -extern void maxscaleTruncate(Parse*, Token* pDatabase, Token* pName); -extern void maxscaleUse(Parse*, Token*); + extern void maxscaleAlterTable(Parse*, mxs_alter_t command, SrcList*, Token*); + extern void maxscaleCall(Parse*, SrcList* pName, ExprList* pExprList); + extern void maxscaleCheckTable(Parse*, SrcList* pTables); + extern void maxscaleCreateSequence(Parse*, Token* pDatabase, Token* pTable); + extern void maxscaleDeclare(Parse* pParse); + extern void maxscaleDeallocate(Parse*, Token* pName); + extern void maxscaleDo(Parse*, ExprList* pEList); + extern void maxscaleDrop(Parse*, int what, Token* pDatabase, Token* pName); + extern void maxscaleExecute(Parse*, Token* pName, int type_mask); + extern void maxscaleExecuteImmediate(Parse*, Token* pName, ExprSpan* pExprSpan, int type_mask); + extern void maxscaleExplain(Parse*, Token* pNext); + extern void maxscaleFlush(Parse*, Token* pWhat); + extern void maxscaleHandler(Parse*, mxs_handler_t, SrcList* pFullName, Token* pName); + extern void maxscaleLoadData(Parse*, SrcList* pFullName, int local); + extern void maxscaleLock(Parse*, mxs_lock_t, SrcList*); + extern void maxscalePrepare(Parse*, Token* pName, Expr* pStmt); + extern void maxscalePrivileges(Parse*, int kind); + extern void maxscaleRenameTable(Parse*, SrcList* pTables); + extern void maxscaleSet(Parse*, int scope, mxs_set_t kind, ExprList*); + extern void maxscaleShow(Parse*, MxsShow* pShow); + extern void maxscaleTruncate(Parse*, Token* pDatabase, Token* pName); + extern void maxscaleUse(Parse*, Token*); -extern void maxscale_update_function_info(const char* name, const Expr* pExpr); - -extern void maxscaleComment(); -extern int maxscaleKeyword(int token); -extern int maxscaleTranslateKeyword(int token); + extern void maxscale_update_function_info(const char* name, const Expr* pExpr); + extern void maxscaleComment(); + extern int maxscaleKeyword(int token); + extern int maxscaleTranslateKeyword(int token); } /** @@ -3336,7 +3379,7 @@ static void parse_query_string(const char* query, int len, bool suppress_logging mxb_assert(this_thread.pDb); int rc = sqlite3_prepare(this_thread.pDb, query, len, &stmt, &tail); - const int max_len = 512; // Maximum length of logged statement. + const int max_len = 512; // Maximum length of logged statement. const int l = (len > max_len ? max_len : len); const char* suffix = (len > max_len ? "..." : ""); const char* format; @@ -3350,17 +3393,17 @@ static void parse_query_string(const char* query, int len, bool suppress_logging { if (qc_info_was_tokenized(this_thread.pInfo->m_status)) { - format = - "Statement was classified only based on keywords " - "(Sqlite3 error: %s, %s): \"%.*s%s\""; + format + = "Statement was classified only based on keywords " + "(Sqlite3 error: %s, %s): \"%.*s%s\""; } else { if (qc_info_was_parsed(this_thread.pInfo->m_status)) { - format = - "Statement was only partially parsed " - "(Sqlite3 error: %s, %s): \"%.*s%s\""; + format + = "Statement was only partially parsed " + "(Sqlite3 error: %s, %s): \"%.*s%s\""; // The status was set to QC_QUERY_PARSED, but sqlite3 returned an // error. Most likely, query contains some excess unrecognized stuff. @@ -3368,9 +3411,9 @@ static void parse_query_string(const char* query, int len, bool suppress_logging } else { - format = - "Statement was neither parsed nor recognized from keywords " - "(Sqlite3 error: %s, %s): \"%.*s%s\""; + format + = "Statement was neither parsed nor recognized from keywords " + "(Sqlite3 error: %s, %s): \"%.*s%s\""; } } @@ -3401,22 +3444,26 @@ static void parse_query_string(const char* query, int len, bool suppress_logging if (log_warning) { - MXS_WARNING(format, sqlite3_errstr(rc), - sqlite3_errmsg(this_thread.pDb), l, query, suffix); + MXS_WARNING(format, + sqlite3_errstr(rc), + sqlite3_errmsg(this_thread.pDb), + l, + query, + suffix); } } } } - else if (this_thread.initialized) // If we are initializing, the query will not be classified. + else if (this_thread.initialized) // If we are initializing, the query will not be classified. { if (!suppress_logging && (this_unit.log_level > QC_LOG_NOTHING)) { if (qc_info_was_tokenized(this_thread.pInfo->m_status)) { // This suggests a callback from the parser into this module is not made. - format = - "Statement was classified only based on keywords, " - "even though the statement was parsed: \"%.*s%s\""; + format + = "Statement was classified only based on keywords, " + "even though the statement was parsed: \"%.*s%s\""; MXS_WARNING(format, l, query, suffix); } @@ -3447,8 +3494,8 @@ static bool parse_query(GWBUF* query, uint32_t collect) { uint8_t* data = (uint8_t*) GWBUF_DATA(query); - if ((GWBUF_LENGTH(query) >= MYSQL_HEADER_LEN + 1) && - (GWBUF_LENGTH(query) == MYSQL_HEADER_LEN + MYSQL_GET_PAYLOAD_LEN(data))) + if ((GWBUF_LENGTH(query) >= MYSQL_HEADER_LEN + 1) + && (GWBUF_LENGTH(query) == MYSQL_HEADER_LEN + MYSQL_GET_PAYLOAD_LEN(data))) { uint8_t command = MYSQL_GET_COMMAND(data); @@ -3456,8 +3503,8 @@ static bool parse_query(GWBUF* query, uint32_t collect) { bool suppress_logging = false; - QcSqliteInfo* pInfo = - (QcSqliteInfo*) gwbuf_get_buffer_object_data(query, GWBUF_PARSING_INFO); + QcSqliteInfo* pInfo + = (QcSqliteInfo*) gwbuf_get_buffer_object_data(query, GWBUF_PARSING_INFO); if (pInfo) { @@ -3493,7 +3540,7 @@ static bool parse_query(GWBUF* query, uint32_t collect) { this_thread.pInfo = pInfo; - size_t len = MYSQL_GET_PAYLOAD_LEN(data) - 1; // Subtract 1 for packet type byte. + size_t len = MYSQL_GET_PAYLOAD_LEN(data) - 1; // Subtract 1 for packet type byte. const char* s = (const char*) &data[MYSQL_HEADER_LEN + 1]; @@ -3573,7 +3620,7 @@ static void log_invalid_data(GWBUF* query, const char* message) if (GWBUF_LENGTH(query) >= MYSQL_HEADER_LEN + 1) { - char *sql; + char* sql; int length; if (modutil_extract_SQL(query, &sql, &length)) @@ -3784,24 +3831,32 @@ void mxs_sqlite3BeginTransaction(Parse* pParse, int token, int type) QC_EXCEPTION_GUARD(pInfo->mxs_sqlite3BeginTransaction(pParse, token, type)); } -void mxs_sqlite3BeginTrigger(Parse *pParse, /* The parse context of the CREATE TRIGGER statement */ - Token *pName1, /* The name of the trigger */ - Token *pName2, /* The name of the trigger */ - int tr_tm, /* One of TK_BEFORE, TK_AFTER, TK_INSTEAD */ - int op, /* One of TK_INSERT, TK_UPDATE, TK_DELETE */ - IdList *pColumns, /* column list if this is an UPDATE OF trigger */ - SrcList *pTableName,/* The name of the table/view the trigger applies to */ - Expr *pWhen, /* WHEN clause */ - int isTemp, /* True if the TEMPORARY keyword is present */ - int noErr) /* Suppress errors if the trigger already exists */ +void mxs_sqlite3BeginTrigger(Parse* pParse, /* The parse context of the CREATE TRIGGER statement */ + Token* pName1, /* The name of the trigger */ + Token* pName2, /* The name of the trigger */ + int tr_tm, /* One of TK_BEFORE, TK_AFTER, TK_INSTEAD */ + int op, /* One of TK_INSERT, TK_UPDATE, TK_DELETE */ + IdList* pColumns, /* column list if this is an UPDATE OF trigger */ + SrcList* pTableName, /* The name of the table/view the trigger applies to */ + Expr* pWhen, /* WHEN clause */ + int isTemp, /* True if the TEMPORARY keyword is present */ + int noErr) /* Suppress errors if the trigger already exists */ { QC_TRACE(); QcSqliteInfo* pInfo = this_thread.pInfo; mxb_assert(pInfo); - QC_EXCEPTION_GUARD(pInfo->mxs_sqlite3BeginTrigger(pParse, pName1, pName2, tr_tm, op, - pColumns, pTableName, pWhen, isTemp, noErr)); + QC_EXCEPTION_GUARD(pInfo->mxs_sqlite3BeginTrigger(pParse, + pName1, + pName2, + tr_tm, + op, + pColumns, + pTableName, + pWhen, + isTemp, + noErr)); } void mxs_sqlite3CommitTransaction(Parse* pParse) @@ -3814,41 +3869,55 @@ void mxs_sqlite3CommitTransaction(Parse* pParse) QC_EXCEPTION_GUARD(pInfo->mxs_sqlite3CommitTransaction(pParse)); } -void mxs_sqlite3CreateIndex(Parse *pParse, /* All information about this parse */ - Token *pName1, /* First part of index name. May be NULL */ - Token *pName2, /* Second part of index name. May be NULL */ - SrcList *pTblName, /* Table to index. Use pParse->pNewTable if 0 */ - ExprList *pList, /* A list of columns to be indexed */ - int onError, /* OE_Abort, OE_Ignore, OE_Replace, or OE_None */ - Token *pStart, /* The CREATE token that begins this statement */ - Expr *pPIWhere, /* WHERE clause for partial indices */ - int sortOrder, /* Sort order of primary key when pList==NULL */ - int ifNotExist) /* Omit error if index already exists */ +void mxs_sqlite3CreateIndex(Parse* pParse, /* All information about this parse */ + Token* pName1, /* First part of index name. May be NULL */ + Token* pName2, /* Second part of index name. May be NULL */ + SrcList* pTblName, /* Table to index. Use pParse->pNewTable if 0 */ + ExprList* pList, /* A list of columns to be indexed */ + int onError, /* OE_Abort, OE_Ignore, OE_Replace, or OE_None */ + Token* pStart, /* The CREATE token that begins this statement */ + Expr* pPIWhere, /* WHERE clause for partial indices */ + int sortOrder, /* Sort order of primary key when pList==NULL */ + int ifNotExist) /* Omit error if index already exists */ { QC_TRACE(); QcSqliteInfo* pInfo = this_thread.pInfo; mxb_assert(pInfo); - QC_EXCEPTION_GUARD(pInfo->mxs_sqlite3CreateIndex(pParse, pName1, pName2, pTblName, pList, - onError, pStart, pPIWhere, sortOrder, ifNotExist)); + QC_EXCEPTION_GUARD(pInfo->mxs_sqlite3CreateIndex(pParse, + pName1, + pName2, + pTblName, + pList, + onError, + pStart, + pPIWhere, + sortOrder, + ifNotExist)); } -void mxs_sqlite3CreateView(Parse *pParse, /* The parsing context */ - Token *pBegin, /* The CREATE token that begins the statement */ - Token *pName1, /* The token that holds the name of the view */ - Token *pName2, /* The token that holds the name of the view */ - ExprList *pCNames, /* Optional list of view column names */ - Select *pSelect, /* A SELECT statement that will become the new view */ - int isTemp, /* TRUE for a TEMPORARY view */ - int noErr) /* Suppress error messages if VIEW already exists */ +void mxs_sqlite3CreateView(Parse* pParse, /* The parsing context */ + Token* pBegin, /* The CREATE token that begins the statement */ + Token* pName1, /* The token that holds the name of the view */ + Token* pName2, /* The token that holds the name of the view */ + ExprList* pCNames, /* Optional list of view column names */ + Select* pSelect, /* A SELECT statement that will become the new view */ + int isTemp, /* TRUE for a TEMPORARY view */ + int noErr) /* Suppress error messages if VIEW already exists */ { QC_TRACE(); QcSqliteInfo* pInfo = this_thread.pInfo; mxb_assert(pInfo); - QC_EXCEPTION_GUARD(pInfo->mxs_sqlite3CreateView(pParse, pBegin, pName1, pName2, - pCNames, pSelect, isTemp, noErr)); + QC_EXCEPTION_GUARD(pInfo->mxs_sqlite3CreateView(pParse, + pBegin, + pName1, + pName2, + pCNames, + pSelect, + isTemp, + noErr)); } void mxs_sqlite3DeleteFrom(Parse* pParse, SrcList* pTabList, Expr* pWhere, SrcList* pUsing) @@ -3871,7 +3940,7 @@ void mxs_sqlite3DropIndex(Parse* pParse, SrcList* pName, SrcList* pTable, int bi QC_EXCEPTION_GUARD(pInfo->mxs_sqlite3DropIndex(pParse, pName, pTable, bits)); } -void mxs_sqlite3DropTable(Parse *pParse, SrcList *pName, int isView, int noErr, int isTemp) +void mxs_sqlite3DropTable(Parse* pParse, SrcList* pName, int isView, int noErr, int isTemp) { QC_TRACE(); @@ -3881,12 +3950,12 @@ void mxs_sqlite3DropTable(Parse *pParse, SrcList *pName, int isView, int noErr, QC_EXCEPTION_GUARD(pInfo->mxs_sqlite3DropTable(pParse, pName, isView, noErr, isTemp)); } -void mxs_sqlite3EndTable(Parse *pParse, /* Parse context */ - Token *pCons, /* The ',' token after the last column defn. */ - Token *pEnd, /* The ')' before options in the CREATE TABLE */ - u8 tabOpts, /* Extra table options. Usually 0. */ - Select *pSelect, /* Select from a "CREATE ... AS SELECT" */ - SrcList* pOldTable) /* The old table in "CREATE ... LIKE OldTable" */ +void mxs_sqlite3EndTable(Parse* pParse, /* Parse context */ + Token* pCons, /* The ',' token after the last column defn. */ + Token* pEnd, /* The ')' before options in the CREATE TABLE */ + u8 tabOpts, /* Extra table options. Usually 0. */ + Select* pSelect, /* Select from a "CREATE ... AS SELECT" */ + SrcList* pOldTable)/* The old table in "CREATE ... LIKE OldTable" */ { QC_TRACE(); @@ -3903,9 +3972,9 @@ void mxs_sqlite3EndTable(Parse *pParse, /* Parse context */ } } -void mxs_sqlite3FinishTrigger(Parse *pParse, /* Parser context */ - TriggerStep *pStepList, /* The triggered program */ - Token *pAll) /* Token that describes the complete CREATE TRIGGER */ +void mxs_sqlite3FinishTrigger(Parse* pParse, /* Parser context */ + TriggerStep* pStepList, /* The triggered program */ + Token* pAll) /* Token that describes the complete CREATE TRIGGER */ { QC_TRACE(); @@ -3914,8 +3983,8 @@ void mxs_sqlite3FinishTrigger(Parse *pParse, /* Parser context */ void mxs_sqlite3Insert(Parse* pParse, SrcList* pTabList, - Select* pSelect, - IdList* pColumns, + Select* pSelect, + IdList* pColumns, int onError, ExprList* pSet) { @@ -3965,9 +4034,9 @@ int mxs_sqlite3Select(Parse* pParse, Select* p, SelectDest* pDest) return rc; } -void mxs_sqlite3StartTable(Parse *pParse, /* Parser context */ - Token *pName1, /* First part of the name of the table or view */ - Token *pName2, /* Second part of the name of the table or view */ +void mxs_sqlite3StartTable(Parse* pParse, /* Parser context */ + Token* pName1, /* First part of the name of the table or view */ + Token* pName2, /* Second part of the name of the table or view */ int isTemp, /* True if this is a TEMP table */ int isView, /* True if this is a VIEW */ int isVirtual, /* True if this is a VIRTUAL table */ @@ -3980,8 +4049,13 @@ void mxs_sqlite3StartTable(Parse *pParse, /* Parser context */ QcSqliteInfo* pInfo = this_thread.pInfo; mxb_assert(pInfo); - QC_EXCEPTION_GUARD(pInfo->mxs_sqlite3StartTable(pParse, pName1, pName2, - isTemp, isView, isVirtual, noErr)); + QC_EXCEPTION_GUARD(pInfo->mxs_sqlite3StartTable(pParse, + pName1, + pName2, + isTemp, + isView, + isVirtual, + noErr)); } else { @@ -4016,7 +4090,7 @@ void mxs_sqlite3Update(Parse* pParse, SrcList* pTabList, ExprList* pChanges, Exp } } -void mxs_sqlite3Savepoint(Parse *pParse, int op, Token *pName) +void mxs_sqlite3Savepoint(Parse* pParse, int op, Token* pName) { QC_TRACE(); @@ -4034,10 +4108,10 @@ void maxscaleCollectInfoFromSelect(Parse* pParse, Select* pSelect, int sub_selec QC_EXCEPTION_GUARD(pInfo->maxscaleCollectInfoFromSelect(pParse, pSelect, sub_select)); } -void maxscaleAlterTable(Parse *pParse, /* Parser context. */ +void maxscaleAlterTable(Parse* pParse, /* Parser context. */ mxs_alter_t command, - SrcList *pSrc, /* The table to rename. */ - Token *pName) /* The new table name (RENAME). */ + SrcList* pSrc, /* The table to rename. */ + Token* pName) /* The new table name (RENAME). */ { QC_TRACE(); @@ -4301,27 +4375,27 @@ void maxscaleUse(Parse* pParse, Token* pToken) /** * API */ -static int32_t qc_sqlite_setup(qc_sql_mode_t sql_mode, const char* args); -static int32_t qc_sqlite_process_init(void); -static void qc_sqlite_process_end(void); -static int32_t qc_sqlite_thread_init(void); -static void qc_sqlite_thread_end(void); -static int32_t qc_sqlite_parse(GWBUF* query, uint32_t collect, int32_t* result); -static int32_t qc_sqlite_get_type_mask(GWBUF* query, uint32_t* typemask); -static int32_t qc_sqlite_get_operation(GWBUF* query, int32_t* op); -static int32_t qc_sqlite_get_created_table_name(GWBUF* query, char** name); -static int32_t qc_sqlite_is_drop_table_query(GWBUF* query, int32_t* is_drop_table); -static int32_t qc_sqlite_get_table_names(GWBUF* query, int32_t fullnames, char*** names, int* tblsize); -static int32_t qc_sqlite_get_canonical(GWBUF* query, char** canonical); -static int32_t qc_sqlite_query_has_clause(GWBUF* query, int32_t* has_clause); -static int32_t qc_sqlite_get_database_names(GWBUF* query, char*** names, int* sizep); -static int32_t qc_sqlite_get_preparable_stmt(GWBUF* stmt, GWBUF** preparable_stmt); -static void qc_sqlite_set_server_version(uint64_t version); -static void qc_sqlite_get_server_version(uint64_t* version); -static int32_t qc_sqlite_get_sql_mode(qc_sql_mode_t* sql_mode); -static int32_t qc_sqlite_set_sql_mode(qc_sql_mode_t sql_mode); +static int32_t qc_sqlite_setup(qc_sql_mode_t sql_mode, const char* args); +static int32_t qc_sqlite_process_init(void); +static void qc_sqlite_process_end(void); +static int32_t qc_sqlite_thread_init(void); +static void qc_sqlite_thread_end(void); +static int32_t qc_sqlite_parse(GWBUF* query, uint32_t collect, int32_t* result); +static int32_t qc_sqlite_get_type_mask(GWBUF* query, uint32_t* typemask); +static int32_t qc_sqlite_get_operation(GWBUF* query, int32_t* op); +static int32_t qc_sqlite_get_created_table_name(GWBUF* query, char** name); +static int32_t qc_sqlite_is_drop_table_query(GWBUF* query, int32_t* is_drop_table); +static int32_t qc_sqlite_get_table_names(GWBUF* query, int32_t fullnames, char*** names, int* tblsize); +static int32_t qc_sqlite_get_canonical(GWBUF* query, char** canonical); +static int32_t qc_sqlite_query_has_clause(GWBUF* query, int32_t* has_clause); +static int32_t qc_sqlite_get_database_names(GWBUF* query, char*** names, int* sizep); +static int32_t qc_sqlite_get_preparable_stmt(GWBUF* stmt, GWBUF** preparable_stmt); +static void qc_sqlite_set_server_version(uint64_t version); +static void qc_sqlite_get_server_version(uint64_t* version); +static int32_t qc_sqlite_get_sql_mode(qc_sql_mode_t* sql_mode); +static int32_t qc_sqlite_set_sql_mode(qc_sql_mode_t sql_mode); static QC_STMT_INFO* qc_sqlite_info_dup(QC_STMT_INFO* info); -static void qc_sqlite_info_close(QC_STMT_INFO* info); +static void qc_sqlite_info_close(QC_STMT_INFO* info); static bool get_key_and_value(char* arg, const char** pkey, const char** pvalue) { @@ -4355,8 +4429,8 @@ static int32_t qc_sqlite_setup(qc_sql_mode_t sql_mode, const char* cargs) char args[strlen(cargs) + 1]; strcpy(args, cargs); - char *p1; - char *token = strtok_r(args, ",", &p1); + char* p1; + char* token = strtok_r(args, ",", &p1); while (token) { @@ -4367,7 +4441,7 @@ static int32_t qc_sqlite_setup(qc_sql_mode_t sql_mode, const char* cargs) { if (strcmp(key, ARG_LOG_UNRECOGNIZED_STATEMENTS) == 0) { - char *end; + char* end; long l = strtol(value, &end, 0); @@ -4378,7 +4452,9 @@ static int32_t qc_sqlite_setup(qc_sql_mode_t sql_mode, const char* cargs) else { MXS_WARNING("'%s' is not a number between %d and %d.", - value, QC_LOG_NOTHING, QC_LOG_NON_TOKENIZED); + value, + QC_LOG_NOTHING, + QC_LOG_NON_TOKENIZED); } } else if (strcmp(key, ARG_PARSE_AS) == 0) @@ -4391,7 +4467,9 @@ static int32_t qc_sqlite_setup(qc_sql_mode_t sql_mode, const char* cargs) else { MXS_WARNING("'%s' is not a recognized value for '%s'. " - "Parsing as pre-10.3.", value, key); + "Parsing as pre-10.3.", + value, + key); } } else @@ -4444,20 +4522,20 @@ static int32_t qc_sqlite_process_init(void) switch (this_unit.log_level) { - case QC_LOG_NON_PARSED: - message = "Statements that cannot be parsed completely are logged."; - break; + case QC_LOG_NON_PARSED: + message = "Statements that cannot be parsed completely are logged."; + break; - case QC_LOG_NON_PARTIALLY_PARSED: - message = "Statements that cannot even be partially parsed are logged."; - break; + case QC_LOG_NON_PARTIALLY_PARSED: + message = "Statements that cannot even be partially parsed are logged."; + break; - case QC_LOG_NON_TOKENIZED: - message = "Statements that cannot even be classified by keyword matching are logged."; - break; + case QC_LOG_NON_TOKENIZED: + message = "Statements that cannot even be classified by keyword matching are logged."; + break; - default: - mxb_assert(!true); + default: + mxb_assert(!true); } MXS_NOTICE("%s", message); @@ -4539,7 +4617,9 @@ static int32_t qc_sqlite_thread_init(void) else { MXS_ERROR("Failed to open in-memory sqlite database for thread %lu: %d, %s", - (unsigned long) pthread_self(), rc, sqlite3_errstr(rc)); + (unsigned long) pthread_self(), + rc, + sqlite3_errstr(rc)); } return this_thread.initialized ? QC_RESULT_OK : QC_RESULT_ERROR; @@ -4558,7 +4638,8 @@ static void qc_sqlite_thread_end(void) if (rc != SQLITE_OK) { MXS_WARNING("The closing of the thread specific sqlite database failed: %d, %s", - rc, sqlite3_errstr(rc)); + rc, + sqlite3_errstr(rc)); } this_thread.pDb = NULL; @@ -5004,56 +5085,54 @@ void qc_sqlite_info_close(QC_STMT_INFO* info) extern "C" { -MXS_MODULE* MXS_CREATE_MODULE() -{ - static QUERY_CLASSIFIER qc = + MXS_MODULE* MXS_CREATE_MODULE() { - qc_sqlite_setup, - qc_sqlite_process_init, - qc_sqlite_process_end, - qc_sqlite_thread_init, - qc_sqlite_thread_end, - qc_sqlite_parse, - qc_sqlite_get_type_mask, - qc_sqlite_get_operation, - qc_sqlite_get_created_table_name, - qc_sqlite_is_drop_table_query, - qc_sqlite_get_table_names, - NULL, - qc_sqlite_query_has_clause, - qc_sqlite_get_database_names, - qc_sqlite_get_prepare_name, - qc_sqlite_get_field_info, - qc_sqlite_get_function_info, - qc_sqlite_get_preparable_stmt, - qc_sqlite_set_server_version, - qc_sqlite_get_server_version, - qc_sqlite_get_sql_mode, - qc_sqlite_set_sql_mode, - qc_sqlite_info_dup, - qc_sqlite_info_close, - }; - - static MXS_MODULE info = - { - MXS_MODULE_API_QUERY_CLASSIFIER, - MXS_MODULE_GA, - MXS_QUERY_CLASSIFIER_VERSION, - "Query classifier using sqlite.", - "V1.0.0", - MXS_NO_MODULE_CAPABILITIES, - &qc, - qc_sqlite_process_init, - qc_sqlite_process_end, - qc_sqlite_thread_init, - qc_sqlite_thread_end, + static QUERY_CLASSIFIER qc = { - {MXS_END_MODULE_PARAMS} - } - }; + qc_sqlite_setup, + qc_sqlite_process_init, + qc_sqlite_process_end, + qc_sqlite_thread_init, + qc_sqlite_thread_end, + qc_sqlite_parse, + qc_sqlite_get_type_mask, + qc_sqlite_get_operation, + qc_sqlite_get_created_table_name, + qc_sqlite_is_drop_table_query, + qc_sqlite_get_table_names, + NULL, + qc_sqlite_query_has_clause, + qc_sqlite_get_database_names, + qc_sqlite_get_prepare_name, + qc_sqlite_get_field_info, + qc_sqlite_get_function_info, + qc_sqlite_get_preparable_stmt, + qc_sqlite_set_server_version, + qc_sqlite_get_server_version, + qc_sqlite_get_sql_mode, + qc_sqlite_set_sql_mode, + qc_sqlite_info_dup, + qc_sqlite_info_close, + }; - return &info; + static MXS_MODULE info = + { + MXS_MODULE_API_QUERY_CLASSIFIER, + MXS_MODULE_GA, + MXS_QUERY_CLASSIFIER_VERSION, + "Query classifier using sqlite.", + "V1.0.0", + MXS_NO_MODULE_CAPABILITIES, + &qc, + qc_sqlite_process_init, + qc_sqlite_process_end, + qc_sqlite_thread_init, + qc_sqlite_thread_end, + { + {MXS_END_MODULE_PARAMS} + } + }; + + return &info; + } } - -} - diff --git a/rabbitmq_consumer/inih/cpp/INIReader.h b/rabbitmq_consumer/inih/cpp/INIReader.h index ad8e11077..d5ae6cba3 100644 --- a/rabbitmq_consumer/inih/cpp/INIReader.h +++ b/rabbitmq_consumer/inih/cpp/INIReader.h @@ -48,4 +48,4 @@ private: const char* value); }; -#endif // __INIREADER_H__ +#endif // __INIREADER_H__ diff --git a/server/core/config.cc b/server/core/config.cc index c3df8f642..b263b3c82 100644 --- a/server/core/config.cc +++ b/server/core/config.cc @@ -242,134 +242,134 @@ static CONFIG_CONTEXT config_context; static const MXS_ENUM_VALUE ssl_values[] = { {"required", - 1 }, + 1}, {"true", - 1 }, + 1}, {"yes", - 1 }, + 1}, {"on", - 1 }, + 1}, {"1", - 1 }, + 1}, {"disabled", - 0 }, + 0}, {"false", - 0 }, + 0}, {"no", - 0 }, + 0}, {"off", - 0 }, + 0}, {"0", - 0 }, + 0}, {NULL} }; static const MXS_ENUM_VALUE ssl_version_values[] = { {"MAX", - 1 }, + 1}, #ifndef OPENSSL_1_1 {"TLSv10", - 1 }, + 1}, #endif #ifdef OPENSSL_1_0 {"TLSv11", - 1 }, + 1}, {"TLSv12", - 1 }, + 1}, #endif {NULL} }; const MXS_MODULE_PARAM config_service_params[] = { - {CN_TYPE, MXS_MODULE_PARAM_STRING, NULL, + {CN_TYPE, MXS_MODULE_PARAM_STRING, NULL, + MXS_MODULE_OPT_REQUIRED}, + {CN_ROUTER, MXS_MODULE_PARAM_STRING, NULL, MXS_MODULE_OPT_REQUIRED}, - {CN_ROUTER, MXS_MODULE_PARAM_STRING, NULL, - MXS_MODULE_OPT_REQUIRED }, {CN_ROUTER_OPTIONS, MXS_MODULE_PARAM_STRING}, {CN_SERVERS, MXS_MODULE_PARAM_STRING}, - {CN_USER, MXS_MODULE_PARAM_STRING}, // Not mandatory due - // to - // RCAP_TYPE_NO_AUTH - {CN_PASSWORD, MXS_MODULE_PARAM_STRING}, // Not mandatory due - // to - // RCAP_TYPE_NO_AUTH - {CN_ENABLE_ROOT_USER, MXS_MODULE_PARAM_BOOL, "false"}, - {CN_MAX_RETRY_INTERVAL, MXS_MODULE_PARAM_COUNT, "3600"}, - {CN_MAX_CONNECTIONS, MXS_MODULE_PARAM_COUNT, "0"}, - {CN_CONNECTION_TIMEOUT, MXS_MODULE_PARAM_COUNT, "0"}, - {CN_AUTH_ALL_SERVERS, MXS_MODULE_PARAM_BOOL, "false"}, - {CN_STRIP_DB_ESC, MXS_MODULE_PARAM_BOOL, "true"}, - {CN_LOCALHOST_MATCH_WILDCARD_HOST, MXS_MODULE_PARAM_BOOL, "true"}, + {CN_USER, MXS_MODULE_PARAM_STRING},// Not mandatory due + // to + // RCAP_TYPE_NO_AUTH + {CN_PASSWORD, MXS_MODULE_PARAM_STRING},// Not mandatory due + // to + // RCAP_TYPE_NO_AUTH + {CN_ENABLE_ROOT_USER, MXS_MODULE_PARAM_BOOL, "false"}, + {CN_MAX_RETRY_INTERVAL, MXS_MODULE_PARAM_COUNT, "3600"}, + {CN_MAX_CONNECTIONS, MXS_MODULE_PARAM_COUNT, "0"}, + {CN_CONNECTION_TIMEOUT, MXS_MODULE_PARAM_COUNT, "0"}, + {CN_AUTH_ALL_SERVERS, MXS_MODULE_PARAM_BOOL, "false"}, + {CN_STRIP_DB_ESC, MXS_MODULE_PARAM_BOOL, "true"}, + {CN_LOCALHOST_MATCH_WILDCARD_HOST, MXS_MODULE_PARAM_BOOL, "true"}, {CN_VERSION_STRING, MXS_MODULE_PARAM_STRING, DEFAULT_VERSION_STRING}, {CN_FILTERS, MXS_MODULE_PARAM_STRING}, {CN_WEIGHTBY, MXS_MODULE_PARAM_STRING}, - {CN_LOG_AUTH_WARNINGS, MXS_MODULE_PARAM_BOOL, "true"}, - {CN_RETRY_ON_FAILURE, MXS_MODULE_PARAM_BOOL, "true"}, - {CN_SESSION_TRACK_TRX_STATE, MXS_MODULE_PARAM_BOOL, "false"}, + {CN_LOG_AUTH_WARNINGS, MXS_MODULE_PARAM_BOOL, "true"}, + {CN_RETRY_ON_FAILURE, MXS_MODULE_PARAM_BOOL, "true"}, + {CN_SESSION_TRACK_TRX_STATE, MXS_MODULE_PARAM_BOOL, "false"}, {NULL} }; const MXS_MODULE_PARAM config_listener_params[] = { - {CN_TYPE, MXS_MODULE_PARAM_STRING, NULL, - MXS_MODULE_OPT_REQUIRED }, - {CN_SERVICE, MXS_MODULE_PARAM_SERVICE, NULL, - MXS_MODULE_OPT_REQUIRED }, - {CN_PROTOCOL, MXS_MODULE_PARAM_STRING, NULL, - MXS_MODULE_OPT_REQUIRED }, - {CN_PORT, MXS_MODULE_PARAM_COUNT}, // Either port or socket, - // checked when created + {CN_TYPE, MXS_MODULE_PARAM_STRING, NULL, + MXS_MODULE_OPT_REQUIRED}, + {CN_SERVICE, MXS_MODULE_PARAM_SERVICE, NULL, + MXS_MODULE_OPT_REQUIRED}, + {CN_PROTOCOL, MXS_MODULE_PARAM_STRING, NULL, + MXS_MODULE_OPT_REQUIRED}, + {CN_PORT, MXS_MODULE_PARAM_COUNT}, // Either port or socket, + // checked when created {CN_SOCKET, MXS_MODULE_PARAM_STRING}, {CN_AUTHENTICATOR_OPTIONS, MXS_MODULE_PARAM_STRING}, - {CN_ADDRESS, MXS_MODULE_PARAM_STRING, "::"}, + {CN_ADDRESS, MXS_MODULE_PARAM_STRING, "::"}, {CN_AUTHENTICATOR, MXS_MODULE_PARAM_STRING}, - {CN_SSL, MXS_MODULE_PARAM_ENUM, "false", + {CN_SSL, MXS_MODULE_PARAM_ENUM, "false", MXS_MODULE_OPT_ENUM_UNIQUE, - ssl_values }, - {CN_SSL_CERT, MXS_MODULE_PARAM_PATH, NULL, - MXS_MODULE_OPT_PATH_R_OK }, - {CN_SSL_KEY, MXS_MODULE_PARAM_PATH, NULL, - MXS_MODULE_OPT_PATH_R_OK }, - {CN_SSL_CA_CERT, MXS_MODULE_PARAM_PATH, NULL, - MXS_MODULE_OPT_PATH_R_OK }, - {CN_SSL_VERSION, MXS_MODULE_PARAM_ENUM, "MAX", + ssl_values}, + {CN_SSL_CERT, MXS_MODULE_PARAM_PATH, NULL, + MXS_MODULE_OPT_PATH_R_OK}, + {CN_SSL_KEY, MXS_MODULE_PARAM_PATH, NULL, + MXS_MODULE_OPT_PATH_R_OK}, + {CN_SSL_CA_CERT, MXS_MODULE_PARAM_PATH, NULL, + MXS_MODULE_OPT_PATH_R_OK}, + {CN_SSL_VERSION, MXS_MODULE_PARAM_ENUM, "MAX", MXS_MODULE_OPT_ENUM_UNIQUE, - ssl_version_values }, - {CN_SSL_CERT_VERIFY_DEPTH, MXS_MODULE_PARAM_COUNT, "9"}, - {CN_SSL_VERIFY_PEER_CERTIFICATE, MXS_MODULE_PARAM_BOOL, "true"}, + ssl_version_values}, + {CN_SSL_CERT_VERIFY_DEPTH, MXS_MODULE_PARAM_COUNT, "9"}, + {CN_SSL_VERIFY_PEER_CERTIFICATE, MXS_MODULE_PARAM_BOOL, "true"}, {NULL} }; const MXS_MODULE_PARAM config_monitor_params[] = { - {CN_TYPE, MXS_MODULE_PARAM_STRING, NULL, - MXS_MODULE_OPT_REQUIRED }, - {CN_MODULE, MXS_MODULE_PARAM_STRING, NULL, - MXS_MODULE_OPT_REQUIRED }, + {CN_TYPE, MXS_MODULE_PARAM_STRING, NULL, + MXS_MODULE_OPT_REQUIRED}, + {CN_MODULE, MXS_MODULE_PARAM_STRING, NULL, + MXS_MODULE_OPT_REQUIRED}, - {CN_USER, MXS_MODULE_PARAM_STRING, NULL, - MXS_MODULE_OPT_REQUIRED }, - {CN_PASSWORD, MXS_MODULE_PARAM_STRING, NULL, - MXS_MODULE_OPT_REQUIRED }, + {CN_USER, MXS_MODULE_PARAM_STRING, NULL, + MXS_MODULE_OPT_REQUIRED}, + {CN_PASSWORD, MXS_MODULE_PARAM_STRING, NULL, + MXS_MODULE_OPT_REQUIRED}, {CN_SERVERS, MXS_MODULE_PARAM_STRING}, - {CN_MONITOR_INTERVAL, MXS_MODULE_PARAM_COUNT, "2000"}, - {CN_BACKEND_CONNECT_TIMEOUT, MXS_MODULE_PARAM_COUNT, "3"}, - {CN_BACKEND_READ_TIMEOUT, MXS_MODULE_PARAM_COUNT, "1"}, - {CN_BACKEND_WRITE_TIMEOUT, MXS_MODULE_PARAM_COUNT, "2"}, - {CN_BACKEND_CONNECT_ATTEMPTS, MXS_MODULE_PARAM_COUNT, "1"}, + {CN_MONITOR_INTERVAL, MXS_MODULE_PARAM_COUNT, "2000"}, + {CN_BACKEND_CONNECT_TIMEOUT, MXS_MODULE_PARAM_COUNT, "3"}, + {CN_BACKEND_READ_TIMEOUT, MXS_MODULE_PARAM_COUNT, "1"}, + {CN_BACKEND_WRITE_TIMEOUT, MXS_MODULE_PARAM_COUNT, "2"}, + {CN_BACKEND_CONNECT_ATTEMPTS, MXS_MODULE_PARAM_COUNT, "1"}, - {CN_JOURNAL_MAX_AGE, MXS_MODULE_PARAM_COUNT, "28800"}, + {CN_JOURNAL_MAX_AGE, MXS_MODULE_PARAM_COUNT, "28800"}, {CN_DISK_SPACE_THRESHOLD, MXS_MODULE_PARAM_STRING}, - {CN_DISK_SPACE_CHECK_INTERVAL, MXS_MODULE_PARAM_COUNT, "0"}, + {CN_DISK_SPACE_CHECK_INTERVAL, MXS_MODULE_PARAM_COUNT, "0"}, - {CN_SCRIPT, MXS_MODULE_PARAM_STRING}, // Cannot be a path type as - // the script may have - // parameters - {CN_SCRIPT_TIMEOUT, MXS_MODULE_PARAM_COUNT, "90"}, + {CN_SCRIPT, MXS_MODULE_PARAM_STRING},// Cannot be a path type as + // the script may have + // parameters + {CN_SCRIPT_TIMEOUT, MXS_MODULE_PARAM_COUNT, "90"}, { CN_EVENTS, MXS_MODULE_PARAM_ENUM, @@ -382,42 +382,42 @@ const MXS_MODULE_PARAM config_monitor_params[] = const MXS_MODULE_PARAM config_filter_params[] = { - {CN_TYPE, MXS_MODULE_PARAM_STRING, NULL, - MXS_MODULE_OPT_REQUIRED }, - {CN_MODULE, MXS_MODULE_PARAM_STRING, NULL, - MXS_MODULE_OPT_REQUIRED }, + {CN_TYPE, MXS_MODULE_PARAM_STRING, NULL, + MXS_MODULE_OPT_REQUIRED}, + {CN_MODULE, MXS_MODULE_PARAM_STRING, NULL, + MXS_MODULE_OPT_REQUIRED}, {NULL} }; const MXS_MODULE_PARAM config_server_params[] = { - {CN_TYPE, MXS_MODULE_PARAM_STRING, NULL, - MXS_MODULE_OPT_REQUIRED }, - {CN_ADDRESS, MXS_MODULE_PARAM_STRING, NULL, - MXS_MODULE_OPT_REQUIRED }, - {CN_PROTOCOL, MXS_MODULE_PARAM_STRING, NULL, - MXS_MODULE_OPT_REQUIRED }, - {CN_PORT, MXS_MODULE_PARAM_COUNT, "3306"}, + {CN_TYPE, MXS_MODULE_PARAM_STRING, NULL, + MXS_MODULE_OPT_REQUIRED}, + {CN_ADDRESS, MXS_MODULE_PARAM_STRING, NULL, + MXS_MODULE_OPT_REQUIRED}, + {CN_PROTOCOL, MXS_MODULE_PARAM_STRING, NULL, + MXS_MODULE_OPT_REQUIRED}, + {CN_PORT, MXS_MODULE_PARAM_COUNT, "3306"}, {CN_AUTHENTICATOR, MXS_MODULE_PARAM_STRING}, {CN_MONITORUSER, MXS_MODULE_PARAM_STRING}, {CN_MONITORPW, MXS_MODULE_PARAM_STRING}, - {CN_PERSISTPOOLMAX, MXS_MODULE_PARAM_COUNT, "0"}, - {CN_PERSISTMAXTIME, MXS_MODULE_PARAM_COUNT, "0"}, - {CN_PROXY_PROTOCOL, MXS_MODULE_PARAM_BOOL, "false"}, - {CN_SSL, MXS_MODULE_PARAM_ENUM, "false", + {CN_PERSISTPOOLMAX, MXS_MODULE_PARAM_COUNT, "0"}, + {CN_PERSISTMAXTIME, MXS_MODULE_PARAM_COUNT, "0"}, + {CN_PROXY_PROTOCOL, MXS_MODULE_PARAM_BOOL, "false"}, + {CN_SSL, MXS_MODULE_PARAM_ENUM, "false", MXS_MODULE_OPT_ENUM_UNIQUE, - ssl_values }, - {CN_SSL_CERT, MXS_MODULE_PARAM_PATH, NULL, - MXS_MODULE_OPT_PATH_R_OK }, - {CN_SSL_KEY, MXS_MODULE_PARAM_PATH, NULL, - MXS_MODULE_OPT_PATH_R_OK }, - {CN_SSL_CA_CERT, MXS_MODULE_PARAM_PATH, NULL, - MXS_MODULE_OPT_PATH_R_OK }, - {CN_SSL_VERSION, MXS_MODULE_PARAM_ENUM, "MAX", + ssl_values}, + {CN_SSL_CERT, MXS_MODULE_PARAM_PATH, NULL, + MXS_MODULE_OPT_PATH_R_OK}, + {CN_SSL_KEY, MXS_MODULE_PARAM_PATH, NULL, + MXS_MODULE_OPT_PATH_R_OK}, + {CN_SSL_CA_CERT, MXS_MODULE_PARAM_PATH, NULL, + MXS_MODULE_OPT_PATH_R_OK}, + {CN_SSL_VERSION, MXS_MODULE_PARAM_ENUM, "MAX", MXS_MODULE_OPT_ENUM_UNIQUE, - ssl_version_values }, - {CN_SSL_CERT_VERIFY_DEPTH, MXS_MODULE_PARAM_COUNT, "9"}, - {CN_SSL_VERIFY_PEER_CERTIFICATE, MXS_MODULE_PARAM_BOOL, "true"}, + ssl_version_values}, + {CN_SSL_CERT_VERIFY_DEPTH, MXS_MODULE_PARAM_COUNT, "9"}, + {CN_SSL_VERIFY_PEER_CERTIFICATE, MXS_MODULE_PARAM_BOOL, "true"}, {NULL} }; @@ -2109,19 +2109,19 @@ static struct } lognames[] = { {"log_messages", LOG_NOTICE, - "log_notice" },// - // Deprecated + "log_notice"}, // + // Deprecated {"log_trace", LOG_INFO, - "log_info" },// - // Deprecated + "log_info"}, // + // Deprecated {"log_debug", LOG_DEBUG, - NULL }, + NULL}, {"log_warning", LOG_WARNING, - NULL }, + NULL}, {"log_notice", LOG_NOTICE, - NULL }, + NULL}, {"log_info", LOG_INFO, - NULL }, + NULL}, {NULL, 0} }; @@ -2276,7 +2276,7 @@ static int handle_global_item(const char* name, const char* value) return 0; } - decltype(gateway.qc_cache_properties.max_size) max_size = int_value; + decltype(gateway.qc_cache_properties.max_size)max_size = int_value; if (max_size >= 0) { diff --git a/server/core/config_runtime.cc b/server/core/config_runtime.cc index 64566b31c..23dd709d8 100644 --- a/server/core/config_runtime.cc +++ b/server/core/config_runtime.cc @@ -848,7 +848,7 @@ bool runtime_alter_maxscale(const char* name, const char* value) if (get_suffixed_size(value, &max_size)) { - decltype(QC_CACHE_PROPERTIES::max_size) new_size = max_size; + decltype(QC_CACHE_PROPERTIES::max_size)new_size = max_size; if (new_size >= 0) { @@ -935,7 +935,12 @@ bool runtime_create_listener(Service* service, if (ssl_key && ssl_cert && ssl_ca && (ssl - = create_ssl(name, ssl_key, ssl_cert, ssl_ca, ssl_version, ssl_depth, + = create_ssl(name, + ssl_key, + ssl_cert, + ssl_ca, + ssl_version, + ssl_depth, verify_ssl)) == NULL) { MXS_ERROR("SSL initialization for listener '%s' failed.", name); diff --git a/server/core/dcb.cc b/server/core/dcb.cc index 753559e39..418769333 100644 --- a/server/core/dcb.cc +++ b/server/core/dcb.cc @@ -2495,8 +2495,8 @@ DCB* dcb_accept(DCB* dcb) /** Allocate DCB specific authentication data */ if (client_dcb->authfunc.create - && (client_dcb->authenticator_data = client_dcb->authfunc.create( - client_dcb->listener->auth_instance)) == NULL) + && (client_dcb->authenticator_data + = client_dcb->authfunc.create(client_dcb->listener->auth_instance)) == NULL) { MXS_ERROR("Failed to create authenticator for client DCB"); dcb_close(client_dcb); @@ -2956,7 +2956,7 @@ class SerialDcbTask : public Worker::Task { public: - SerialDcbTask(bool(*func)(DCB*, void*), void* data) + SerialDcbTask(bool (*func)(DCB*, void*), void* data) : m_func(func) , m_data(data) , m_more(1) @@ -2991,7 +2991,7 @@ public: } private: - bool (* m_func)(DCB* dcb, void* data); + bool (* m_func)(DCB * dcb, void* data); void* m_data; int m_more; }; diff --git a/server/core/load_utils.cc b/server/core/load_utils.cc index e15ec809d..c68eac65e 100644 --- a/server/core/load_utils.cc +++ b/server/core/load_utils.cc @@ -66,9 +66,9 @@ struct NAME_MAPPING static NAME_MAPPING name_mappings[] = { - {MODULE_MONITOR, "mysqlmon", "mariadbmon", false }, - {MODULE_PROTOCOL, "mysqlclient", "mariadbclient", false }, - {MODULE_PROTOCOL, "mysqlbackend", "mariadbbackend", false } + {MODULE_MONITOR, "mysqlmon", "mariadbmon", false}, + {MODULE_PROTOCOL, "mysqlclient", "mariadbclient", false}, + {MODULE_PROTOCOL, "mysqlbackend", "mariadbbackend", false} }; static const size_t N_NAME_MAPPINGS = sizeof(name_mappings) / sizeof(name_mappings[0]); diff --git a/server/core/monitor.cc b/server/core/monitor.cc index 0b4fe3db4..f37c5ccdb 100644 --- a/server/core/monitor.cc +++ b/server/core/monitor.cc @@ -1032,9 +1032,9 @@ static mxs_monitor_event_t mon_get_event_type(MXS_MONITORED_SERVER* node) : (present & SERVER_JOINED) ? SYNCED_UP_EVENT : (present - & SERVER_NDB) ? - NDB_UP_EVENT - : + & SERVER_NDB) + ? NDB_UP_EVENT + : SERVER_UP_EVENT; break; @@ -1043,9 +1043,9 @@ static mxs_monitor_event_t mon_get_event_type(MXS_MONITORED_SERVER* node) : (prev & SERVER_SLAVE) ? SLAVE_DOWN_EVENT : (prev & SERVER_JOINED) ? SYNCED_DOWN_EVENT : (prev - & SERVER_NDB) ? - NDB_DOWN_EVENT - : + & SERVER_NDB) + ? NDB_DOWN_EVENT + : SERVER_DOWN_EVENT; break; @@ -1054,9 +1054,9 @@ static mxs_monitor_event_t mon_get_event_type(MXS_MONITORED_SERVER* node) : (prev & SERVER_SLAVE) ? LOST_SLAVE_EVENT : (prev & SERVER_JOINED) ? LOST_SYNCED_EVENT : (prev - & SERVER_NDB) ? - LOST_NDB_EVENT - : + & SERVER_NDB) + ? LOST_NDB_EVENT + : UNDEFINED_EVENT; break; @@ -1066,9 +1066,9 @@ static mxs_monitor_event_t mon_get_event_type(MXS_MONITORED_SERVER* node) : (present & SERVER_JOINED) ? NEW_SYNCED_EVENT : (present - & SERVER_NDB) ? - NEW_NDB_EVENT - : + & SERVER_NDB) + ? NEW_NDB_EVENT + : UNDEFINED_EVENT; break; @@ -1131,7 +1131,7 @@ static void mon_append_node_names(MXS_MONITOR* mon, const char* separator = ""; char arr[MAX_SERVER_MONUSER_LEN + MAX_SERVER_MONPW_LEN - + MAX_SERVER_ADDRESS_LEN + 64];// Some extra space for port and separator + + MAX_SERVER_ADDRESS_LEN + 64]; // Some extra space for port and separator dest[0] = '\0'; while (servers && len) @@ -2608,7 +2608,7 @@ bool MonitorInstance::should_update_disk_space_status(const MXS_MONITORED_SERVER if (m_monitor->disk_space_check_interval && (m_monitor->disk_space_threshold || pMs->server->disk_space_threshold) - && (pMs->disk_space_checked != -1)) // -1 means disabled + && (pMs->disk_space_checked != -1)) // -1 means disabled { int64_t now = get_time_ms(); diff --git a/server/core/queryclassifier.cc b/server/core/queryclassifier.cc index e2765c8ae..4f1c50eb0 100644 --- a/server/core/queryclassifier.cc +++ b/server/core/queryclassifier.cc @@ -156,7 +156,7 @@ std::string get_text_ps_id(GWBUF* buffer) bool foreach_table(QueryClassifier& qc, MXS_SESSION* pSession, GWBUF* querybuf, - bool (* func)(QueryClassifier& qc, const std::string&)) + bool (* func)(QueryClassifier & qc, const std::string&)) { bool rval = true; int n_tables; @@ -428,11 +428,11 @@ uint32_t QueryClassifier::get_route_target(uint8_t command, uint32_t qtype, HINT */ else if (!load_active && (qc_query_is_type(qtype, QUERY_TYPE_SESSION_WRITE) - || /** Configured to allow writing user variables to all nodes */ + || /** Configured to allow writing user variables to all nodes */ (m_use_sql_variables_in == TYPE_ALL && qc_query_is_type(qtype, QUERY_TYPE_USERVAR_WRITE)) || qc_query_is_type(qtype, QUERY_TYPE_GSYSVAR_WRITE) - || /** enable or disable autocommit are always routed to all */ + || /** enable or disable autocommit are always routed to all */ qc_query_is_type(qtype, QUERY_TYPE_ENABLE_AUTOCOMMIT) || qc_query_is_type(qtype, QUERY_TYPE_DISABLE_AUTOCOMMIT))) { diff --git a/server/core/server.cc b/server/core/server.cc index 1701aab94..b8fe4fa4f 100644 --- a/server/core/server.cc +++ b/server/core/server.cc @@ -1044,15 +1044,15 @@ static struct uint64_t bit; } ServerBits[] = { - {"running", SERVER_RUNNING }, - {"master", SERVER_MASTER }, - {"slave", SERVER_SLAVE }, - {"synced", SERVER_JOINED }, - {"ndb", SERVER_NDB }, - {"maintenance", SERVER_MAINT }, - {"maint", SERVER_MAINT }, - {"stale", SERVER_WAS_MASTER }, - {NULL, 0 } + {"running", SERVER_RUNNING }, + {"master", SERVER_MASTER }, + {"slave", SERVER_SLAVE }, + {"synced", SERVER_JOINED }, + {"ndb", SERVER_NDB }, + {"maintenance", SERVER_MAINT }, + {"maint", SERVER_MAINT }, + {"stale", SERVER_WAS_MASTER}, + {NULL, 0 } }; /** diff --git a/server/core/service.cc b/server/core/service.cc index 96a5b4af8..aed19fe63 100644 --- a/server/core/service.cc +++ b/server/core/service.cc @@ -865,9 +865,9 @@ bool serviceHasListener(Service* service, listener; listener = listener_iterator_next(&iter)) { if (listener_is_active(listener) - && // Listener with same name exists + && // Listener with same name exists (strcmp(listener->name, name) == 0 - || // Listener listening on the same interface and port exists + || // Listener listening on the same interface and port exists ((strcmp(listener->protocol, protocol) == 0 && listener->port == port && ((address && listener->address && strcmp(listener->address, address) == 0) || (address == NULL && listener->address == NULL)))))) diff --git a/server/core/session.cc b/server/core/session.cc index 7fd0e286c..55e2d85c3 100644 --- a/server/core/session.cc +++ b/server/core/session.cc @@ -303,9 +303,8 @@ static void session_simple_free(MXS_SESSION* session, DCB* dcb) } if (session && session->router_session) { - session->service->router->freeSession( - session->service->router_instance, - session->router_session); + session->service->router->freeSession(session->service->router_instance, + session->router_session); } session->state = SESSION_STATE_STOPPING; } diff --git a/server/core/test/test_buffer.cc b/server/core/test/test_buffer.cc index fdf351db5..3e8eec0c2 100644 --- a/server/core/test/test_buffer.cc +++ b/server/core/test/test_buffer.cc @@ -61,8 +61,8 @@ uint8_t* generate_data(size_t count) size_t buffers[] = { - 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, - 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149 + 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, + 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149 }; const int n_buffers = sizeof(buffers) / sizeof(size_t); diff --git a/server/core/test/test_modutil.cc b/server/core/test/test_modutil.cc index 388be3615..db07f0423 100644 --- a/server/core/test/test_modutil.cc +++ b/server/core/test/test_modutil.cc @@ -112,15 +112,15 @@ static const uint8_t resultset[] = /* Packet 1 */ 0x01, 0x00, 0x00, 0x01, 0x01, /* Packet 2 */ - 0x22, 0x00, 0x00, 0x02, 0x03,0x64, 0x65, 0x66, 0x04, 0x74, 0x65, 0x73, 0x74, 0x02, 0x74, 0x31, - 0x02, 0x74, 0x31, 0x02, 0x69,0x64, 0x02, 0x69, 0x64, 0x0c, 0x3f, - 0x00, 0x0b, 0x00, 0x00, 0x00,0x03, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x22, 0x00, 0x00, 0x02, 0x03,0x64, 0x65, 0x66, 0x04, 0x74, 0x65, 0x73, 0x74, 0x02, 0x74, 0x31, + 0x02, 0x74, 0x31, 0x02, 0x69,0x64, 0x02, 0x69, 0x64, 0x0c, 0x3f, + 0x00, 0x0b, 0x00, 0x00, 0x00,0x03, 0x00, 0x00, 0x00, 0x00, 0x00, /* Packet 3 */ - 0x05, 0x00, 0x00, 0x03, 0xfe,0x00, 0x00, 0x22, 0x00, + 0x05, 0x00, 0x00, 0x03, 0xfe,0x00, 0x00, 0x22, 0x00, /* Packet 4 */ - 0x05, 0x00, 0x00, 0x04, 0x04,0x33, 0x30, 0x30, 0x30, + 0x05, 0x00, 0x00, 0x04, 0x04,0x33, 0x30, 0x30, 0x30, /* Packet 5 */ - 0x05, 0x00, 0x00, 0x05, 0xfe,0x00, 0x00, 0x22, 0x00 + 0x05, 0x00, 0x00, 0x05, 0xfe,0x00, 0x00, 0x22, 0x00 }; #define PACKET_HDR_LEN 4 @@ -587,7 +587,7 @@ void test_large_packets() GWBUF* buffer = gwbuf_append(create_buffer(0x00ffffff), create_buffer(i)); mxb_assert(gwbuf_length(buffer) == 0xffffffUL + i + 8); GWBUF_RTRIM(buffer->next, 1) - GWBUF* complete = modutil_get_complete_packets(&buffer); + GWBUF * complete = modutil_get_complete_packets(&buffer); mxb_assert_message(buffer, "Incomplete buffer is not NULL"); mxb_assert_message(complete, "The complete buffer is not NULL"); mxb_assert_message(gwbuf_length(complete) == 0xffffff + 4, "Length should be correct"); diff --git a/server/core/test/test_trxtracking.cc b/server/core/test/test_trxtracking.cc index 41594a6b8..337d54fec 100644 --- a/server/core/test/test_trxtracking.cc +++ b/server/core/test/test_trxtracking.cc @@ -71,67 +71,67 @@ struct test_case { // Keep these all uppercase, lowercase are tested programmatically. {"BEGIN", - QUERY_TYPE_BEGIN_TRX }, + QUERY_TYPE_BEGIN_TRX}, {"BEGIN WORK", - QUERY_TYPE_BEGIN_TRX }, + QUERY_TYPE_BEGIN_TRX}, {"COMMIT", - QUERY_TYPE_COMMIT }, + QUERY_TYPE_COMMIT}, {"COMMIT WORK", - QUERY_TYPE_COMMIT }, + QUERY_TYPE_COMMIT}, {"ROLLBACK", - QUERY_TYPE_ROLLBACK }, + QUERY_TYPE_ROLLBACK}, {"ROLLBACK WORK", - QUERY_TYPE_ROLLBACK }, + QUERY_TYPE_ROLLBACK}, {"START TRANSACTION", - QUERY_TYPE_BEGIN_TRX }, + QUERY_TYPE_BEGIN_TRX}, {"START TRANSACTION READ ONLY", QUERY_TYPE_BEGIN_TRX - | QUERY_TYPE_READ }, + | QUERY_TYPE_READ}, {"START TRANSACTION READ WRITE", QUERY_TYPE_BEGIN_TRX - | QUERY_TYPE_WRITE }, + | QUERY_TYPE_WRITE}, {"START TRANSACTION WITH CONSISTENT SNAPSHOT", - QUERY_TYPE_BEGIN_TRX }, + QUERY_TYPE_BEGIN_TRX}, {"START TRANSACTION WITH CONSISTENT SNAPSHOT, READ ONLY", QUERY_TYPE_BEGIN_TRX - | QUERY_TYPE_READ }, + | QUERY_TYPE_READ}, {"SET AUTOCOMMIT=true", QUERY_TYPE_COMMIT - | QUERY_TYPE_ENABLE_AUTOCOMMIT }, + | QUERY_TYPE_ENABLE_AUTOCOMMIT}, {"SET AUTOCOMMIT=1", QUERY_TYPE_COMMIT - | QUERY_TYPE_ENABLE_AUTOCOMMIT }, + | QUERY_TYPE_ENABLE_AUTOCOMMIT}, {"SET AUTOCOMMIT=false", QUERY_TYPE_BEGIN_TRX - | QUERY_TYPE_DISABLE_AUTOCOMMIT }, + | QUERY_TYPE_DISABLE_AUTOCOMMIT}, {"SET AUTOCOMMIT=0", QUERY_TYPE_BEGIN_TRX - | QUERY_TYPE_DISABLE_AUTOCOMMIT }, + | QUERY_TYPE_DISABLE_AUTOCOMMIT}, {"SET @@AUTOCOMMIT=0", QUERY_TYPE_BEGIN_TRX - | QUERY_TYPE_DISABLE_AUTOCOMMIT }, + | QUERY_TYPE_DISABLE_AUTOCOMMIT}, {"SET GLOBAL AUTOCOMMIT=0", QUERY_TYPE_BEGIN_TRX - | QUERY_TYPE_DISABLE_AUTOCOMMIT }, + | QUERY_TYPE_DISABLE_AUTOCOMMIT}, {"SET SESSION AUTOCOMMIT=0", QUERY_TYPE_BEGIN_TRX - | QUERY_TYPE_DISABLE_AUTOCOMMIT }, + | QUERY_TYPE_DISABLE_AUTOCOMMIT}, {"SET @@SESSION . AUTOCOMMIT=0", QUERY_TYPE_BEGIN_TRX - | QUERY_TYPE_DISABLE_AUTOCOMMIT }, + | QUERY_TYPE_DISABLE_AUTOCOMMIT}, {"SET @@GLOBAL . AUTOCOMMIT=0", QUERY_TYPE_BEGIN_TRX - | QUERY_TYPE_DISABLE_AUTOCOMMIT }, + | QUERY_TYPE_DISABLE_AUTOCOMMIT}, }; const size_t N_TEST_CASES = sizeof(test_cases) / sizeof(test_cases[0]); diff --git a/server/inih/cpp/INIReader.h b/server/inih/cpp/INIReader.h index ad8e11077..d5ae6cba3 100644 --- a/server/inih/cpp/INIReader.h +++ b/server/inih/cpp/INIReader.h @@ -48,4 +48,4 @@ private: const char* value); }; -#endif // __INIREADER_H__ +#endif // __INIREADER_H__ diff --git a/server/modules/authenticator/CDCPlainAuth/cdc_plain_auth.cc b/server/modules/authenticator/CDCPlainAuth/cdc_plain_auth.cc index 42336d141..f4323796a 100644 --- a/server/modules/authenticator/CDCPlainAuth/cdc_plain_auth.cc +++ b/server/modules/authenticator/CDCPlainAuth/cdc_plain_auth.cc @@ -151,9 +151,9 @@ extern "C" { static modulecmd_arg_type_t args[] = { - {MODULECMD_ARG_SERVICE, "Service where the user is added" }, - {MODULECMD_ARG_STRING, "User to add" }, - {MODULECMD_ARG_STRING, "Password of the user" } + {MODULECMD_ARG_SERVICE, "Service where the user is added"}, + {MODULECMD_ARG_STRING, "User to add" }, + {MODULECMD_ARG_STRING, "Password of the user" } }; modulecmd_register_command("cdc", @@ -192,7 +192,9 @@ extern "C" NULL, /* Process finish. */ NULL, /* Thread init. */ NULL, /* Thread finish. */ - {{MXS_END_MODULE_PARAMS}} + { + {MXS_END_MODULE_PARAMS} + } }; return &info; diff --git a/server/modules/authenticator/GSSAPI/GSSAPIAuth/gssapi_auth.cc b/server/modules/authenticator/GSSAPI/GSSAPIAuth/gssapi_auth.cc index 7822142d0..831d7e2c6 100644 --- a/server/modules/authenticator/GSSAPI/GSSAPIAuth/gssapi_auth.cc +++ b/server/modules/authenticator/GSSAPI/GSSAPIAuth/gssapi_auth.cc @@ -207,7 +207,7 @@ void gssapi_auth_free(void* data) * * @return Allocated packet or NULL if memory allocation failed * @see - *https://dev.mysql.com/doc/internals/en/connection-phase-packets.html#packet-Protocol::AuthSwitchRequest + * https://dev.mysql.com/doc/internals/en/connection-phase-packets.html#packet-Protocol::AuthSwitchRequest * @see https://web.mit.edu/kerberos/krb5-1.5/krb5-1.5.4/doc/krb5-user/What-is-a-Kerberos-Principal_003f.html */ static GWBUF* create_auth_change_packet(GSSAPI_INSTANCE* instance, gssapi_auth_t* auth) @@ -734,7 +734,9 @@ extern "C" NULL, /* Process finish. */ NULL, /* Thread init. */ NULL, /* Thread finish. */ - {{MXS_END_MODULE_PARAMS}} + { + {MXS_END_MODULE_PARAMS} + } }; return &info; diff --git a/server/modules/authenticator/GSSAPI/GSSAPIBackendAuth/gssapi_backend_auth.cc b/server/modules/authenticator/GSSAPI/GSSAPIBackendAuth/gssapi_backend_auth.cc index d993abb3e..c78f10468 100644 --- a/server/modules/authenticator/GSSAPI/GSSAPIBackendAuth/gssapi_backend_auth.cc +++ b/server/modules/authenticator/GSSAPI/GSSAPIBackendAuth/gssapi_backend_auth.cc @@ -308,7 +308,9 @@ extern "C" NULL, /* Process finish. */ NULL, /* Thread init. */ NULL, /* Thread finish. */ - {{MXS_END_MODULE_PARAMS}} + { + {MXS_END_MODULE_PARAMS} + } }; return &info; diff --git a/server/modules/authenticator/HTTPAuth/http_auth.cc b/server/modules/authenticator/HTTPAuth/http_auth.cc index 3057b288f..e6362c85f 100644 --- a/server/modules/authenticator/HTTPAuth/http_auth.cc +++ b/server/modules/authenticator/HTTPAuth/http_auth.cc @@ -87,7 +87,9 @@ extern "C" NULL, /* Process finish. */ NULL, /* Thread init. */ NULL, /* Thread finish. */ - {{MXS_END_MODULE_PARAMS}} + { + {MXS_END_MODULE_PARAMS} + } }; return &info; diff --git a/server/modules/authenticator/MaxAdminAuth/max_admin_auth.cc b/server/modules/authenticator/MaxAdminAuth/max_admin_auth.cc index 6c5569b4f..6e4c8991e 100644 --- a/server/modules/authenticator/MaxAdminAuth/max_admin_auth.cc +++ b/server/modules/authenticator/MaxAdminAuth/max_admin_auth.cc @@ -81,7 +81,9 @@ extern "C" NULL, /* Process finish. */ NULL, /* Thread init. */ NULL, /* Thread finish. */ - {{MXS_END_MODULE_PARAMS}} + { + {MXS_END_MODULE_PARAMS} + } }; return &info; diff --git a/server/modules/authenticator/MySQLAuth/dbusers.cc b/server/modules/authenticator/MySQLAuth/dbusers.cc index 849c7f917..f6f1f4293 100644 --- a/server/modules/authenticator/MySQLAuth/dbusers.cc +++ b/server/modules/authenticator/MySQLAuth/dbusers.cc @@ -788,7 +788,7 @@ bool check_service_permissions(SERVICE* service) { if (rcap_type_required(service_get_capabilities(service), RCAP_TYPE_NO_AUTH) || config_get_global_options()->skip_permission_checks - || service->dbref == NULL) // No servers to check + || service->dbref == NULL) // No servers to check { return true; } diff --git a/server/modules/authenticator/MySQLAuth/mysql_auth.cc b/server/modules/authenticator/MySQLAuth/mysql_auth.cc index 4a36f1fcc..6be26757e 100644 --- a/server/modules/authenticator/MySQLAuth/mysql_auth.cc +++ b/server/modules/authenticator/MySQLAuth/mysql_auth.cc @@ -110,7 +110,9 @@ extern "C" NULL, /* Process finish. */ NULL, /* Thread init. */ NULL, /* Thread finish. */ - {{MXS_END_MODULE_PARAMS}} + { + {MXS_END_MODULE_PARAMS} + } }; return &info; diff --git a/server/modules/authenticator/PAM/PAMAuth/pam_auth.cc b/server/modules/authenticator/PAM/PAMAuth/pam_auth.cc index 1170ec465..8479fc96c 100644 --- a/server/modules/authenticator/PAM/PAMAuth/pam_auth.cc +++ b/server/modules/authenticator/PAM/PAMAuth/pam_auth.cc @@ -187,7 +187,9 @@ extern "C" NULL, /* Process finish. */ NULL, /* Thread init. */ NULL, /* Thread finish. */ - {{MXS_END_MODULE_PARAMS}} + { + {MXS_END_MODULE_PARAMS} + } }; return &info; diff --git a/server/modules/authenticator/PAM/PAMAuth/pam_client_session.cc b/server/modules/authenticator/PAM/PAMAuth/pam_client_session.cc index 518b4a6cd..e30d31d9b 100644 --- a/server/modules/authenticator/PAM/PAMAuth/pam_client_session.cc +++ b/server/modules/authenticator/PAM/PAMAuth/pam_client_session.cc @@ -301,7 +301,7 @@ void PamClientSession::get_pam_user_services(const DCB* dcb, * * @return Allocated packet * @see - *https://dev.mysql.com/doc/internals/en/connection-phase-packets.html#packet-Protocol::AuthSwitchRequest + * https://dev.mysql.com/doc/internals/en/connection-phase-packets.html#packet-Protocol::AuthSwitchRequest */ Buffer PamClientSession::create_auth_change_packet() const { diff --git a/server/modules/authenticator/PAM/PAMBackendAuth/pam_backend_auth.cc b/server/modules/authenticator/PAM/PAMBackendAuth/pam_backend_auth.cc index f753950df..d565548e9 100644 --- a/server/modules/authenticator/PAM/PAMBackendAuth/pam_backend_auth.cc +++ b/server/modules/authenticator/PAM/PAMBackendAuth/pam_backend_auth.cc @@ -106,7 +106,9 @@ extern "C" NULL, /* Process finish. */ NULL, /* Thread init. */ NULL, /* Thread finish. */ - {{MXS_END_MODULE_PARAMS}} + { + {MXS_END_MODULE_PARAMS} + } }; return &info; diff --git a/server/modules/filter/binlogfilter/binlogfiltersession.cc b/server/modules/filter/binlogfilter/binlogfiltersession.cc index 0d6776fa9..2f9f55bd9 100644 --- a/server/modules/filter/binlogfilter/binlogfiltersession.cc +++ b/server/modules/filter/binlogfilter/binlogfiltersession.cc @@ -461,8 +461,8 @@ void BinlogFilterSession::skipDatabaseTable(const uint8_t* data, && db == fConfig.dbname) { // Config Db name matches: 1.1 OR 1.2 - m_skip = fConfig.table.empty() /* 1.1 */ - || table == fConfig.table; /* 1.2 */ + m_skip = fConfig.table.empty() /* 1.1 */ + || table == fConfig.table; /* 1.2 */ } else { diff --git a/server/modules/filter/cache/cache_storage_api.h b/server/modules/filter/cache/cache_storage_api.h index 0a4e73133..09387ab63 100644 --- a/server/modules/filter/cache/cache_storage_api.h +++ b/server/modules/filter/cache/cache_storage_api.h @@ -169,7 +169,7 @@ typedef struct cache_storage_api * created. */ CACHE_STORAGE* (*createInstance)(const char* name, - const CACHE_STORAGE_CONFIG* config, + const CACHE_STORAGE_CONFIG * config, int argc, char* argv[]); /** diff --git a/server/modules/filter/cache/cachefilter.h b/server/modules/filter/cache/cachefilter.h index 775070fa1..5468fc213 100644 --- a/server/modules/filter/cache/cachefilter.h +++ b/server/modules/filter/cache/cachefilter.h @@ -81,7 +81,7 @@ typedef enum cache_in_trxs typedef struct cache_config { - uint64_t max_resultset_rows;/**< The maximum number of rows of a resultset for it to be + uint64_t max_resultset_rows; /**< The maximum number of rows of a resultset for it to be * cached. */ uint64_t max_resultset_size;/**< The maximum size of a resultset for it to be cached. */ char* rules; /**< Name of rules file. */ diff --git a/server/modules/filter/cache/rules.cc b/server/modules/filter/cache/rules.cc index c0348f48e..4abce0c10 100644 --- a/server/modules/filter/cache/rules.cc +++ b/server/modules/filter/cache/rules.cc @@ -161,7 +161,7 @@ static bool cache_rules_parse_json(CACHE_RULES* self, json_t* root); typedef bool (* cache_rules_parse_element_t)(CACHE_RULES* self, json_t* object, size_t index); -static bool cache_rules_parse_array(CACHE_RULES * self, json_t* store, const char* name, +static bool cache_rules_parse_array(CACHE_RULES* self, json_t* store, const char* name, cache_rules_parse_element_t); static bool cache_rules_parse_store_element(CACHE_RULES* self, json_t* object, size_t index); static bool cache_rules_parse_use_element(CACHE_RULES* self, json_t* object, size_t index); diff --git a/server/modules/filter/ccrfilter/ccrfilter.cc b/server/modules/filter/ccrfilter/ccrfilter.cc index 0e8761995..af1bb146a 100644 --- a/server/modules/filter/ccrfilter/ccrfilter.cc +++ b/server/modules/filter/ccrfilter/ccrfilter.cc @@ -103,9 +103,9 @@ typedef struct static const MXS_ENUM_VALUE option_values[] = { - {"ignorecase", PCRE2_CASELESS }, - {"case", 0 }, - {"extended", PCRE2_EXTENDED }, + {"ignorecase", PCRE2_CASELESS}, + {"case", 0 }, + {"extended", PCRE2_EXTENDED}, {NULL} }; @@ -169,14 +169,14 @@ extern "C" { {"count", MXS_MODULE_PARAM_COUNT, - "0" }, + "0"}, {"time", MXS_MODULE_PARAM_COUNT, - CCR_DEFAULT_TIME }, + CCR_DEFAULT_TIME}, {PARAM_MATCH, - MXS_MODULE_PARAM_REGEX }, + MXS_MODULE_PARAM_REGEX}, {PARAM_IGNORE, - MXS_MODULE_PARAM_REGEX }, + MXS_MODULE_PARAM_REGEX}, { "options", MXS_MODULE_PARAM_ENUM, diff --git a/server/modules/filter/dbfwfilter/dbfwfilter.cc b/server/modules/filter/dbfwfilter/dbfwfilter.cc index 0d2d34ccd..49ed9f74c 100644 --- a/server/modules/filter/dbfwfilter/dbfwfilter.cc +++ b/server/modules/filter/dbfwfilter/dbfwfilter.cc @@ -504,9 +504,9 @@ static void dbfw_thr_finish() static const MXS_ENUM_VALUE action_values[] = { - {"allow", FW_ACTION_ALLOW }, - {"block", FW_ACTION_BLOCK }, - {"ignore", FW_ACTION_IGNORE }, + {"allow", FW_ACTION_ALLOW }, + {"block", FW_ACTION_BLOCK }, + {"ignore", FW_ACTION_IGNORE}, {NULL} }; @@ -524,8 +524,8 @@ MXS_MODULE* MXS_CREATE_MODULE() { modulecmd_arg_type_t args_rules_reload[] = { - {MODULECMD_ARG_FILTER | MODULECMD_ARG_NAME_MATCHES_DOMAIN, "Filter to reload" }, - {MODULECMD_ARG_STRING | MODULECMD_ARG_OPTIONAL, "Path to rule file" } + {MODULECMD_ARG_FILTER | MODULECMD_ARG_NAME_MATCHES_DOMAIN, "Filter to reload" }, + {MODULECMD_ARG_STRING | MODULECMD_ARG_OPTIONAL, "Path to rule file"} }; modulecmd_register_command(MXS_MODULE_NAME, diff --git a/server/modules/filter/insertstream/insertstream.cc b/server/modules/filter/insertstream/insertstream.cc index 94bc7ed8d..f0f4d6a09 100644 --- a/server/modules/filter/insertstream/insertstream.cc +++ b/server/modules/filter/insertstream/insertstream.cc @@ -72,19 +72,19 @@ enum ds_state */ typedef struct { - MXS_DOWNSTREAM down; /**< Downstream filter */ - MXS_UPSTREAM up; /**< Upstream filter*/ - GWBUF* queue; /**< Queue containing a stored - * query */ - bool active; /**< Whether the session is active - * */ - uint8_t packet_num; /**< If stream is open, the - * current packet sequence number - * */ - DCB* client_dcb; /**< Client DCB */ - enum ds_state state; /**< The current state of the - * stream */ - char target[MYSQL_TABLE_MAXLEN + MYSQL_DATABASE_MAXLEN + 1]; /**< Current target table */ + MXS_DOWNSTREAM down; /**< Downstream filter */ + MXS_UPSTREAM up; /**< Upstream filter*/ + GWBUF* queue; /**< Queue containing a stored + * query */ + bool active; /**< Whether the session is active + * */ + uint8_t packet_num; /**< If stream is open, the + * current packet sequence number + * */ + DCB* client_dcb; /**< Client DCB */ + enum ds_state state; /**< The current state of the + * stream */ + char target[MYSQL_TABLE_MAXLEN + MYSQL_DATABASE_MAXLEN + 1]; /**< Current target table */ } DS_SESSION; extern "C" @@ -131,8 +131,8 @@ extern "C" NULL, NULL, { - {"source", MXS_MODULE_PARAM_STRING }, - {"user", MXS_MODULE_PARAM_STRING }, + {"source", MXS_MODULE_PARAM_STRING }, + {"user", MXS_MODULE_PARAM_STRING }, {MXS_END_MODULE_PARAMS} } }; diff --git a/server/modules/filter/luafilter/luafilter.cc b/server/modules/filter/luafilter/luafilter.cc index 7686b0b67..725df455a 100644 --- a/server/modules/filter/luafilter/luafilter.cc +++ b/server/modules/filter/luafilter/luafilter.cc @@ -113,8 +113,8 @@ extern "C" NULL, /* Thread init. */ NULL, /* Thread finish. */ { - {"global_script", MXS_MODULE_PARAM_PATH, NULL, MXS_MODULE_OPT_PATH_R_OK}, - {"session_script", MXS_MODULE_PARAM_PATH, NULL, MXS_MODULE_OPT_PATH_R_OK}, + {"global_script", MXS_MODULE_PARAM_PATH, NULL, MXS_MODULE_OPT_PATH_R_OK}, + {"session_script", MXS_MODULE_PARAM_PATH, NULL, MXS_MODULE_OPT_PATH_R_OK}, {MXS_END_MODULE_PARAMS} } }; diff --git a/server/modules/filter/masking/maskingfilter.cc b/server/modules/filter/masking/maskingfilter.cc index acbc25144..59b7a6dc3 100644 --- a/server/modules/filter/masking/maskingfilter.cc +++ b/server/modules/filter/masking/maskingfilter.cc @@ -98,9 +98,12 @@ extern "C" MXS_MODULE* MXS_CREATE_MODULE() NULL, /* Thread finish. * */ { - {Config::rules_name, - MXS_MODULE_PARAM_STRING, - NULL, MXS_MODULE_OPT_REQUIRED}, + { + Config::rules_name, + MXS_MODULE_PARAM_STRING, + NULL, + MXS_MODULE_OPT_REQUIRED + }, { Config::warn_type_mismatch_name, MXS_MODULE_PARAM_ENUM, diff --git a/server/modules/filter/masking/maskingrules.cc b/server/modules/filter/masking/maskingrules.cc index 4a9fdafe2..917efca7a 100644 --- a/server/modules/filter/masking/maskingrules.cc +++ b/server/modules/filter/masking/maskingrules.cc @@ -751,11 +751,11 @@ bool rule_get_values(json_t* pRule, // Get Key object based on 'rule_type' param if ((pKeyObj = rule_get_object(pRule, rule_type)) - && // Run checks on user access + && // Run checks on user access rule_run_common_checks(pRule, applies_to, exempted) - && // Extract values from the rule + && // Extract values from the rule rule_get_common_values(pKeyObj, column, table, @@ -1004,7 +1004,7 @@ auto_ptr MaskingRules::MatchRule::create_from(json_t* pRule) &table, &database, KEY_REPLACE) - && rule_get_match_value_fill(pRule, // get match/value/fill + && rule_get_match_value_fill(pRule, // get match/value/fill &match, &value, &fill)) diff --git a/server/modules/filter/maxrows/maxrows.cc b/server/modules/filter/maxrows/maxrows.cc index 3b4ff63e2..c2953b8b0 100644 --- a/server/modules/filter/maxrows/maxrows.cc +++ b/server/modules/filter/maxrows/maxrows.cc @@ -1154,8 +1154,7 @@ static int send_ok_upstream(MAXROWS_SESSION_DATA* csdata) { /* Note: sequence id is always 01 (4th byte) */ const static uint8_t ok[MYSQL_OK_PACKET_MIN_LEN] = {07, 00, 00, 01, 00, 00, - 00, 02, 00, 00, 00 - }; + 00, 02, 00, 00, 00}; mxb_assert(csdata->res.data != NULL); diff --git a/server/modules/filter/mqfilter/mqfilter.cc b/server/modules/filter/mqfilter/mqfilter.cc index d050ebd82..e4575f094 100644 --- a/server/modules/filter/mqfilter/mqfilter.cc +++ b/server/modules/filter/mqfilter/mqfilter.cc @@ -246,10 +246,10 @@ bool sendMessage(void* data); static const MXS_ENUM_VALUE trigger_values[] = { - {"source", TRG_SOURCE }, - {"schema", TRG_SCHEMA }, - {"object", TRG_OBJECT }, - {"all", TRG_ALL }, + {"source", TRG_SOURCE}, + {"schema", TRG_SCHEMA}, + {"object", TRG_OBJECT}, + {"all", TRG_ALL }, {NULL} }; @@ -297,39 +297,39 @@ extern "C" NULL, /* Thread finish. */ { {"hostname", MXS_MODULE_PARAM_STRING, - "localhost" }, + "localhost"}, {"username", MXS_MODULE_PARAM_STRING, - "guest" }, + "guest"}, {"password", MXS_MODULE_PARAM_STRING, - "guest" }, + "guest"}, {"vhost", MXS_MODULE_PARAM_STRING, - "/" }, + "/"}, {"port", MXS_MODULE_PARAM_COUNT, - "5672" }, + "5672"}, {"exchange", MXS_MODULE_PARAM_STRING, - "default_exchange" }, + "default_exchange"}, {"key", MXS_MODULE_PARAM_STRING, - "key" }, + "key"}, {"queue", MXS_MODULE_PARAM_STRING}, - {"ssl_client_certificate", MXS_MODULE_PARAM_PATH, NULL, - MXS_MODULE_OPT_PATH_R_OK }, - {"ssl_client_key", MXS_MODULE_PARAM_PATH, NULL, - MXS_MODULE_OPT_PATH_R_OK }, - {"ssl_CA_cert", MXS_MODULE_PARAM_PATH, NULL, - MXS_MODULE_OPT_PATH_R_OK }, + {"ssl_client_certificate", MXS_MODULE_PARAM_PATH, NULL, + MXS_MODULE_OPT_PATH_R_OK}, + {"ssl_client_key", MXS_MODULE_PARAM_PATH, NULL, + MXS_MODULE_OPT_PATH_R_OK}, + {"ssl_CA_cert", MXS_MODULE_PARAM_PATH, NULL, + MXS_MODULE_OPT_PATH_R_OK}, {"exchange_type", MXS_MODULE_PARAM_STRING, - "direct" }, - {"logging_trigger", MXS_MODULE_PARAM_ENUM, "all", + "direct"}, + {"logging_trigger", MXS_MODULE_PARAM_ENUM, "all", MXS_MODULE_OPT_NONE, - trigger_values }, + trigger_values}, {"logging_source_user", MXS_MODULE_PARAM_STRING}, {"logging_source_host", MXS_MODULE_PARAM_STRING}, {"logging_schema", MXS_MODULE_PARAM_STRING}, {"logging_object", MXS_MODULE_PARAM_STRING}, {"logging_log_all", MXS_MODULE_PARAM_BOOL, - "false" }, + "false"}, {"logging_strict", MXS_MODULE_PARAM_BOOL, - "true" }, + "true"}, {MXS_END_MODULE_PARAMS} } }; diff --git a/server/modules/filter/namedserverfilter/namedserverfilter.cc b/server/modules/filter/namedserverfilter/namedserverfilter.cc index a7b6d5e17..9adcc4cb8 100644 --- a/server/modules/filter/namedserverfilter/namedserverfilter.cc +++ b/server/modules/filter/namedserverfilter/namedserverfilter.cc @@ -54,9 +54,9 @@ static StringVector param_names_target_indexed; static const MXS_ENUM_VALUE option_values[] = { - {"ignorecase", PCRE2_CASELESS }, - {"case", 0 }, - {"extended", PCRE2_EXTENDED }, // Ignore white space and # comments + {"ignorecase", PCRE2_CASELESS}, + {"case", 0 }, + {"extended", PCRE2_EXTENDED}, // Ignore white space and # comments {NULL} }; @@ -944,13 +944,13 @@ extern "C" MXS_MODULE* MXS_CREATE_MODULE() NULL, /* Thread finish. */ { {"source", - MXS_MODULE_PARAM_STRING }, + MXS_MODULE_PARAM_STRING}, {"user", - MXS_MODULE_PARAM_STRING }, + MXS_MODULE_PARAM_STRING}, {MATCH_STR, - MXS_MODULE_PARAM_STRING }, + MXS_MODULE_PARAM_STRING}, {SERVER_STR, - MXS_MODULE_PARAM_SERVER }, + MXS_MODULE_PARAM_SERVER}, { "options", MXS_MODULE_PARAM_ENUM, diff --git a/server/modules/filter/qlafilter/qlafilter.cc b/server/modules/filter/qlafilter/qlafilter.cc index b35862a8d..a3eca15c0 100644 --- a/server/modules/filter/qlafilter/qlafilter.cc +++ b/server/modules/filter/qlafilter/qlafilter.cc @@ -113,9 +113,9 @@ static bool cb_log(const MODULECMD_ARG* argv, json_t** output); static const MXS_ENUM_VALUE option_values[] = { - {"ignorecase", PCRE2_CASELESS }, - {"case", 0 }, - {"extended", PCRE2_EXTENDED }, + {"ignorecase", PCRE2_CASELESS}, + {"case", 0 }, + {"extended", PCRE2_EXTENDED}, {NULL} }; @@ -128,12 +128,12 @@ static const MXS_ENUM_VALUE log_type_values[] = static const MXS_ENUM_VALUE log_data_values[] = { - {"service", LOG_DATA_SERVICE }, - {"session", LOG_DATA_SESSION }, - {"date", LOG_DATA_DATE }, - {"user", LOG_DATA_USER }, - {"query", LOG_DATA_QUERY }, - {"reply_time", LOG_DATA_REPLY_TIME }, + {"service", LOG_DATA_SERVICE }, + {"session", LOG_DATA_SESSION }, + {"date", LOG_DATA_DATE }, + {"user", LOG_DATA_USER }, + {"query", LOG_DATA_QUERY }, + {"reply_time", LOG_DATA_REPLY_TIME}, {NULL} }; diff --git a/server/modules/filter/regexfilter/regexfilter.cc b/server/modules/filter/regexfilter/regexfilter.cc index 0aa9dc069..8cae6ae1b 100644 --- a/server/modules/filter/regexfilter/regexfilter.cc +++ b/server/modules/filter/regexfilter/regexfilter.cc @@ -91,8 +91,8 @@ void log_nomatch(REGEX_INSTANCE* inst, char* re, char* old); static const MXS_ENUM_VALUE option_values[] = { - {"ignorecase", PCRE2_CASELESS }, - {"case", 0 }, + {"ignorecase", PCRE2_CASELESS}, + {"case", 0 }, {NULL} }; @@ -125,37 +125,49 @@ extern "C" NULL, // No destroyInstance }; + static const char description[] = "A query rewrite filter that uses regular " + "expressions to rewrite queries"; static MXS_MODULE info = { MXS_MODULE_API_FILTER, MXS_MODULE_GA, MXS_FILTER_VERSION, - "A query rewrite filter that uses regular expressions to rewrite queries", + description, "V1.1.0", RCAP_TYPE_CONTIGUOUS_INPUT, &MyObject, - NULL, /* Process init. */ - NULL, /* Process finish. */ - NULL, /* Thread init. */ - NULL, /* Thread finish. */ + NULL, + NULL, + NULL, + NULL, { - {"match", MXS_MODULE_PARAM_STRING, - NULL, - MXS_MODULE_OPT_REQUIRED }, - {"replace", MXS_MODULE_PARAM_STRING, - NULL, - MXS_MODULE_OPT_REQUIRED }, - {"source", - MXS_MODULE_PARAM_STRING}, - {"user", - MXS_MODULE_PARAM_STRING}, - {"log_trace", MXS_MODULE_PARAM_BOOL, - "false" }, - {"log_file", - MXS_MODULE_PARAM_STRING}, - {"options", MXS_MODULE_PARAM_ENUM, - "ignorecase", MXS_MODULE_OPT_NONE, - option_values}, + { + "match", + MXS_MODULE_PARAM_STRING, + NULL, + MXS_MODULE_OPT_REQUIRED + }, + { + "replace", + MXS_MODULE_PARAM_STRING, + NULL, + MXS_MODULE_OPT_REQUIRED + }, + { + "options", + MXS_MODULE_PARAM_ENUM, + "ignorecase", + MXS_MODULE_OPT_NONE, + option_values + }, + { + "log_trace", + MXS_MODULE_PARAM_BOOL, + "false" + }, + {"source", MXS_MODULE_PARAM_STRING }, + {"user", MXS_MODULE_PARAM_STRING }, + {"log_file", MXS_MODULE_PARAM_STRING }, {MXS_END_MODULE_PARAMS} } }; diff --git a/server/modules/filter/throttlefilter/throttlefilter.cc b/server/modules/filter/throttlefilter/throttlefilter.cc index e2ef136c5..224ab61fc 100644 --- a/server/modules/filter/throttlefilter/throttlefilter.cc +++ b/server/modules/filter/throttlefilter/throttlefilter.cc @@ -101,8 +101,7 @@ ThrottleFilter* ThrottleFilter::create(const char* zName, MXS_CONFIG_PARAMETER* maxbase::Duration continuous_duration {std::chrono::milliseconds(cont_msecs)}; ThrottleConfig config = {max_qps, sampling_duration, - throttling_duration, continuous_duration - }; + throttling_duration, continuous_duration}; filter = new ThrottleFilter(config); } diff --git a/server/modules/filter/topfilter/topfilter.cc b/server/modules/filter/topfilter/topfilter.cc index ddc3b20ad..27bde13c8 100644 --- a/server/modules/filter/topfilter/topfilter.cc +++ b/server/modules/filter/topfilter/topfilter.cc @@ -124,9 +124,9 @@ typedef struct static const MXS_ENUM_VALUE option_values[] = { - {"ignorecase", REG_ICASE }, - {"case", 0 }, - {"extended", REG_EXTENDED }, + {"ignorecase", REG_ICASE }, + {"case", 0 }, + {"extended", REG_EXTENDED}, {NULL} }; @@ -164,23 +164,22 @@ extern "C" MXS_MODULE_API_FILTER, MXS_MODULE_GA, MXS_FILTER_VERSION, - "A top N query logging filter", + "A top N query " + "logging filter", "V1.0.1", RCAP_TYPE_CONTIGUOUS_INPUT, &MyObject, - NULL, /* Process init. */ - NULL, /* Process finish. */ - NULL, /* Thread init. */ - NULL, /* Thread finish. */ + NULL, + NULL, + NULL, + NULL, { - {"count", MXS_MODULE_PARAM_COUNT, - "10" }, - {"filebase", MXS_MODULE_PARAM_STRING, NULL, - MXS_MODULE_OPT_REQUIRED }, - {"match", MXS_MODULE_PARAM_STRING}, - {"exclude", MXS_MODULE_PARAM_STRING}, - {"source", MXS_MODULE_PARAM_STRING}, - {"user", MXS_MODULE_PARAM_STRING}, + {"count", MXS_MODULE_PARAM_COUNT, "10" }, + {"filebase", MXS_MODULE_PARAM_STRING, NULL, MXS_MODULE_OPT_REQUIRED}, + {"match", MXS_MODULE_PARAM_STRING}, + {"exclude", MXS_MODULE_PARAM_STRING}, + {"source", MXS_MODULE_PARAM_STRING}, + {"user", MXS_MODULE_PARAM_STRING}, { "options", MXS_MODULE_PARAM_ENUM, diff --git a/server/modules/filter/tpmfilter/tpmfilter.cc b/server/modules/filter/tpmfilter/tpmfilter.cc index 4374839d8..711e81779 100644 --- a/server/modules/filter/tpmfilter/tpmfilter.cc +++ b/server/modules/filter/tpmfilter/tpmfilter.cc @@ -163,6 +163,7 @@ extern "C" */ MXS_MODULE* MXS_CREATE_MODULE() { + static const char description[] = "Transaction Performance Monitoring filter"; static MXS_FILTER_OBJECT MyObject = { createInstance, @@ -184,25 +185,21 @@ extern "C" MXS_MODULE_API_FILTER, MXS_MODULE_GA, MXS_FILTER_VERSION, - "Transaction Performance Monitoring filter", + description, "V1.0.1", RCAP_TYPE_CONTIGUOUS_INPUT, &MyObject, - NULL, /* Process init. */ - NULL, /* Process finish. */ - NULL, /* Thread init. */ - NULL, /* Thread finish. */ + NULL, + NULL, + NULL, + NULL, { - {"named_pipe", MXS_MODULE_PARAM_STRING, - DEFAULT_NAMED_PIPE }, - {"filename", MXS_MODULE_PARAM_STRING, - DEFAULT_FILE_NAME }, - {"delimiter", MXS_MODULE_PARAM_STRING, - DEFAULT_LOG_DELIMITER }, - {"query_delimiter", MXS_MODULE_PARAM_STRING, - DEFAULT_QUERY_DELIMITER }, - {"source", MXS_MODULE_PARAM_STRING}, - {"user", MXS_MODULE_PARAM_STRING}, + {"named_pipe", MXS_MODULE_PARAM_STRING, DEFAULT_NAMED_PIPE }, + {"filename", MXS_MODULE_PARAM_STRING, DEFAULT_FILE_NAME }, + {"delimiter", MXS_MODULE_PARAM_STRING, DEFAULT_LOG_DELIMITER }, + {"query_delimiter", MXS_MODULE_PARAM_STRING, DEFAULT_QUERY_DELIMITER}, + {"source", MXS_MODULE_PARAM_STRING}, + {"user", MXS_MODULE_PARAM_STRING}, {MXS_END_MODULE_PARAMS} } }; diff --git a/server/modules/monitor/mariadbmon/cluster_discovery.cc b/server/modules/monitor/mariadbmon/cluster_discovery.cc index 4b25485ad..d0aebcecf 100644 --- a/server/modules/monitor/mariadbmon/cluster_discovery.cc +++ b/server/modules/monitor/mariadbmon/cluster_discovery.cc @@ -26,7 +26,7 @@ using maxscale::string_printf; namespace { -using VisitorFunc = std::function; // Used by graph search +using VisitorFunc = std::function; // Used by graph search /** * Generic depth-first search. Iterates through the root and its child nodes (slaves) and runs diff --git a/server/modules/monitor/mariadbmon/mariadbmon.cc b/server/modules/monitor/mariadbmon/mariadbmon.cc index cc6da48dd..49f5e79fd 100644 --- a/server/modules/monitor/mariadbmon/mariadbmon.cc +++ b/server/modules/monitor/mariadbmon/mariadbmon.cc @@ -1014,51 +1014,125 @@ extern "C" MXS_MODULE* MXS_CREATE_MODULE() NULL, /* Thread init. */ NULL, /* Thread finish. */ { - {"detect_replication_lag", MXS_MODULE_PARAM_BOOL, - "false" }, - {"detect_stale_master", MXS_MODULE_PARAM_BOOL, - "true" }, - {"detect_stale_slave", MXS_MODULE_PARAM_BOOL, - "true" }, - {"mysql51_replication", MXS_MODULE_PARAM_BOOL, - "false", - MXS_MODULE_OPT_DEPRECATED }, - {"multimaster", MXS_MODULE_PARAM_BOOL, - "false", - MXS_MODULE_OPT_DEPRECATED }, - {CN_DETECT_STANDALONE_MASTER, MXS_MODULE_PARAM_BOOL, - "true" }, - {CN_FAILCOUNT, MXS_MODULE_PARAM_COUNT, - "5" }, - {"allow_cluster_recovery", MXS_MODULE_PARAM_BOOL, "true", - MXS_MODULE_OPT_DEPRECATED }, - {"ignore_external_masters", MXS_MODULE_PARAM_BOOL, - "false" }, - {CN_AUTO_FAILOVER, MXS_MODULE_PARAM_BOOL, - "false" }, - {CN_FAILOVER_TIMEOUT, MXS_MODULE_PARAM_COUNT, - "90" }, - {CN_SWITCHOVER_TIMEOUT, MXS_MODULE_PARAM_COUNT, - "90" }, - {CN_REPLICATION_USER, MXS_MODULE_PARAM_STRING}, - {CN_REPLICATION_PASSWORD, MXS_MODULE_PARAM_STRING}, - {CN_VERIFY_MASTER_FAILURE, MXS_MODULE_PARAM_BOOL, - "true" }, - {CN_MASTER_FAILURE_TIMEOUT, MXS_MODULE_PARAM_COUNT, - "10" }, - {CN_AUTO_REJOIN, MXS_MODULE_PARAM_BOOL, - "false" }, - {CN_ENFORCE_READONLY, MXS_MODULE_PARAM_BOOL, - "false" }, - {CN_NO_PROMOTE_SERVERS, MXS_MODULE_PARAM_SERVERLIST}, - {CN_PROMOTION_SQL_FILE, MXS_MODULE_PARAM_PATH}, - {CN_DEMOTION_SQL_FILE, MXS_MODULE_PARAM_PATH}, - {CN_SWITCHOVER_ON_LOW_DISK_SPACE, MXS_MODULE_PARAM_BOOL, - "false" }, - {CN_MAINTENANCE_ON_LOW_DISK_SPACE, MXS_MODULE_PARAM_BOOL, - "true" }, - {CN_HANDLE_EVENTS, MXS_MODULE_PARAM_BOOL, - "false" }, + { + "detect_replication_lag", + MXS_MODULE_PARAM_BOOL, + "false" + }, + { + "detect_stale_master", + MXS_MODULE_PARAM_BOOL, + "true" + }, + { + "detect_stale_slave", + MXS_MODULE_PARAM_BOOL, + "true" + }, + { + "mysql51_replication", + MXS_MODULE_PARAM_BOOL, + "false", + MXS_MODULE_OPT_DEPRECATED + }, + { + "multimaster", + MXS_MODULE_PARAM_BOOL, + "false", + MXS_MODULE_OPT_DEPRECATED + }, + { + CN_DETECT_STANDALONE_MASTER, + MXS_MODULE_PARAM_BOOL, + "true" + }, + { + CN_FAILCOUNT, + MXS_MODULE_PARAM_COUNT, + "5" + }, + { + "allow_cluster_recovery", + MXS_MODULE_PARAM_BOOL, + "true", + MXS_MODULE_OPT_DEPRECATED + }, + { + "ignore_external_masters", + MXS_MODULE_PARAM_BOOL, + "false" + }, + { + CN_AUTO_FAILOVER, + MXS_MODULE_PARAM_BOOL, + "false" + }, + { + CN_FAILOVER_TIMEOUT, + MXS_MODULE_PARAM_COUNT, + + "90" + }, + { + CN_SWITCHOVER_TIMEOUT, + MXS_MODULE_PARAM_COUNT, + "90" + }, + { + CN_REPLICATION_USER, + MXS_MODULE_PARAM_STRING + }, + { + CN_REPLICATION_PASSWORD, + MXS_MODULE_PARAM_STRING + }, + { + CN_VERIFY_MASTER_FAILURE, + MXS_MODULE_PARAM_BOOL, + "true" + }, + { + CN_MASTER_FAILURE_TIMEOUT, + MXS_MODULE_PARAM_COUNT, + "10" + }, + { + CN_AUTO_REJOIN, + MXS_MODULE_PARAM_BOOL, + "false" + }, + { + CN_ENFORCE_READONLY, + MXS_MODULE_PARAM_BOOL, + "false" + }, + { + CN_NO_PROMOTE_SERVERS, + MXS_MODULE_PARAM_SERVERLIST + }, + { + CN_PROMOTION_SQL_FILE, + MXS_MODULE_PARAM_PATH + }, + { + CN_DEMOTION_SQL_FILE, + MXS_MODULE_PARAM_PATH + }, + { + CN_SWITCHOVER_ON_LOW_DISK_SPACE, + MXS_MODULE_PARAM_BOOL, + "false" + }, + { + CN_MAINTENANCE_ON_LOW_DISK_SPACE, + MXS_MODULE_PARAM_BOOL, + "true" + }, + { + CN_HANDLE_EVENTS, + MXS_MODULE_PARAM_BOOL, + "false" + }, {MXS_END_MODULE_PARAMS} } }; diff --git a/server/modules/monitor/mariadbmon/mariadbmon.hh b/server/modules/monitor/mariadbmon/mariadbmon.hh index 7ff32534d..f6cc81c80 100644 --- a/server/modules/monitor/mariadbmon/mariadbmon.hh +++ b/server/modules/monitor/mariadbmon/mariadbmon.hh @@ -118,14 +118,14 @@ private: struct ManualCommand { public: - std::mutex mutex; /**< Mutex used by the condition variables */ - std::condition_variable has_command; /**< Notified when a command is waiting + std::mutex mutex; /**< Mutex used by the condition variables */ + std::condition_variable has_command; /**< Notified when a command is waiting * execution */ bool command_waiting_exec = false; /**< Guard variable for the above */ std::function method; /**< The method to run when executing the * command */ - std::condition_variable has_result; /**< Notified when the command has ran */ - bool result_waiting = false; /**< Guard variable for the above */ + std::condition_variable has_result; /**< Notified when the command has ran */ + bool result_waiting = false; /**< Guard variable for the above */ }; ServerArray m_servers; /**< Servers of the monitor */ @@ -135,9 +135,9 @@ private: // Values updated by monitor MariaDBServer* m_master; /**< Master server for Master/Slave replication */ MariaDBServer* m_next_master; /**< When master changes because of a failover/switchover, the - * new - * master is written here so the next monitor loop picks it - *up. */ + * new + * master is written here so the next monitor loop picks it + * up. */ IdToServerMap m_servers_by_id; /**< Map from server id:s to MariaDBServer */ int64_t m_master_gtid_domain; /**< gtid_domain_id most recently seen on the master */ std::string m_external_master_host; /**< External master host, for fail/switchover */ @@ -145,8 +145,8 @@ private: bool m_cluster_topology_changed; /**< Has cluster topology changed since last monitor loop? */ bool m_cluster_modified; /**< Has a failover/switchover/rejoin been performed this * loop? */ - CycleMap m_cycles; /**< Map from cycle number to cycle member servers */ - CycleInfo m_master_cycle_status; /**< Info about master server cycle from previous round */ + CycleMap m_cycles; /**< Map from cycle number to cycle member servers */ + CycleInfo m_master_cycle_status; /**< Info about master server cycle from previous round */ // Replication topology detection settings bool m_detect_stale_master; /**< Monitor flag for MySQL replication Stale Master detection */ @@ -155,32 +155,32 @@ private: bool m_ignore_external_masters; /**< Ignore masters outside of the monitor configuration */ // Failover, switchover and rejoin settings - bool m_auto_failover; /**< Is automatic master failover is enabled? */ - bool m_auto_rejoin; /**< Is automatic rejoin enabled? */ - int m_failcount; /**< Numer of cycles master must be down before auto-failover - * begins */ - std::string m_replication_user; /**< Replication user for CHANGE MASTER TO-commands */ - std::string m_replication_password; /**< Replication password for CHANGE MASTER TO-commands */ - uint32_t m_failover_timeout; /**< Time limit in seconds for master failover */ - uint32_t m_switchover_timeout; /**< Time limit in seconds for master switchover */ - bool m_verify_master_failure; /**< Is master failure is verified via slaves? */ - int m_master_failure_timeout; /**< Master failure verification (via slaves) time in seconds - * */ - ServerArray m_excluded_servers; /**< Servers banned for master promotion during auto-failover - * or - * autoselect switchover. */ - std::string m_promote_sql_file; /**< File with sql commands which are ran to a server being - * promoted. */ - std::string m_demote_sql_file; /**< File with sql commands which are ran to a server being - * demoted. */ - bool m_enforce_read_only_slaves; /**< Should the monitor set read-only=1 on any slave servers. - * */ - bool m_switchover_on_low_disk_space; /**< Should the monitor do a switchover on low disk space. */ - bool m_maintenance_on_low_disk_space;/**< Set slave and unreplicating servers with low disk space - * to - * maintenance. */ - bool m_handle_event_scheduler; /**< Should failover/switchover handle any scheduled events on - * the servers */ + bool m_auto_failover; /**< Is automatic master failover is enabled? */ + bool m_auto_rejoin; /**< Is automatic rejoin enabled? */ + int m_failcount; /**< Numer of cycles master must be down before auto-failover + * begins */ + std::string m_replication_user; /**< Replication user for CHANGE MASTER TO-commands */ + std::string m_replication_password; /**< Replication password for CHANGE MASTER TO-commands */ + uint32_t m_failover_timeout; /**< Time limit in seconds for master failover */ + uint32_t m_switchover_timeout; /**< Time limit in seconds for master switchover */ + bool m_verify_master_failure; /**< Is master failure is verified via slaves? */ + int m_master_failure_timeout; /**< Master failure verification (via slaves) time in seconds + * */ + ServerArray m_excluded_servers; /**< Servers banned for master promotion during auto-failover + * or + * autoselect switchover. */ + std::string m_promote_sql_file; /**< File with sql commands which are ran to a server being + * promoted. */ + std::string m_demote_sql_file; /**< File with sql commands which are ran to a server being + * demoted. */ + bool m_enforce_read_only_slaves; /**< Should the monitor set read-only=1 on any slave servers. + * */ + bool m_switchover_on_low_disk_space; /**< Should the monitor do a switchover on low disk space. */ + bool m_maintenance_on_low_disk_space; /**< Set slave and unreplicating servers with low disk space + * to + * maintenance. */ + bool m_handle_event_scheduler; /**< Should failover/switchover handle any scheduled events on + * the servers */ // Other settings bool m_log_no_master; /**< Should it be logged that there is no master */ diff --git a/server/modules/monitor/mariadbmon/mariadbserver.cc b/server/modules/monitor/mariadbmon/mariadbserver.cc index 0f6088164..b06840ff9 100644 --- a/server/modules/monitor/mariadbmon/mariadbserver.cc +++ b/server/modules/monitor/mariadbmon/mariadbserver.cc @@ -1267,12 +1267,12 @@ string SlaveStatus::to_string() const slave_sql_running ? "Yes" : "No"); string rval = string_printf( - " Host: %22s, IO/SQL running: %7s, Master ID: %4" PRId64 ", Gtid_IO_Pos: %s, R.Lag: %d", - host_port.c_str(), - running_states.c_str(), - master_server_id, - gtid_io_pos.to_string().c_str(), - seconds_behind_master); + " Host: %22s, IO/SQL running: %7s, Master ID: %4" PRId64 ", Gtid_IO_Pos: %s, R.Lag: %d", + host_port.c_str(), + running_states.c_str(), + master_server_id, + gtid_io_pos.to_string().c_str(), + seconds_behind_master); return rval; } diff --git a/server/modules/monitor/mariadbmon/mariadbserver.hh b/server/modules/monitor/mariadbmon/mariadbserver.hh index 5904414ea..b43233c34 100644 --- a/server/modules/monitor/mariadbmon/mariadbserver.hh +++ b/server/modules/monitor/mariadbmon/mariadbserver.hh @@ -46,7 +46,7 @@ public: int master_port = PORT_UNKNOWN; /* Master server port. */ slave_io_running_t slave_io_running = SLAVE_IO_NO; /* Slave I/O thread running state: * "Yes", * "Connecting" or "No" */ - bool slave_sql_running = false; /* Slave SQL thread running state, true if "Yes" + bool slave_sql_running = false; /* Slave SQL thread running state, true if "Yes" * */ GtidList gtid_io_pos; /* Gtid I/O position of the slave thread. */ std::string last_error; /* Last IO or SQL error encountered. */ @@ -100,9 +100,9 @@ struct NodeData bool in_stack; /* Is this node currently is the search stack. */ // Results from algorithm runs. Should only be overwritten when server data has been queried. - int cycle; /* Which cycle is this node part of, if any. */ - int reach; /* How many servers replicate from this server or its children. */ - ServerArray parents; /* Which nodes is this node replicating from. External masters + int cycle; /* Which cycle is this node part of, if any. */ + int reach; /* How many servers replicate from this server or its children. */ + ServerArray parents; /* Which nodes is this node replicating from. External masters * excluded. */ ServerArray children; /* Which nodes are replicating from this node. */ std::vector external_masters; /* Server id:s of external masters. */ @@ -172,7 +172,7 @@ public: /** * Update information which changes rarely. This method should be called after (re)connecting to a - *backend. + * backend. * Calling this every monitoring loop is overkill. */ void update_server_version(); diff --git a/server/modules/monitor/mariadbmon/test/test_cycle_find.cc b/server/modules/monitor/mariadbmon/test/test_cycle_find.cc index ebc93a7c3..661fd0c82 100644 --- a/server/modules/monitor/mariadbmon/test/test_cycle_find.cc +++ b/server/modules/monitor/mariadbmon/test/test_cycle_find.cc @@ -103,26 +103,26 @@ int MariaDBMonitor::Test::run_tests() // Test 2: 4 servers, two cycles with a connection between them init_servers(4); - EdgeArray edges2 = {{{1, 2}, {2, 1}, {3, 2}, {3, 4}, {4, 3}}}; + EdgeArray edges2 = { { {1, 2}, {2, 1}, {3, 2}, {3, 4}, {4, 3}}}; add_replication(edges2); - CycleArray expected_cycles2 = {{{{1, 2}}, {{3, 4}}}}; + CycleArray expected_cycles2 = { { { {1, 2}}, { {3, 4}}}}; results.push_back(check_result_cycles(expected_cycles2)); // Test 3: 6 servers, with one cycle init_servers(6); - EdgeArray edges3 = {{{2, 1}, {3, 2}, {4, 3}, {2, 4}, {5, 1}, {6, 5}, {6, 4}}}; + EdgeArray edges3 = { { {2, 1}, {3, 2}, {4, 3}, {2, 4}, {5, 1}, {6, 5}, {6, 4}}}; add_replication(edges3); - CycleArray expected_cycles3 = {{{{2, 3, 4}}}}; + CycleArray expected_cycles3 = { { { {2, 3, 4}}}}; results.push_back(check_result_cycles(expected_cycles3)); // Test 4: 10 servers, with a big cycle composed of two smaller ones plus non-cycle servers init_servers(10); EdgeArray edges4 - = { {{1, 5}, {2, 1}, {2, 5}, {3, 1}, {3, 4}, {3, 10}, {4, 1}, {5, 6}, {6, 7}, {6, 4}, {7, 8}, - {8, 6}, - {9, 8}}}; + = { { {1, 5}, {2, 1}, {2, 5}, {3, 1}, {3, 4}, {3, 10}, {4, 1}, {5, 6}, {6, 7}, {6, 4}, {7, 8}, + {8, 6}, + {9, 8}}}; add_replication(edges4); - CycleArray expected_cycles4 = {{{{1, 5, 6, 7, 8, 4}}}}; + CycleArray expected_cycles4 = { { { {1, 5, 6, 7, 8, 4}}}}; results.push_back(check_result_cycles(expected_cycles4)); clear_servers(); diff --git a/server/modules/monitor/mmmon/mmmon.cc b/server/modules/monitor/mmmon/mmmon.cc index 3718a04ca..5b88290cc 100644 --- a/server/modules/monitor/mmmon/mmmon.cc +++ b/server/modules/monitor/mmmon/mmmon.cc @@ -442,7 +442,11 @@ extern "C" MXS_MODULE* MXS_CREATE_MODULE() NULL, /* Thread init. */ NULL, /* Thread finish. */ { - {"detect_stale_master", MXS_MODULE_PARAM_BOOL, "false"}, + { + "detect_stale_master", + MXS_MODULE_PARAM_BOOL, + "false" + }, {MXS_END_MODULE_PARAMS} } }; diff --git a/server/modules/protocol/HTTPD/httpd.h b/server/modules/protocol/HTTPD/httpd.h index 92540f62c..e02beef45 100644 --- a/server/modules/protocol/HTTPD/httpd.h +++ b/server/modules/protocol/HTTPD/httpd.h @@ -64,7 +64,7 @@ typedef struct httpd_session * the document name */ char* query_string; /*< the Query string, starts with ?, after path_info and document * name */ - int headers_received; /*< All the headers has been received, if 1 */ + int headers_received; /*< All the headers has been received, if 1 */ } HTTPD_session; MXS_END_DECLS diff --git a/server/modules/protocol/MySQL/mariadbbackend/mysql_backend.cc b/server/modules/protocol/MySQL/mariadbbackend/mysql_backend.cc index 9840086fe..b6e426564 100644 --- a/server/modules/protocol/MySQL/mariadbbackend/mysql_backend.cc +++ b/server/modules/protocol/MySQL/mariadbbackend/mysql_backend.cc @@ -518,9 +518,9 @@ static int gw_read_backend_event(DCB* dcb) else if (readbuf) { /* - ** We have a complete response from the server - ** TODO: add support for non-contiguous responses - */ + ** We have a complete response from the server + ** TODO: add support for non-contiguous responses + */ readbuf = gwbuf_make_contiguous(readbuf); MXS_ABORT_IF_NULL(readbuf); diff --git a/server/modules/protocol/MySQL/mariadbclient/mysql_client.cc b/server/modules/protocol/MySQL/mariadbclient/mysql_client.cc index 402581062..7e14e6333 100644 --- a/server/modules/protocol/MySQL/mariadbclient/mysql_client.cc +++ b/server/modules/protocol/MySQL/mariadbclient/mysql_client.cc @@ -69,7 +69,7 @@ static int gw_client_hangup_event(DCB* dcb); static char* gw_default_auth(); static int gw_connection_limit(DCB* dcb, int limit); static int MySQLSendHandshake(DCB* dcb); -static int route_by_statement(MXS_SESSION*, uint64_t, GWBUF**); +static int route_by_statement(MXS_SESSION*, uint64_t, GWBUF * *); static void mysql_client_auth_error_handling(DCB* dcb, int auth_val, int packet_number); static int gw_read_do_authentication(DCB* dcb, GWBUF* read_buffer, int nbytes_read); static int gw_read_normal_data(DCB* dcb, GWBUF* read_buffer, int nbytes_read); @@ -572,7 +572,7 @@ static void store_client_information(DCB* dcb, GWBUF* buffer) gwbuf_copy_data(buffer, 0, len, data); mxb_assert(MYSQL_GET_PAYLOAD_LEN(data) + MYSQL_HEADER_LEN == len - || len == MYSQL_AUTH_PACKET_BASE_SIZE); // For SSL request packet + || len == MYSQL_AUTH_PACKET_BASE_SIZE); // For SSL request packet proto->client_capabilities = gw_mysql_get_byte4(data + MYSQL_CLIENT_CAP_OFFSET); proto->charset = data[MYSQL_CHARSET_OFFSET]; @@ -681,7 +681,7 @@ static int gw_read_do_authentication(DCB* dcb, GWBUF* read_buffer, int nbytes_re * Protocol::SSLRequest packet. * * @see - *https://dev.mysql.com/doc/internals/en/connection-phase-packets.html#packet-Protocol::SSLRequest + * https://dev.mysql.com/doc/internals/en/connection-phase-packets.html#packet-Protocol::SSLRequest */ store_client_information(dcb, read_buffer); } diff --git a/server/modules/routing/avrorouter/avro_main.cc b/server/modules/routing/avrorouter/avro_main.cc index d2134ea0b..6b331d8a0 100644 --- a/server/modules/routing/avrorouter/avro_main.cc +++ b/server/modules/routing/avrorouter/avro_main.cc @@ -453,9 +453,9 @@ extern "C" MXS_MODULE* MXS_CREATE_MODULE() static modulecmd_arg_type_t args_convert[] = { {MODULECMD_ARG_SERVICE | MODULECMD_ARG_NAME_MATCHES_DOMAIN, - "The avrorouter service" }, + "The avrorouter service"}, {MODULECMD_ARG_STRING, - "Action, whether to 'start' or 'stop' the conversion process" } + "Action, whether to 'start' or 'stop' the conversion process"} }; modulecmd_register_command(MXS_MODULE_NAME, "convert", @@ -529,24 +529,24 @@ extern "C" MXS_MODULE* MXS_CREATE_MODULE() | MXS_MODULE_OPT_PATH_CREAT }, {"source", - MXS_MODULE_PARAM_SERVICE }, + MXS_MODULE_PARAM_SERVICE}, {"filestem", MXS_MODULE_PARAM_STRING, - BINLOG_NAME_ROOT }, + BINLOG_NAME_ROOT}, {"group_rows", MXS_MODULE_PARAM_COUNT, - "1000" }, + "1000"}, {"group_trx", MXS_MODULE_PARAM_COUNT, - "1" }, + "1"}, {"start_index", MXS_MODULE_PARAM_COUNT, - "1" }, + "1"}, {"block_size", MXS_MODULE_PARAM_SIZE, - "0" }, - {"codec", MXS_MODULE_PARAM_ENUM, "null", + "0"}, + {"codec", MXS_MODULE_PARAM_ENUM, "null", MXS_MODULE_OPT_ENUM_UNIQUE, - codec_values }, + codec_values}, {"match", - MXS_MODULE_PARAM_REGEX }, + MXS_MODULE_PARAM_REGEX}, {"exclude", - MXS_MODULE_PARAM_REGEX }, + MXS_MODULE_PARAM_REGEX}, {MXS_END_MODULE_PARAMS} } }; diff --git a/server/modules/routing/avrorouter/avrorouter.hh b/server/modules/routing/avrorouter/avrorouter.hh index 84e63809e..02d33f9f7 100644 --- a/server/modules/routing/avrorouter/avrorouter.hh +++ b/server/modules/routing/avrorouter/avrorouter.hh @@ -105,8 +105,8 @@ enum mxs_avro_codec_type static const MXS_ENUM_VALUE codec_values[] = { - {"null", MXS_AVRO_CODEC_NULL }, - {"deflate", MXS_AVRO_CODEC_DEFLATE }, + {"null", MXS_AVRO_CODEC_NULL }, + {"deflate", MXS_AVRO_CODEC_DEFLATE}, // Not yet implemented // {"snappy", MXS_AVRO_CODEC_SNAPPY}, {NULL} @@ -192,7 +192,7 @@ private: }; void read_table_info(uint8_t* ptr, - uint8_t post_header_len, + uint8_t post_header_len, uint64_t* table_id, char* dest, size_t len); @@ -208,7 +208,7 @@ void read_table_identifier(const char* db, const char* sql, const char* end, char* dest, - int size); + int size); int avro_client_handle_request(Avro*, AvroSession*, GWBUF*); void avro_client_rotate(Avro* router, AvroSession* client, uint8_t* ptr); bool avro_open_binlog(const char* binlogdir, const char* file, int* fd); diff --git a/server/modules/routing/avrorouter/rpl.hh b/server/modules/routing/avrorouter/rpl.hh index 38811096e..7eaebb5fc 100644 --- a/server/modules/routing/avrorouter/rpl.hh +++ b/server/modules/routing/avrorouter/rpl.hh @@ -235,7 +235,9 @@ public: SRowEventHandler event_handler, pcre2_code* match, pcre2_code* exclude, - gtid_pos_t = {}); + gtid_pos_t = + { + }); // Add a stored TableCreateEvent void add_create(STableCreateEvent create); diff --git a/server/modules/routing/avrorouter/test/test_alter_parsing.cc b/server/modules/routing/avrorouter/test/test_alter_parsing.cc index bceec27ae..9124590e0 100644 --- a/server/modules/routing/avrorouter/test/test_alter_parsing.cc +++ b/server/modules/routing/avrorouter/test/test_alter_parsing.cc @@ -10,189 +10,194 @@ static struct { {"/*!40000 ALTER TABLE `t1` DISABLE KEYS */", NULL, - false }, + false}, {"/*!40000 ALTER TABLE `t1` ENABLE KEYS */", NULL, - false }, + false}, {"ADD COLUMN `a` INT", NULL, - false }, + false}, {"ADD COLUMN `a`", NULL, - false }, + false}, {"ALTER TABLE `t1` ADD `account_id` INT", NULL, - false }, + false}, {"ALTER TABLE `t1` ADD `amount` INT", NULL, - false }, + false}, {"ALTER TABLE `t1` ADD `app_id` VARCHAR(64)", NULL, - false }, + false}, {"ALTER TABLE `t1` ADD `create_time` DATETIME", NULL, - false }, + false}, {"alter TABLE t1 add `end_time` varchar(10) DEFAULT NULL COMMENT 'this is a comment'", NULL, - false }, + false}, {"ALTER TABLE `t1` ADD `expire_time` DATETIME", NULL, - false }, + false}, {"ALTER TABLE `t1` ADD `id_a` VARCHAR(128)", NULL, - false }, + false}, {"ALTER TABLE `t1` ADD `id` BIGINT(20)", NULL, - false }, + false}, {"ALTER TABLE `t1` ADD `id` VARCHAR(64)", NULL, - false }, + false}, {"ALTER TABLE `t1` ADD `node_state` INT(4)", NULL, - false }, + false}, {"ALTER TABLE `t1` ADD `no` INT", NULL, - false }, + false}, {"ALTER TABLE `t1` ADD `order_id` INT", NULL, - false }, + false}, {"alter TABLE t1 add `start_time` varchar(10) DEFAULT NULL COMMENT 'this is a comment'", NULL, - false }, + false}, {"ALTER TABLE `t1` ADD `status` INT", NULL, - false }, + false}, {"ALTER TABLE `t1` ADD `task_id` BIGINT(20)", NULL, - false }, + false}, {"alter TABLE t1 add `undo` int(1) DEFAULT '0' COMMENT 'this is a comment'", NULL, - false }, + false}, {"alter table `t1` add unique (`a`,`id`)", NULL, - false }, + false}, {"alter table `t1` add unique (`a`)", NULL, - false }, + false}, {"alter table `t1` add UNIQUE(`a`)", NULL, - false }, + false}, {"ALTER TABLE `t1` ADD UNIQUE `idx_id` USING BTREE (`id`, `result`)", NULL, - false }, + false}, {"ALTER TABLE `t1` ADD `update_time` INT", NULL, - false }, + false}, {"ALTER TABLE `t1` ADD `username` VARCHAR(16)", NULL, - false }, + false}, {"ALTER TABLE `t1` AUTO_INCREMENT = 1", NULL, - false }, + false}, {"ALTER TABLE `t1` CHANGE `account_id` `account_id` BIGINT(20)", NULL, - false }, + false}, {"ALTER TABLE `t1` CHANGE `amount` `amount` DECIMAL(32,2)", NULL, - false }, + false}, {"ALTER TABLE `t1` CHANGE `app_id` `app_id` VARCHAR(64)", NULL, - false }, + false}, {"ALTER TABLE `t1` CHANGE `business_id` `business_id` VARCHAR(128)", NULL, - false }, + false}, {"ALTER TABLE `t1` CHANGE `business_id` `business_id` VARCHAR(64)", NULL, - false }, + false}, {"ALTER TABLE `t1` CHANGE `business_unique_no` `business_unique_no` VARCHAR(64)", NULL, - false }, + false}, {"ALTER TABLE `t1` CHANGE `expire_time` `expire_time` DATETIME", NULL, - false }, + false}, {"ALTER TABLE `t1` CHANGE `id_a` `id_a` VARCHAR(128)", NULL, - false }, + false}, {"ALTER TABLE `t1` CHANGE `id` `id` BIGINT(20)", NULL, - false }, + false}, {"ALTER TABLE `t1` CHANGE `node_state` `node_state` INT(4)", NULL, - false }, + false}, {"ALTER TABLE `t1` CHANGE `order_id` `order_id` BIGINT(20)", NULL, - false }, + false}, {"ALTER TABLE `t1` CHANGE `status` `status` INT(1)", NULL, - false }, + false}, {"ALTER TABLE `t1` CHANGE `update_time` `update_time` TIMESTAMP", NULL, - false }, + false}, {"ALTER TABLE `t1` CHANGE `username` `username` VARCHAR(16)", NULL, - false }, + false}, {"ALTER TABLE `t1` COMMENT = 'a comment'", NULL, - false }, + false}, {"alter table `t1` drop index a", NULL, - false }, + false}, {"alter table t1 drop index t1_idx", NULL, - false }, + false}, {"alter table t1 index(account_id, business_id)", NULL, - false }, + false}, { "ALTER TABLE `t1` MODIFY COLUMN `expire_time` DATETIME DEFAULT NULL COMMENT 'this is a comment' AFTER `update_time`", "update_time", - true }, + true + }, { "ALTER TABLE `t1` MODIFY COLUMN `id_a` VARCHAR(128) CHARACTER SET utf8 COLLATE utf8_general_ci COMMENT 'this is a comment' AFTER `username`", "username", - true }, + true + }, { "ALTER TABLE `t1` MODIFY COLUMN `number` VARCHAR(64) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT 'this is a comment' AFTER `business_id`", "business_id", - true }, + true + }, { "ALTER TABLE `t1` MODIFY COLUMN `task_id` BIGINT(20) DEFAULT NULL COMMENT 'this is a comment' AFTER `business_id`", "business_id", - true }, + true + }, { "ALTER TABLE `t1` MODIFY COLUMN `username` VARCHAR(16) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT 'this is a comment' AFTER `business_id`", "business_id", - true }, + true + }, {"ALTER TABLE `t1` RENAME `t2`", NULL, - false }, + false}, {"ALTER TABLE `db1`.`t1` ADD COLUMN `num` varchar(32) COMMENT 'this is a comment' AFTER `bank_name`", "bank_name", - true }, + true}, {"ALTER TABLE `db1`.`t1` ADD INDEX `idx_node_state` USING BTREE (`node_state`) comment ''", NULL, - false }, + false}, {"ALTER TABLE `db1`.`t1` CHANGE COLUMN `num` `code` varchar(32) DEFAULT NULL COMMENT 'this is a comment'", NULL, - false }, + false}, {"ALTER TABLE `db1`.`t1` DROP INDEX `a`, ADD INDEX `a` USING BTREE (`a`) comment ''", NULL, - false }, + false}, {"ALTER TABLE `db1`.`t1` DROP INDEX `a`, ADD INDEX `idx_a` USING BTREE (`a`) comment ''", NULL, - false }, + false}, {"ALTER TABLE `t1` CHANGE COLUMN `a` `c` INT AFTER `b`", "b", - true }, + true}, {"ALTER TABLE `t1` CHANGE COLUMN `a` `c` INT first", NULL, - true }, + true}, {"ALTER TABLE `t1` CHANGE COLUMN `a` `c` INT", NULL, - false }, + false}, {"ALTER TABLE `t1` MODIFY COLUMN `a` INT PRIMARY KEY", NULL, - false }, + false}, {NULL} }; diff --git a/server/modules/routing/binlogrouter/blr.cc b/server/modules/routing/binlogrouter/blr.cc index d94a46648..fd181a99e 100644 --- a/server/modules/routing/binlogrouter/blr.cc +++ b/server/modules/routing/binlogrouter/blr.cc @@ -164,33 +164,33 @@ extern "C" MXS_MODULE* MXS_CREATE_MODULE() NULL, /* Thread finish. */ { {"uuid", - MXS_MODULE_PARAM_STRING }, + MXS_MODULE_PARAM_STRING}, {"server_id", - MXS_MODULE_PARAM_COUNT }, + MXS_MODULE_PARAM_COUNT}, {"master_id", MXS_MODULE_PARAM_COUNT, - "0" }, + "0"}, {"master_uuid", - MXS_MODULE_PARAM_STRING }, + MXS_MODULE_PARAM_STRING}, {"master_version", - MXS_MODULE_PARAM_STRING }, + MXS_MODULE_PARAM_STRING}, {"master_hostname", - MXS_MODULE_PARAM_STRING }, + MXS_MODULE_PARAM_STRING}, {"slave_hostname", - MXS_MODULE_PARAM_STRING }, + MXS_MODULE_PARAM_STRING}, {"mariadb10-compatibility", MXS_MODULE_PARAM_BOOL, - "true" }, + "true"}, {"maxwell-compatibility", MXS_MODULE_PARAM_BOOL, - "false" }, + "false"}, {"filestem", MXS_MODULE_PARAM_STRING, - BINLOG_NAME_ROOT }, + BINLOG_NAME_ROOT}, {"file", MXS_MODULE_PARAM_COUNT, - "1" }, + "1"}, {"transaction_safety", MXS_MODULE_PARAM_BOOL, - "false" }, + "false"}, {"semisync", MXS_MODULE_PARAM_BOOL, - "false" }, + "false"}, {"encrypt_binlog", MXS_MODULE_PARAM_BOOL, - "false" }, + "false"}, { "encryption_algorithm", MXS_MODULE_PARAM_ENUM, "aes_cbc", @@ -198,28 +198,28 @@ extern "C" MXS_MODULE* MXS_CREATE_MODULE() }, {"encryption_key_file", MXS_MODULE_PARAM_PATH, NULL, - MXS_MODULE_OPT_PATH_R_OK }, + MXS_MODULE_OPT_PATH_R_OK}, {"mariadb10_master_gtid", MXS_MODULE_PARAM_BOOL, - "false" }, + "false"}, { "binlog_structure", MXS_MODULE_PARAM_ENUM, "flat", MXS_MODULE_OPT_NONE, binlog_storage_values }, {"shortburst", MXS_MODULE_PARAM_COUNT, - DEF_SHORT_BURST }, + DEF_SHORT_BURST}, {"longburst", MXS_MODULE_PARAM_COUNT, - DEF_LONG_BURST }, + DEF_LONG_BURST}, {"burstsize", MXS_MODULE_PARAM_SIZE, - DEF_BURST_SIZE }, + DEF_BURST_SIZE}, {"heartbeat", MXS_MODULE_PARAM_COUNT, - BLR_HEARTBEAT_DEFAULT_INTERVAL }, + BLR_HEARTBEAT_DEFAULT_INTERVAL}, {"connect_retry", MXS_MODULE_PARAM_COUNT, - BLR_MASTER_CONNECT_RETRY }, + BLR_MASTER_CONNECT_RETRY}, {"master_retry_count", MXS_MODULE_PARAM_COUNT, - BLR_MASTER_RETRY_COUNT }, + BLR_MASTER_RETRY_COUNT}, {"send_slave_heartbeat", MXS_MODULE_PARAM_BOOL, - "false" }, + "false"}, { "binlogdir", MXS_MODULE_PARAM_PATH, @@ -230,7 +230,7 @@ extern "C" MXS_MODULE* MXS_CREATE_MODULE() | MXS_MODULE_OPT_PATH_CREAT }, {"ssl_cert_verification_depth", MXS_MODULE_PARAM_COUNT, - "9" }, + "9"}, {MXS_END_MODULE_PARAMS} } }; @@ -2016,9 +2016,11 @@ static json_t* diagnostics_json(const MXS_ROUTER* router) json_object_set_new(obj, "ssl_ca_cert", json_string(router_inst->service->dbref->server->server_ssl->ssl_ca_cert)); - json_object_set_new(obj, "ssl_cert", + json_object_set_new(obj, + "ssl_cert", json_string(router_inst->service->dbref->server->server_ssl->ssl_cert)); - json_object_set_new(obj, "ssl_key", + json_object_set_new(obj, + "ssl_key", json_string(router_inst->service->dbref->server->server_ssl->ssl_key)); json_object_set_new(obj, "ssl_version", @@ -2034,12 +2036,11 @@ static json_t* diagnostics_json(const MXS_ROUTER* router) json_object_set_new(obj, "key", - json_string( - router_inst->encryption.key_management_filename)); + json_string(router_inst->encryption.key_management_filename)); json_object_set_new(obj, "algorithm", - json_string( - blr_get_encryption_algorithm(router_inst->encryption.encryption_algorithm))); + json_string(blr_get_encryption_algorithm(router_inst->encryption. + encryption_algorithm))); json_object_set_new(obj, "key_length", json_integer(8 * router_inst->encryption.key_len)); diff --git a/server/modules/routing/binlogrouter/blr_master.cc b/server/modules/routing/binlogrouter/blr_master.cc index 11740bf5f..e7fdea7f3 100644 --- a/server/modules/routing/binlogrouter/blr_master.cc +++ b/server/modules/routing/binlogrouter/blr_master.cc @@ -1,6 +1,6 @@ /* - *lint -e662 - *lint -e661 + * lint -e662 + * lint -e661 */ /* diff --git a/server/modules/routing/binlogrouter/blr_slave.cc b/server/modules/routing/binlogrouter/blr_slave.cc index eebbc2eec..6372bbc00 100644 --- a/server/modules/routing/binlogrouter/blr_slave.cc +++ b/server/modules/routing/binlogrouter/blr_slave.cc @@ -405,14 +405,14 @@ int blr_slave_request(ROUTER_INSTANCE* router, ROUTER_SLAVE* slave, GWBUF* queue if (!blr_check_connecting_slave(router, slave, BLR_SLAVE_CONNECTING) - || /* Check whether connecting slaves can be only MariaDB 10 ones */ + || /* Check whether connecting slaves can be only MariaDB 10 ones */ !blr_check_connecting_slave(router, slave, BLR_SLAVE_IS_MARIADB10) - || /** - * If MariaDB 10 GTID master replication is set - * only MariaDB 10 GTID slaves can continue the registration. - */ + || /** + * If MariaDB 10 GTID master replication is set + * only MariaDB 10 GTID slaves can continue the registration. + */ !blr_check_connecting_slave(router, slave, BLR_SLAVE_HAS_MARIADB10_GTID)) @@ -820,8 +820,7 @@ static uint8_t timestamp_def[] = 0x00, 0x00, 0x03, 0xfe, 0x00, 0x00, 0x02, 0x00 }; static uint8_t timestamp_eof[] = {0x05, 0x00, 0x00, 0x05, - 0xfe, 0x00, 0x00, 0x02, 0x00 -}; + 0xfe, 0x00, 0x00, 0x02, 0x00}; /** * Send a response to a "SELECT UNIX_TIMESTAMP()" request. @@ -4367,7 +4366,7 @@ int blr_apply_change_master_0(ROUTER_INSTANCE* router, ssl_error = blr_set_master_ssl(router, new_config, error); if (ssl_error != -1 - && // No CA cert is defined or only one of CERT or KEY is defined + && // No CA cert is defined or only one of CERT or KEY is defined (new_config.ssl_ca.empty() || new_config.ssl_cert.empty() != new_config.ssl_key.empty())) { if (new_config.ssl_enabled) diff --git a/server/modules/routing/binlogrouter/maxbinlogcheck.cc b/server/modules/routing/binlogrouter/maxbinlogcheck.cc index ff4507de1..17d4a618c 100644 --- a/server/modules/routing/binlogrouter/maxbinlogcheck.cc +++ b/server/modules/routing/binlogrouter/maxbinlogcheck.cc @@ -38,17 +38,17 @@ static int set_encryption_options(ROUTER_INSTANCE* inst, char* key_file, char* #ifdef HAVE_GLIBC static struct option long_options[] = { - {"debug", no_argument, 0, 'd'}, - {"version", no_argument, 0, 'V'}, - {"fix", no_argument, 0, 'f'}, - {"mariadb10", no_argument, 0, 'M'}, - {"header", no_argument, 0, 'H'}, - {"key_file", required_argument, 0, 'K'}, - {"aes_algo", required_argument, 0, 'A'}, - {"replace-event", required_argument, 0, 'R'}, - {"remove-trx", required_argument, 0, 'T'}, - {"help", no_argument, 0, '?'}, - {0, 0, 0, 0 } + {"debug", no_argument, 0, 'd' }, + {"version", no_argument, 0, 'V' }, + {"fix", no_argument, 0, 'f' }, + {"mariadb10", no_argument, 0, 'M' }, + {"header", no_argument, 0, 'H' }, + {"key_file", required_argument, 0, 'K' }, + {"aes_algo", required_argument, 0, 'A' }, + {"replace-event", required_argument, 0, 'R' }, + {"remove-trx", required_argument, 0, 'T' }, + {"help", no_argument, 0, '?' }, + {0, 0, 0, 0 } }; #endif const char* binlog_check_version = "2.2.1"; diff --git a/server/modules/routing/binlogrouter/test/testbinlog.cc b/server/modules/routing/binlogrouter/test/testbinlog.cc index 5e73fa173..8b495c650 100644 --- a/server/modules/routing/binlogrouter/test/testbinlog.cc +++ b/server/modules/routing/binlogrouter/test/testbinlog.cc @@ -66,12 +66,12 @@ extern int blr_test_handle_change_master(ROUTER_INSTANCE* router, char* comman static struct option long_options[] = { - {"debug", no_argument, 0, 'd'}, - {"verbose", no_argument, 0, 'v'}, - {"version", no_argument, 0, 'V'}, - {"fix", no_argument, 0, 'f'}, - {"help", no_argument, 0, '?'}, - {0, 0, 0, 0 } + {"debug", no_argument, 0, 'd' }, + {"verbose", no_argument, 0, 'v' }, + {"version", no_argument, 0, 'V' }, + {"fix", no_argument, 0, 'f' }, + {"help", no_argument, 0, '?' }, + {0, 0, 0, 0 } }; int main(int argc, char** argv) @@ -511,7 +511,7 @@ int main(int argc, char** argv) * Expected rc is 0, if 1 test fails */ strcpy(error_string, ""); - change_master = ChangeMasterOptions{}; + change_master = ChangeMasterOptions {}; strcpy(query, "CHANGE MASTER TO MasTER_hoST = '127.0.0.1', MASTER_PORT=9999, MASTER_PASSWORD='massi', MAster_user='eee', master_log_file= 'fffff', master_log_pos= 55" + command_offset); diff --git a/server/modules/routing/debugcli/debugcmd.cc b/server/modules/routing/debugcli/debugcmd.cc index 9ea901967..d2f812e1b 100644 --- a/server/modules/routing/debugcli/debugcmd.cc +++ b/server/modules/routing/debugcli/debugcmd.cc @@ -701,7 +701,7 @@ struct subcommand setoptions[] = "STATUS The status to set\n" "\n" "Example: set server dbnode4 master", - {ARG_TYPE_SERVER, ARG_TYPE_OBJECT_NAME } + {ARG_TYPE_SERVER, ARG_TYPE_OBJECT_NAME} }, { "pollsleep", 1, 1, (FN)set_pollsleep, @@ -1950,25 +1950,25 @@ static struct struct subcommand* options; } cmds[] = { - {"add", addoptions }, - {"remove", removeoptions }, - {"create", createoptions }, - {"destroy", destroyoptions }, - {"alter", alteroptions }, - {"set", setoptions }, - {"clear", clearoptions }, - {"disable", disableoptions }, - {"enable", enableoptions }, - {"flush", flushoptions }, - {"list", listoptions }, - {"reload", reloadoptions }, - {"restart", restartoptions }, - {"shutdown", shutdownoptions }, - {"show", showoptions }, - {"sync", syncoptions }, - {"call", calloptions }, - {"ping", pingoptions }, - {NULL, NULL } + {"add", addoptions }, + {"remove", removeoptions }, + {"create", createoptions }, + {"destroy", destroyoptions }, + {"alter", alteroptions }, + {"set", setoptions }, + {"clear", clearoptions }, + {"disable", disableoptions }, + {"enable", enableoptions }, + {"flush", flushoptions }, + {"list", listoptions }, + {"reload", reloadoptions }, + {"restart", restartoptions }, + {"shutdown", shutdownoptions}, + {"show", showoptions }, + {"sync", syncoptions }, + {"call", calloptions }, + {"ping", pingoptions }, + {NULL, NULL } }; static bool command_requires_admin_privileges(const char* cmd) @@ -2801,10 +2801,10 @@ static int string_to_priority(const char* name) static const struct log_priority_entry LOG_PRIORITY_ENTRIES[] = { // NOTE: If you make changes to this array, ensure that it remains alphabetically ordered. - {"debug", LOG_DEBUG }, - {"info", LOG_INFO }, - {"notice", LOG_NOTICE }, - {"warning", LOG_WARNING }, + {"debug", LOG_DEBUG }, + {"info", LOG_INFO }, + {"notice", LOG_NOTICE }, + {"warning", LOG_WARNING}, }; const size_t N_LOG_PRIORITY_ENTRIES = sizeof(LOG_PRIORITY_ENTRIES) / sizeof(LOG_PRIORITY_ENTRIES[0]); diff --git a/server/modules/routing/readconnroute/readconnroute.cc b/server/modules/routing/readconnroute/readconnroute.cc index 98897fe72..faf351ccf 100644 --- a/server/modules/routing/readconnroute/readconnroute.cc +++ b/server/modules/routing/readconnroute/readconnroute.cc @@ -379,8 +379,8 @@ static MXS_ROUTER_SESSION* newSession(MXS_ROUTER* instance, MXS_SESSION* session candidate = ref; } else if (mxs::almost_equal_server_scores(ref->inv_weight * ref->connections, - candidate->inv_weight * candidate->connections) && - ref->server->stats.n_connections < candidate->server->stats.n_connections) + candidate->inv_weight * candidate->connections) + && ref->server->stats.n_connections < candidate->server->stats.n_connections) { /* The servers are about equally good, but ref has had fewer connections over time. * TODO: On second thought, if the servers are currently about equally good, diff --git a/server/modules/routing/readwritesplit/readwritesplit.cc b/server/modules/routing/readwritesplit/readwritesplit.cc index 7afeb7fb3..5a8a434b8 100644 --- a/server/modules/routing/readwritesplit/readwritesplit.cc +++ b/server/modules/routing/readwritesplit/readwritesplit.cc @@ -408,20 +408,25 @@ bool RWSplit::configure(MXS_CONFIG_PARAMETER* params) */ extern "C" MXS_MODULE* MXS_CREATE_MODULE() { + static const char description[] = "A Read/Write splitting router for enhancement read scalability"; + static MXS_MODULE info = { - MXS_MODULE_API_ROUTER, MXS_MODULE_GA, + MXS_MODULE_API_ROUTER, + MXS_MODULE_GA, MXS_ROUTER_VERSION, - "A Read/Write splitting router for enhancement read scalability", + description, "V1.1.0", - RCAP_TYPE_STMT_INPUT | RCAP_TYPE_TRANSACTION_TRACKING - | RCAP_TYPE_PACKET_OUTPUT | RCAP_TYPE_SESSION_STATE_TRACKING + RCAP_TYPE_STMT_INPUT + | RCAP_TYPE_TRANSACTION_TRACKING + | RCAP_TYPE_PACKET_OUTPUT + | RCAP_TYPE_SESSION_STATE_TRACKING | RCAP_TYPE_RUNTIME_CONFIG, &RWSplit::s_object, - NULL, /* Process init. */ - NULL, /* Process finish. */ - NULL, /* Thread init. */ - NULL, /* Thread finish. */ + NULL, + NULL, + NULL, + NULL, { { "use_sql_variables_in", @@ -444,40 +449,23 @@ extern "C" MXS_MODULE* MXS_CREATE_MODULE() MXS_MODULE_OPT_NONE, master_failure_mode_values }, - {"max_slave_replication_lag", MXS_MODULE_PARAM_INT, - "-1" }, - {"max_slave_connections", MXS_MODULE_PARAM_STRING, - MAX_SLAVE_COUNT }, - {"retry_failed_reads", MXS_MODULE_PARAM_BOOL, - "true" }, - {"disable_sescmd_history", MXS_MODULE_PARAM_BOOL, - "false" }, - {"max_sescmd_history", MXS_MODULE_PARAM_COUNT, - "50" }, - {"strict_multi_stmt", MXS_MODULE_PARAM_BOOL, - "false" }, - {"strict_sp_calls", MXS_MODULE_PARAM_BOOL, - "false" }, - {"master_accept_reads", MXS_MODULE_PARAM_BOOL, - "false" }, - {"connection_keepalive", MXS_MODULE_PARAM_COUNT, - "0" }, - {"causal_reads", MXS_MODULE_PARAM_BOOL, - "false" }, - {"causal_reads_timeout", MXS_MODULE_PARAM_STRING, - "120" }, - {"master_reconnection", MXS_MODULE_PARAM_BOOL, - "false" }, - {"delayed_retry", MXS_MODULE_PARAM_BOOL, - "false" }, - {"delayed_retry_timeout", MXS_MODULE_PARAM_COUNT, - "10" }, - {"transaction_replay", MXS_MODULE_PARAM_BOOL, - "false" }, - {"transaction_replay_max_size", MXS_MODULE_PARAM_SIZE, - "1Mi" }, - {"optimistic_trx", MXS_MODULE_PARAM_BOOL, - "false" }, + {"max_slave_replication_lag", MXS_MODULE_PARAM_INT, "-1" }, + {"max_slave_connections", MXS_MODULE_PARAM_STRING, MAX_SLAVE_COUNT}, + {"retry_failed_reads", MXS_MODULE_PARAM_BOOL, "true" }, + {"disable_sescmd_history", MXS_MODULE_PARAM_BOOL, "false" }, + {"max_sescmd_history", MXS_MODULE_PARAM_COUNT, "50" }, + {"strict_multi_stmt", MXS_MODULE_PARAM_BOOL, "false" }, + {"strict_sp_calls", MXS_MODULE_PARAM_BOOL, "false" }, + {"master_accept_reads", MXS_MODULE_PARAM_BOOL, "false" }, + {"connection_keepalive", MXS_MODULE_PARAM_COUNT, "0" }, + {"causal_reads", MXS_MODULE_PARAM_BOOL, "false" }, + {"causal_reads_timeout", MXS_MODULE_PARAM_STRING, "120" }, + {"master_reconnection", MXS_MODULE_PARAM_BOOL, "false" }, + {"delayed_retry", MXS_MODULE_PARAM_BOOL, "false" }, + {"delayed_retry_timeout", MXS_MODULE_PARAM_COUNT, "10" }, + {"transaction_replay", MXS_MODULE_PARAM_BOOL, "false" }, + {"transaction_replay_max_size",MXS_MODULE_PARAM_SIZE, "1Mi" }, + {"optimistic_trx", MXS_MODULE_PARAM_BOOL, "false" }, {MXS_END_MODULE_PARAMS} } }; diff --git a/server/modules/routing/readwritesplit/rwsplit_select_backends.cc b/server/modules/routing/readwritesplit/rwsplit_select_backends.cc index a510a8bac..05b4c439e 100644 --- a/server/modules/routing/readwritesplit/rwsplit_select_backends.cc +++ b/server/modules/routing/readwritesplit/rwsplit_select_backends.cc @@ -127,7 +127,7 @@ SRWBackendVector::iterator backend_cmp_response_time(SRWBackendVector& sBackends SERVER_REF* server = (**sBackends[i]).backend(); auto ave = server_response_time_average(server->server); - if (ave==0) + if (ave == 0) { constexpr double very_quick = 1.0 / 10000000; // arbitrary very short duration (0.1 // microseconds) diff --git a/server/modules/routing/readwritesplit/rwsplitsession.hh b/server/modules/routing/readwritesplit/rwsplitsession.hh index 107c6f750..bb445914e 100644 --- a/server/modules/routing/readwritesplit/rwsplitsession.hh +++ b/server/modules/routing/readwritesplit/rwsplitsession.hh @@ -130,41 +130,41 @@ public: } // TODO: Make member variables private - mxs::SRWBackendList m_backends; /**< List of backend servers */ - mxs::SRWBackend m_current_master; /**< Current master server */ - mxs::SRWBackend m_target_node; /**< The currently locked target node */ - mxs::SRWBackend m_prev_target; /**< The previous target where a query was sent */ - Config m_config; /**< Configuration for this session */ - int m_nbackends; /**< Number of backend servers (obsolete) */ - DCB* m_client; /**< The client DCB */ - uint64_t m_sescmd_count; /**< Number of executed session commands */ - int m_expected_responses; /**< Number of expected responses to the current - * query */ - GWBUF* m_query_queue; /**< Queued commands waiting to be executed */ - RWSplit* m_router; /**< The router instance */ - mxs::SessionCommandList m_sescmd_list; /**< List of executed session commands */ - ResponseMap m_sescmd_responses; /**< Response to each session command */ - SlaveResponseList m_slave_responses; /**< Slaves that replied before the master */ - uint64_t m_sent_sescmd; /**< ID of the last sent session command*/ - uint64_t m_recv_sescmd; /**< ID of the most recently completed session - * command */ - ClientHandleMap m_ps_handles; /**< Client PS handle to internal ID mapping */ - ExecMap m_exec_map; /**< Map of COM_STMT_EXECUTE statement IDs to - * Backends */ - std::string m_gtid_pos; /**< Gtid position for causal read */ - wait_gtid_state m_wait_gtid; /**< State of MASTER_GTID_WAIT reply */ - uint32_t m_next_seq; /**< Next packet's sequence number */ - mxs::QueryClassifier m_qc; /**< The query classifier. */ - uint64_t m_retry_duration; /**< Total time spent retrying queries */ - mxs::Buffer m_current_query; /**< Current query being executed */ - Trx m_trx; /**< Current transaction */ - bool m_is_replay_active; /**< Whether we are actively replaying a - * transaction */ - bool m_can_replay_trx; /**< Whether the transaction can be replayed */ - Trx m_replayed_trx; /**< The transaction we are replaying */ - mxs::Buffer m_interrupted_query; /**< Query that was interrupted mid-transaction. - * */ - otrx_state m_otrx_state = OTRX_INACTIVE; /**< Optimistic trx state*/ + mxs::SRWBackendList m_backends; /**< List of backend servers */ + mxs::SRWBackend m_current_master; /**< Current master server */ + mxs::SRWBackend m_target_node; /**< The currently locked target node */ + mxs::SRWBackend m_prev_target; /**< The previous target where a query was sent */ + Config m_config; /**< Configuration for this session */ + int m_nbackends; /**< Number of backend servers (obsolete) */ + DCB* m_client; /**< The client DCB */ + uint64_t m_sescmd_count; /**< Number of executed session commands */ + int m_expected_responses; /**< Number of expected responses to the current + * query */ + GWBUF* m_query_queue; /**< Queued commands waiting to be executed */ + RWSplit* m_router; /**< The router instance */ + mxs::SessionCommandList m_sescmd_list; /**< List of executed session commands */ + ResponseMap m_sescmd_responses; /**< Response to each session command */ + SlaveResponseList m_slave_responses; /**< Slaves that replied before the master */ + uint64_t m_sent_sescmd; /**< ID of the last sent session command*/ + uint64_t m_recv_sescmd; /**< ID of the most recently completed session + * command */ + ClientHandleMap m_ps_handles; /**< Client PS handle to internal ID mapping */ + ExecMap m_exec_map; /**< Map of COM_STMT_EXECUTE statement IDs to + * Backends */ + std::string m_gtid_pos; /**< Gtid position for causal read */ + wait_gtid_state m_wait_gtid; /**< State of MASTER_GTID_WAIT reply */ + uint32_t m_next_seq; /**< Next packet's sequence number */ + mxs::QueryClassifier m_qc; /**< The query classifier. */ + uint64_t m_retry_duration; /**< Total time spent retrying queries */ + mxs::Buffer m_current_query; /**< Current query being executed */ + Trx m_trx; /**< Current transaction */ + bool m_is_replay_active; /**< Whether we are actively replaying a + * transaction */ + bool m_can_replay_trx; /**< Whether the transaction can be replayed */ + Trx m_replayed_trx; /**< The transaction we are replaying */ + mxs::Buffer m_interrupted_query; /**< Query that was interrupted mid-transaction. + * */ + otrx_state m_otrx_state = OTRX_INACTIVE; /**< Optimistic trx state*/ private: RWSplitSession(RWSplit* instance, @@ -312,17 +312,17 @@ uint32_t get_internal_ps_id(RWSplitSession* rses, GWBUF* buffer); : (t == TARGET_MASTER ? "TARGET_MASTER" \ : (t == TARGET_SLAVE ? "TARGET_SLAVE" \ : (t \ - == TARGET_NAMED_SERVER ? \ - "TARGET_NAMED_SERVER" \ - : (t \ - == \ - TARGET_RLAG_MAX ? \ - "TARGET_RLAG_MAX" \ - : ( \ - t \ - == \ - TARGET_UNDEFINED \ - ? \ - "TARGET_UNDEFINED" \ - : \ - "Unknown target value")))))) + == TARGET_NAMED_SERVER \ + ? "TARGET_NAMED_SERVER" \ + : (t \ + == \ + TARGET_RLAG_MAX \ + ? "TARGET_RLAG_MAX" \ + : ( \ + t \ + == \ + TARGET_UNDEFINED \ + ? \ + "TARGET_UNDEFINED" \ + : \ + "Unknown target value"))))))