All changes 2.0.0...develop
973b983 Merge branch 'release-2.0.0' into develop 255dd23 Make spinlock functions take const argument 6e23bab Fix bitmask reallocation 338c189 Rename and clean up slavelag filter 3ea8f28 Fix possible NULL pointer dereference bfe6738 MXS-830: Add module information to logged messages 1fad962 Fix strncat usage d38997a Adjust log throttling policy 0be4e4b Add hashtable_item_strcasecmp 726100e Take hashtable convenience functions into use 5e7744a Fix typo in maxadmin.md c5778c8 Merge branch 'release-2.0.0' into develop b5762af Move from tmpnam to mkstemp d6f2c71 Add convenience functions to hashtable 359058a MXS-825: Add support for --execdir 636347c Enable runtime reconfiguration of log throttling ef9fba9 Improve log throttling documentation aef917a Implement log throttling e3a5349 Remove shardrouter.c 8051e80 Remove custom qc_sqlite allocation functions fd34d60 Initial implementation of the learning firewall a8752a8 Removed "filestem option" from example 1ef2519 Removed "filestem option" from example 0815cc8 Cleanup spinlock.h ab4dc99 Clean up hashtable.h ef2c078 Add prototypes for hashtable copy and free functions fb5cfaf Add 'log_throttling' configuration entry 300d823 Add proper prototypes for hashtable hash and cmp functions 1c649aa qc_mysqlembedded: Include skygw_...h without path. d276160 Add missing RPM scripts e70e644 Fix HTTPAuth installation 1b2b389 Combine utils into the server directory 3ff9913 Add missing utils headers to devel package 407efb2 Fix minor packaging problems 99aa6ad Split MaxScale into core, experimental and devel packages 1290386 Merge branch 'develop' of ssh://github.com/mariadb-corporation/maxscale-new into develop e59f148 Make scripts POSIX sh compatible 7319266 Fixed SHOW SLAVE STATUS in bonlog router f8d760a Update Binlogrouter.md 0a904ed Update Replication-Proxy-Binlog-Router-Tutorial.md 75d4202 Update Replication-Proxy-Binlog-Router-Tutorial.md b8651fc Add missing newline in listmanager.h c7ad047 Add note about user data caches to release notes 70ccc2b Merge branch 'release-2.0.0' into develop 575d1b6 Mistake - dummy session needs list markers set. 8364508 Merge branch 'develop' into binlog_server_semisync 868b902 Update MaxScale limitations 2c8b327 Store listener caches in separate directories 6e183ec Create unique user data caches for each listeners f643685 Don't free orphaned tee filter sessions 4179afa Allow binlogrouter to be used without a listener 7ad79af Add function for freeing a listener 677a0a2 Move authentication data from services to listeners 4f12af7 Merge remote-tracking branch 'origin/MXS-677' into develop 1419b81 Semi-Sync support to binlog server: code review updtate 0ea0f01 Semi-Sync support to binlog server: added missing routine 4aad909 Semi-Sync support to binlog server b824e1e Add authenticator support to httpd.c 705a688 Change tabs to spaces d0c419e Change method of adding list fields to e.g. DCB 25504fc Document the changed routing priority of hints 41666d1 Remove use_ssl_if_enabled global option a3584e9 Make routing hints have highest priority 34a1d24 Updated document with new binlog router option 01eedc5 Updated documentation with SSL usage 8a4c0f6 Update Replication-Proxy-Binlog-Router-Tutorial.md 4e374aa Update Replication-Proxy-Binlog-Router-Tutorial.md f3f3c57 Update Replication-Proxy-Binlog-Router-Tutorial.md 617b79f Binlog Server: error messages typo fix fa8dfae Binlog Server: error messages review 1b8819c Fix freeing of schemarouter session memory 07f49e1 MXS-788: new code review fix 1fd3b09 MXS-788: show services now displays SSL info 6ca2584 MXS-788 code review fix ae6a7d0 MXS-788 code review 43d3474 Master server SSL connection 90b2377 Use correct variable in listmanager pre-allocation 9a5b238 Fix listmanager pre-allocation 9c78625 Fix a memory leak when backend authentication fails e59a966 Fix hang in list_find_free ff30223 Fix freeing of shared data in schemarouter fc8f9d3 Add missing include in luafilter ecf7f53 Add missing NULL value to filter parameter array 636d849 Update memory allocation approach f0d1d38 Add new allocation functions 97d00a0 Fix writing of uninitialized data to logs e72c9b2 Merge branch 'release-2.0.0' into develop cf2b712 Merge branch 'release-2.0.0' into develop 8917c5c Change the logic behind valid list entry checks c10deff Improve documentation about version_string f59f1f7 Merge branch 'develop' of ssh://github.com/mariadb-corporation/maxscale-new into develop c88edb3 Backend authentication failure improvement abd5bee Revert "Backend authentication failure improvement" 5bb3107 Backend authentication failure improvement b7f434a Add new allocation functions 3f022fa Fix stupid mistake 99c4317 Merge remote-tracking branch 'origin/MXS-677' into develop 3c1ded6 Added connection/authentication failure error reporting in SHOW SLAVE STATUS 0a60f7b Tidy up and deal with review points. ba103ff blr_slave.c: Update strncpy usage 467331e blr_master.c: Strncpy usage updates d2b7c0c Merge remote-tracking branch 'origin/develop-nullauth-merge' into develop 5a8c1d0 qc: Measure execution time at the right place. bccdb93 Merge branch 'NullAuthDeny' into develop 2e6511c Add 5.5.5 prefix to all version strings that lack it 314655a Improve DCB and session initialization and list handling e1c43f0 MXS-655: Make MaxScale logging logrotate(8) compatible ce36afd MXS-626: Don't log a header unless maxlog enabled dcd47a7 blr_file.c: Replace uses of strncpy 6b8f576 bls_slave.c: Replace strncpy with memcpy 68a0039 Add list preallocation, tidy up, simplify init. cb37d1b Fix copyright etc headers. 11a400d Tidy; comment; fix bad copies and mistakes. 7e36ec4 Add list manager files. c4794e3 Initial code for list manager. 1b42e25 Merge remote-tracking branch 'origin/MXS-765' into develop d50f617 Fix problems, extend tests, respond to review. dcb4a91 Filter test folder removed 0b60dbe Add a couple of comments. 83cdba0 Fix overwriting problem. ba5d353 Fix overwriting problem. 53671cb Small fixes in response to review. 173d049 blr.c: Review strncpy usage 4ff6ef2 binlog_common.c: Replace strncpy with memcpy f238e03 maxbinlogcheck.s: Replace strncpy 9807f8d harness: Replace unnecessary use of strncpy 8c7fe6a avro: Modify strncpy usage 9b8008e Small improvements. b7f784f Fix mistakes in testqueuemanager.c cc26962 Restore missing poll.c code; add testqueuemanager.c. 2e91806 Format the filter harness 22059e6 Initial implementation connection queueing. c604dc2 readwritesplit.c: Improve COM_INIT_DB handling 454d920 schemarouter.c: Replace strncpy with strcpy 8e85d66 sharding_common.c: Too long a database name handled explicitly 77f4446 Astyle schemarouter 491f7c2 maxinfo.c: Replace strncpy with memcpy 6b98105 maxinfo: Reformat with astyle c1dbf08 Handle oversize user and database names 5fa4a0f Merge branch 'develop' of ssh://github.com/mariadb-corporation/maxscale-new into develop 706963b BLR_DBUSERS_TAIL new var in blr.h d75b9af Tweak comments, remove trailing blanks. ab2400a Optimise statistics gathering by inline & simpler fns. fb59ddc Remove unnecessary strncpy/strncat usage in Binlog Server bdcd551 resultset.c: Change strncpy to memcpy c6b1c5e Reject rather than cut too long a path 6d8f112 Remove unnecessary strncpy/strncat usage 18bf5ed Remove unnecessary strncpy usage dc0e2db Make maxpasswd more userfriendly c9c8695 Fix calculation of padded_len in encryptPassword 2cfd2c6 dbusers.c: Check strncpy usage 7ab9342 Make more thorough checks in secrets_readKeys be7d593 Format cli.c debugcli.c testroute.c webserver.c 1ee5efb config.c: Check usage of strncpy 3043b12 gq_utils.c: Unnecessary use of strncpy removed 77874ac Add help to maxkeys 38392a3 Update secrets_writeKeys documentation 2d1325c Make SSL optional in MaxScale's own communication bda00da Fix avro build failures b2cb31a Add more OOM macros 41ccf17 Fix strdup usage a48f732 Fix realloc calls 20771f6 Add forgotten extern "C" block 8faf35a Add maxscale allocation functions bb47890 Add macros for OOM logging afea388 Fix silly mistakes. 6dafd22 Make deny default for null auth; move code from common to auth.
This commit is contained in:
7
server/include/CMakeLists.txt
Normal file
7
server/include/CMakeLists.txt
Normal file
@ -0,0 +1,7 @@
|
||||
file(GLOB HEADERS "*.h")
|
||||
foreach(var ${HEADERS})
|
||||
get_filename_component(header ${var} NAME)
|
||||
install_header(${header} devel)
|
||||
endforeach()
|
||||
|
||||
add_subdirectory(maxscale)
|
||||
@ -6,7 +6,7 @@
|
||||
* Use of this software is governed by the Business Source License included
|
||||
* in the LICENSE.TXT file and at www.mariadb.com/bsl.
|
||||
*
|
||||
* Change Date: 2019-01-01
|
||||
* Change Date: 2019-07-01
|
||||
*
|
||||
* On the date above, in accordance with the Business Source License, use
|
||||
* of this software will be governed by version 2 or later of the General
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
* Use of this software is governed by the Business Source License included
|
||||
* in the LICENSE.TXT file and at www.mariadb.com/bsl.
|
||||
*
|
||||
* Change Date: 2019-01-01
|
||||
* Change Date: 2019-07-01
|
||||
*
|
||||
* On the date above, in accordance with the Business Source License, use
|
||||
* of this software will be governed by version 2 or later of the General
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
* Use of this software is governed by the Business Source License included
|
||||
* in the LICENSE.TXT file and at www.mariadb.com/bsl.
|
||||
*
|
||||
* Change Date: 2019-01-01
|
||||
* Change Date: 2019-07-01
|
||||
*
|
||||
* On the date above, in accordance with the Business Source License, use
|
||||
* of this software will be governed by version 2 or later of the General
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
* Use of this software is governed by the Business Source License included
|
||||
* in the LICENSE.TXT file and at www.mariadb.com/bsl.
|
||||
*
|
||||
* Change Date: 2019-01-01
|
||||
* Change Date: 2019-07-01
|
||||
*
|
||||
* On the date above, in accordance with the Business Source License, use
|
||||
* of this software will be governed by version 2 or later of the General
|
||||
@ -49,6 +49,10 @@
|
||||
#define MYSQL_DATABASE_MAXLEN 128
|
||||
#define MYSQL_TABLE_MAXLEN 64
|
||||
|
||||
/** Cache directory and file names */
|
||||
static const char DBUSERS_DIR[] = "cache";
|
||||
static const char DBUSERS_FILE[] = "dbusers";
|
||||
|
||||
/**
|
||||
* MySQL user and host data structure
|
||||
*/
|
||||
@ -66,11 +70,11 @@ extern int add_mysql_users_with_host_ipv4(USERS *users, const char *user, const
|
||||
extern bool check_service_permissions(SERVICE* service);
|
||||
extern int dbusers_load(USERS *, const char *filename);
|
||||
extern int dbusers_save(USERS *, const char *filename);
|
||||
extern int load_mysql_users(SERVICE *service);
|
||||
extern int load_mysql_users(SERV_LISTENER *listener);
|
||||
extern int mysql_users_add(USERS *users, MYSQL_USER_HOST *key, char *auth);
|
||||
extern USERS *mysql_users_alloc();
|
||||
extern char *mysql_users_fetch(USERS *users, MYSQL_USER_HOST *key);
|
||||
extern int reload_mysql_users(SERVICE *service);
|
||||
extern int replace_mysql_users(SERVICE *service);
|
||||
extern int reload_mysql_users(SERV_LISTENER *listener);
|
||||
extern int replace_mysql_users(SERV_LISTENER *listener);
|
||||
|
||||
#endif
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
* Use of this software is governed by the Business Source License included
|
||||
* in the LICENSE.TXT file and at www.mariadb.com/bsl.
|
||||
*
|
||||
* Change Date: 2019-01-01
|
||||
* Change Date: 2019-07-01
|
||||
*
|
||||
* On the date above, in accordance with the Business Source License, use
|
||||
* of this software will be governed by version 2 or later of the General
|
||||
@ -14,6 +14,7 @@
|
||||
*/
|
||||
#include <spinlock.h>
|
||||
#include <buffer.h>
|
||||
#include <listmanager.h>
|
||||
#include <gw_protocol.h>
|
||||
#include <gw_authenticator.h>
|
||||
#include <gw_ssl.h>
|
||||
@ -57,6 +58,7 @@ struct servlistener;
|
||||
* 19/06/2015 Martin Brampton Provision of persistent connections
|
||||
* 20/01/2016 Martin Brampton Moved GWPROTOCOL to gw_protocol.h
|
||||
* 01/02/2016 Martin Brampton Added fields for SSL and authentication
|
||||
* 27/06/2016 Martin Brampton Changed DCB to conform to list manager
|
||||
*
|
||||
* @endverbatim
|
||||
*/
|
||||
@ -88,6 +90,8 @@ typedef struct
|
||||
unsigned long started;
|
||||
} DCBEVENTQ;
|
||||
|
||||
#define DCBEVENTQ_INIT {NULL, NULL, 0, 0, 0, SPINLOCK_INIT, 0, 0}
|
||||
|
||||
#define DCBFD_CLOSED -1
|
||||
|
||||
/**
|
||||
@ -103,6 +107,8 @@ typedef struct dcbstats
|
||||
int n_low_water; /*< Number of crosses of low water mark */
|
||||
} DCBSTATS;
|
||||
|
||||
#define DCBSTATS_INIT {0}
|
||||
|
||||
/**
|
||||
* The data structure that is embedded witin a DCB and manages the complex memory
|
||||
* management issues of a DCB.
|
||||
@ -127,12 +133,15 @@ typedef struct
|
||||
struct dcb *next; /*< Next pointer for the zombie list */
|
||||
} DCBMM;
|
||||
|
||||
#define DCBMM_INIT {GWBITMASK_INIT}
|
||||
|
||||
/* DCB states */
|
||||
typedef enum
|
||||
{
|
||||
DCB_STATE_UNDEFINED, /*< State variable with no state */
|
||||
DCB_STATE_ALLOC, /*< Memory allocated but not populated */
|
||||
DCB_STATE_POLLING, /*< Waiting in the poll loop */
|
||||
DCB_STATE_WAITING, /*< Client wanting a connection */
|
||||
DCB_STATE_LISTENING, /*< The DCB is for a listening socket */
|
||||
DCB_STATE_DISCONNECTED, /*< The socket is now closed */
|
||||
DCB_STATE_NOPOLLING, /*< Removed from poll mask */
|
||||
@ -189,16 +198,19 @@ typedef enum
|
||||
*
|
||||
* A wrapper for a network descriptor within the gateway, it contains all the
|
||||
* state information necessary to allow for the implementation of the asynchronous
|
||||
* operation of the potocol and gateway functions. It also provides links to the service
|
||||
* operation of the protocol and gateway functions. It also provides links to the service
|
||||
* and session data that is required to route the information within the gateway.
|
||||
*
|
||||
* It is important to hold the state information here such that any thread within the
|
||||
* gateway may be selected to execute the required actions when a network event occurs.
|
||||
*
|
||||
* Note that the first few fields (up to and including "entry_is_ready") must
|
||||
* precisely match the LIST_ENTRY structure defined in the list manager.
|
||||
*/
|
||||
typedef struct dcb
|
||||
{
|
||||
LIST_ENTRY_FIELDS
|
||||
skygw_chk_t dcb_chk_top;
|
||||
bool dcb_is_in_use; /**< Whether DCB is in use or for later reuse */
|
||||
bool dcb_errhandle_called; /*< this can be called only once */
|
||||
bool dcb_is_zombie; /**< Whether the DCB is in the zombie list */
|
||||
bool draining_flag; /**< Set while write queue is drained */
|
||||
@ -232,7 +244,6 @@ typedef struct dcb
|
||||
|
||||
DCBSTATS stats; /**< DCB related statistics */
|
||||
unsigned int dcb_server_status; /*< the server role indicator from SERVER */
|
||||
struct dcb *next; /**< Next DCB in the chain of allocated DCB's */
|
||||
struct dcb *nextpersistent; /**< Next DCB in the persistent pool for SERVER */
|
||||
time_t persistentstart; /**< Time when DCB placed in persistent pool */
|
||||
struct service *service; /**< The related service */
|
||||
@ -260,6 +271,14 @@ typedef struct dcb
|
||||
skygw_chk_t dcb_chk_tail;
|
||||
} DCB;
|
||||
|
||||
#define DCB_INIT {.dcb_chk_top = CHK_NUM_DCB, .dcb_initlock = SPINLOCK_INIT, \
|
||||
.evq = DCBEVENTQ_INIT, .ipv4 = {0}, .func = {0}, .authfunc = {0}, \
|
||||
.writeqlock = SPINLOCK_INIT, .delayqlock = SPINLOCK_INIT, \
|
||||
.authlock = SPINLOCK_INIT, .stats = {0}, .memdata = DCBMM_INIT, \
|
||||
.cb_lock = SPINLOCK_INIT, .pollinlock = SPINLOCK_INIT, \
|
||||
.fd = DCBFD_CLOSED, .stats = DCBSTATS_INIT, .ssl_state = SSL_HANDSHAKE_UNKNOWN, \
|
||||
.state = DCB_STATE_ALLOC, .polloutlock = SPINLOCK_INIT, .dcb_chk_tail = CHK_NUM_DCB}
|
||||
|
||||
/**
|
||||
* The DCB usage filer used for returning DCB's in use for a certain reason
|
||||
*/
|
||||
@ -297,6 +316,7 @@ int fail_accept_errno;
|
||||
DCB *dcb_get_zombies(void);
|
||||
int dcb_write(DCB *, GWBUF *);
|
||||
DCB *dcb_accept(DCB *listener, GWPROTOCOL *protocol_funcs);
|
||||
bool dcb_pre_alloc(int number);
|
||||
DCB *dcb_alloc(dcb_role_t, struct servlistener *);
|
||||
void dcb_free(DCB *);
|
||||
void dcb_free_all_memory(DCB *dcb);
|
||||
@ -308,6 +328,7 @@ void dcb_close(DCB *);
|
||||
DCB *dcb_process_zombies(int); /* Process Zombies except the one behind the pointer */
|
||||
void printAllDCBs(); /* Debug to print all DCB in the system */
|
||||
void printDCB(DCB *); /* Debug print routine */
|
||||
void dprintDCBList(DCB *); /* Debug print DCB list statistics */
|
||||
void dprintAllDCBs(DCB *); /* Debug to print all DCB in the system */
|
||||
void dprintOneDCB(DCB *, DCB *); /* Debug to print one DCB */
|
||||
void dprintDCB(DCB *, DCB *); /* Debug to print a DCB in the system */
|
||||
|
||||
@ -4,7 +4,7 @@
|
||||
* Use of this software is governed by the Business Source License included
|
||||
* in the LICENSE.TXT file and at www.mariadb.com/bsl.
|
||||
*
|
||||
* Change Date: 2019-01-01
|
||||
* Change Date: 2019-07-01
|
||||
*
|
||||
* On the date above, in accordance with the Business Source License, use
|
||||
* of this software will be governed by version 2 or later of the General
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
* Use of this software is governed by the Business Source License included
|
||||
* in the LICENSE.TXT file and at www.mariadb.com/bsl.
|
||||
*
|
||||
* Change Date: 2019-01-01
|
||||
* Change Date: 2019-07-01
|
||||
*
|
||||
* On the date above, in accordance with the Business Source License, use
|
||||
* of this software will be governed by version 2 or later of the General
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
* Use of this software is governed by the Business Source License included
|
||||
* in the LICENSE.TXT file and at www.mariadb.com/bsl.
|
||||
*
|
||||
* Change Date: 2019-01-01
|
||||
* Change Date: 2019-07-01
|
||||
*
|
||||
* On the date above, in accordance with the Business Source License, use
|
||||
* of this software will be governed by version 2 or later of the General
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
* Use of this software is governed by the Business Source License included
|
||||
* in the LICENSE.TXT file and at www.mariadb.com/bsl.
|
||||
*
|
||||
* Change Date: 2019-01-01
|
||||
* Change Date: 2019-07-01
|
||||
*
|
||||
* On the date above, in accordance with the Business Source License, use
|
||||
* of this software will be governed by version 2 or later of the General
|
||||
@ -82,4 +82,5 @@ int setipaddress(struct in_addr *, char *);
|
||||
char* get_libdir();
|
||||
long get_processor_count();
|
||||
void clean_up_pathname(char *path);
|
||||
bool mxs_mkdir_all(const char *path, int mask);
|
||||
#endif
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
* Use of this software is governed by the Business Source License included
|
||||
* in the LICENSE.TXT file and at www.mariadb.com/bsl.
|
||||
*
|
||||
* Change Date: 2019-01-01
|
||||
* Change Date: 2019-07-01
|
||||
*
|
||||
* On the date above, in accordance with the Business Source License, use
|
||||
* of this software will be governed by version 2 or later of the General
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
* Use of this software is governed by the Business Source License included
|
||||
* in the LICENSE.TXT file and at www.mariadb.com/bsl.
|
||||
*
|
||||
* Change Date: 2019-01-01
|
||||
* Change Date: 2019-07-01
|
||||
*
|
||||
* On the date above, in accordance with the Business Source License, use
|
||||
* of this software will be governed by version 2 or later of the General
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
* Use of this software is governed by the Business Source License included
|
||||
* in the LICENSE.TXT file and at www.mariadb.com/bsl.
|
||||
*
|
||||
* Change Date: 2019-01-01
|
||||
* Change Date: 2019-07-01
|
||||
*
|
||||
* On the date above, in accordance with the Business Source License, use
|
||||
* of this software will be governed by version 2 or later of the General
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
* Use of this software is governed by the Business Source License included
|
||||
* in the LICENSE.TXT file and at www.mariadb.com/bsl.
|
||||
*
|
||||
* Change Date: 2019-01-01
|
||||
* Change Date: 2019-07-01
|
||||
*
|
||||
* On the date above, in accordance with the Business Source License, use
|
||||
* of this software will be governed by version 2 or later of the General
|
||||
@ -43,6 +43,8 @@ typedef struct
|
||||
|
||||
} GWBITMASK;
|
||||
|
||||
#define GWBITMASK_INIT {SPINLOCK_INIT}
|
||||
|
||||
extern void bitmask_init(GWBITMASK *);
|
||||
extern void bitmask_free(GWBITMASK *);
|
||||
extern void bitmask_set(GWBITMASK *, int);
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
* Use of this software is governed by the Business Source License included
|
||||
* in the LICENSE.TXT file and at www.mariadb.com/bsl.
|
||||
*
|
||||
* Change Date: 2019-01-01
|
||||
* Change Date: 2019-07-01
|
||||
*
|
||||
* On the date above, in accordance with the Business Source License, use
|
||||
* of this software will be governed by version 2 or later of the General
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
* Use of this software is governed by the Business Source License included
|
||||
* in the LICENSE.TXT file and at www.mariadb.com/bsl.
|
||||
*
|
||||
* Change Date: 2019-01-01
|
||||
* Change Date: 2019-07-01
|
||||
*
|
||||
* On the date above, in accordance with the Business Source License, use
|
||||
* of this software will be governed by version 2 or later of the General
|
||||
@ -30,8 +30,8 @@
|
||||
*/
|
||||
#include <skygw_debug.h>
|
||||
#include <spinlock.h>
|
||||
#include <atomic.h>
|
||||
#include <dcb.h>
|
||||
|
||||
EXTERN_C_BLOCK_BEGIN
|
||||
|
||||
/**
|
||||
* The entries within a hashtable.
|
||||
@ -58,9 +58,24 @@ typedef struct hashiterator
|
||||
} HASHITERATOR;
|
||||
|
||||
/**
|
||||
* The type definition for the memory allocation functions
|
||||
* The type definition for the hash function
|
||||
*/
|
||||
typedef void *(*HASHMEMORYFN)(void *);
|
||||
typedef int (*HASHHASHFN)(const void *);
|
||||
|
||||
/**
|
||||
* The type definition for the comparison function
|
||||
*/
|
||||
typedef int (*HASHCMPFN)(const void *, const void *);
|
||||
|
||||
/**
|
||||
* The type definition for the key/value copying functions
|
||||
*/
|
||||
typedef void *(*HASHCOPYFN)(const void *);
|
||||
|
||||
/**
|
||||
* The type definition for the key/value freeing functions
|
||||
*/
|
||||
typedef void (*HASHFREEFN)(void *);
|
||||
|
||||
/**
|
||||
* The general purpose hashtable struct.
|
||||
@ -72,12 +87,12 @@ typedef struct hashtable
|
||||
#endif
|
||||
int hashsize; /**< The number of HASHENTRIES */
|
||||
HASHENTRIES **entries; /**< The entries themselves */
|
||||
int (*hashfn)(void *); /**< The hash function */
|
||||
int (*cmpfn)(void *, void *); /**< The key comparison function */
|
||||
HASHMEMORYFN kcopyfn; /**< Optional key copy function */
|
||||
HASHMEMORYFN vcopyfn; /**< Optional value copy function */
|
||||
HASHMEMORYFN kfreefn; /**< Optional key free function */
|
||||
HASHMEMORYFN vfreefn; /**< Optional value free function */
|
||||
HASHHASHFN hashfn; /**< The hash function */
|
||||
HASHCMPFN cmpfn; /**< The key comparison function */
|
||||
HASHCOPYFN kcopyfn; /**< Optional key copy function */
|
||||
HASHCOPYFN vcopyfn; /**< Optional value copy function */
|
||||
HASHFREEFN kfreefn; /**< Optional key free function */
|
||||
HASHFREEFN vfreefn; /**< Optional value free function */
|
||||
SPINLOCK spin; /**< Internal spinlock for the hashtable */
|
||||
int n_readers; /**< Number of clients reading the table */
|
||||
int writelock; /**< The table is locked by a writer */
|
||||
@ -88,17 +103,17 @@ typedef struct hashtable
|
||||
#endif
|
||||
} HASHTABLE;
|
||||
|
||||
extern HASHTABLE *hashtable_alloc(int, int (*hashfn)(), int (*cmpfn)());
|
||||
extern HASHTABLE *hashtable_alloc(int, HASHHASHFN hashfn, HASHCMPFN cmpfn);
|
||||
HASHTABLE *hashtable_alloc_flat(HASHTABLE* target,
|
||||
int size,
|
||||
int (*hashfn)(),
|
||||
int (*cmpfn)());
|
||||
HASHHASHFN hashfn,
|
||||
HASHCMPFN cmpfn);
|
||||
/**< Allocate a hashtable */
|
||||
extern void hashtable_memory_fns(HASHTABLE *table,
|
||||
HASHMEMORYFN kcopyfn,
|
||||
HASHMEMORYFN vcopyfn,
|
||||
HASHMEMORYFN kfreefn,
|
||||
HASHMEMORYFN vfreefn);
|
||||
HASHCOPYFN kcopyfn,
|
||||
HASHCOPYFN vcopyfn,
|
||||
HASHFREEFN kfreefn,
|
||||
HASHFREEFN vfreefn);
|
||||
/**< Provide an interface to control key/value memory
|
||||
* manipulation
|
||||
*/
|
||||
@ -128,4 +143,13 @@ extern void *hashtable_next(HASHITERATOR *);
|
||||
/**< Return the key of the hash table iterator */
|
||||
extern void hashtable_iterator_free(HASHITERATOR *);
|
||||
extern int hashtable_size(HASHTABLE *table);
|
||||
|
||||
extern void hashtable_item_free(void *data);
|
||||
extern int hashtable_item_strcasecmp(const void* str1, const void* str2);
|
||||
extern int hashtable_item_strcmp(const void* str1, const void* str2);
|
||||
extern void* hashtable_item_strdup(const void *str);
|
||||
extern int hashtable_item_strhash(const void *str);
|
||||
|
||||
EXTERN_C_BLOCK_END
|
||||
|
||||
#endif
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
* Use of this software is governed by the Business Source License included
|
||||
* in the LICENSE.TXT file and at www.mariadb.com/bsl.
|
||||
*
|
||||
* Change Date: 2019-01-01
|
||||
* Change Date: 2019-07-01
|
||||
*
|
||||
* On the date above, in accordance with the Business Source License, use
|
||||
* of this software will be governed by version 2 or later of the General
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
* Use of this software is governed by the Business Source License included
|
||||
* in the LICENSE.TXT file and at www.mariadb.com/bsl.
|
||||
*
|
||||
* Change Date: 2019-01-01
|
||||
* Change Date: 2019-07-01
|
||||
*
|
||||
* On the date above, in accordance with the Business Source License, use
|
||||
* of this software will be governed by version 2 or later of the General
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
* Use of this software is governed by the Business Source License included
|
||||
* in the LICENSE.TXT file and at www.mariadb.com/bsl.
|
||||
*
|
||||
* Change Date: 2019-01-01
|
||||
* Change Date: 2019-07-01
|
||||
*
|
||||
* On the date above, in accordance with the Business Source License, use
|
||||
* of this software will be governed by version 2 or later of the General
|
||||
@ -29,8 +29,10 @@
|
||||
|
||||
#include <gw_protocol.h>
|
||||
#include <gw_ssl.h>
|
||||
#include <hashtable.h>
|
||||
|
||||
struct dcb;
|
||||
struct service;
|
||||
|
||||
/**
|
||||
* The servlistener structure is used to link a service to the protocols that
|
||||
@ -40,17 +42,24 @@ struct dcb;
|
||||
*/
|
||||
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 */
|
||||
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 */
|
||||
HASHTABLE *resources; /**< hastable for listener resources, i.e. database names */
|
||||
struct service* service; /**< The service which used by this listener */
|
||||
SPINLOCK lock;
|
||||
struct servlistener *next; /**< Next service protocol */
|
||||
} SERV_LISTENER;
|
||||
|
||||
SERV_LISTENER *listener_alloc(char *protocol, char *address, unsigned short port, char *authenticator,
|
||||
SERV_LISTENER *listener_alloc(struct service* service, char *name, char *protocol,
|
||||
char *address, unsigned short port, char *authenticator,
|
||||
SSL_LISTENER *ssl);
|
||||
void listener_free(SERV_LISTENER* listener);
|
||||
int listener_set_ssl_version(SSL_LISTENER *ssl_listener, char* version);
|
||||
void listener_set_certificates(SSL_LISTENER *ssl_listener, char* cert, char* key, char* ca_cert);
|
||||
int listener_init_SSL(SSL_LISTENER *ssl_listener);
|
||||
|
||||
119
server/include/listmanager.h
Normal file
119
server/include/listmanager.h
Normal file
@ -0,0 +1,119 @@
|
||||
#ifndef _LISTMANAGER_H
|
||||
#define _LISTMANAGER_H
|
||||
/*
|
||||
* Copyright (c) 2016 MariaDB Corporation Ab
|
||||
*
|
||||
* Use of this software is governed by the Business Source License included
|
||||
* in the LICENSE.TXT file and at www.mariadb.com/bsl.
|
||||
*
|
||||
* Change Date: 2019-07-01
|
||||
*
|
||||
* On the date above, in accordance with the Business Source License, use
|
||||
* of this software will be governed by version 2 or later of the General
|
||||
* Public License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file listmanager.h The List Manager header file
|
||||
*
|
||||
*
|
||||
* @verbatim
|
||||
* Revision History
|
||||
*
|
||||
* Date Who Description
|
||||
* 20/04/2016 Martin Brampton Initial implementation
|
||||
*
|
||||
* @endverbatim
|
||||
*/
|
||||
|
||||
#include <spinlock.h>
|
||||
#include <skygw_debug.h>
|
||||
|
||||
struct dcb;
|
||||
|
||||
/*
|
||||
* The possible types of list that could be supported. At present, only
|
||||
* LIST_TYPE_RECYCLABLE is fully tested.
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
LIST_TYPE_SIMPLE, /* A simple linked list with pointer to last entry */
|
||||
LIST_TYPE_RECYCLABLE, /* A simple linked list, entries are recycled */
|
||||
LIST_TYPE_DOUBLE, /* A doubly linked list, next and previous */
|
||||
} list_type_t;
|
||||
|
||||
/*
|
||||
* The list entry structure
|
||||
*
|
||||
* Each list entry must have this format, but will typically be extended
|
||||
* well beyond these items. The "previous" field is only required for
|
||||
* a doubly linked list, LIST_TYPE_DOUBLE.
|
||||
*
|
||||
* The first data to be used with the list manager is the DCB. Note that
|
||||
* the first few fields in the DCB structure correspond exactly to the
|
||||
* fields in the list entry structure. The pointers used need to be cast
|
||||
* as appropriate in order to be able to use the same data as either a DCB
|
||||
* or a list entry.
|
||||
*
|
||||
*/
|
||||
#define LIST_ENTRY_FIELDS \
|
||||
skygw_chk_t list_entry_chk_top; \
|
||||
struct list_entry *next; \
|
||||
struct list_entry *previous; \
|
||||
bool entry_is_in_use; \
|
||||
bool entry_is_ready; \
|
||||
skygw_chk_t list_entry_chk_tail;
|
||||
|
||||
typedef struct list_entry
|
||||
{
|
||||
LIST_ENTRY_FIELDS
|
||||
} list_entry_t;
|
||||
|
||||
/*
|
||||
* The list configuration structure
|
||||
*
|
||||
* This provides the basis for a list. It can be declared and initialised
|
||||
* statically, for example in server/core/dcb.c. It includes an anchor
|
||||
* pointer for the list, a pointer to the last entry in the list and the
|
||||
* last entry that was found to be free and reused.
|
||||
*
|
||||
* The count tells us the current number of entries in live use, and maximum
|
||||
* is the highest number ever observed in live use. The freecount is the
|
||||
* number of entries currently free and ready for reuse. The entry_size is
|
||||
* the actual size of the real entries, e.g. the DCB structure (NOT the size
|
||||
* of the list entry structure).
|
||||
*
|
||||
* A spinlock is declared for use during list manipulation operations.
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
list_type_t list_type;
|
||||
size_t entry_size;
|
||||
SPINLOCK list_lock;
|
||||
list_entry_t *all_entries;
|
||||
list_entry_t *last_entry;
|
||||
list_entry_t *last_free;
|
||||
int count;
|
||||
int maximum;
|
||||
int freecount;
|
||||
int num_malloc;
|
||||
} LIST_CONFIG;
|
||||
|
||||
void list_initialise(LIST_CONFIG *list_config, list_type_t type_of_list, size_t entry_size);
|
||||
bool list_pre_alloc(LIST_CONFIG *list_config, int num_entries, void (*init_struct)(void *));
|
||||
list_entry_t *list_find_free(LIST_CONFIG *list_config, void (*init_struct)(void *));
|
||||
void dprintListStats(struct dcb *pdcb, LIST_CONFIG *list_config, const char *listname);
|
||||
void list_free_entry (LIST_CONFIG *list_config, list_entry_t *to_be_freed);
|
||||
list_entry_t *list_start_iteration(LIST_CONFIG *list_config);
|
||||
list_entry_t *list_iterate(LIST_CONFIG *list_config, list_entry_t *current_entry);
|
||||
void list_terminate_iteration_early(LIST_CONFIG *list_config, list_entry_t *current_entry);
|
||||
bool list_is_entry_in_use(LIST_CONFIG *list_config, list_entry_t *to_be_found);
|
||||
void list_add_to_end(LIST_CONFIG *list_config, list_entry_t *new_entry);
|
||||
void list_map(LIST_CONFIG *list_config, bool (*callback)(void *, ...));
|
||||
|
||||
/* The following UNTESTED! */
|
||||
list_entry_t *list_remove_first(LIST_CONFIG *list_config);
|
||||
list_entry_t *list_remove_last(LIST_CONFIG *list_config);
|
||||
|
||||
|
||||
#endif /* LISTMANAGER_H */
|
||||
@ -4,7 +4,7 @@
|
||||
* Use of this software is governed by the Business Source License included
|
||||
* in the LICENSE.TXT file and at www.mariadb.com/bsl.
|
||||
*
|
||||
* Change Date: 2019-01-01
|
||||
* Change Date: 2019-07-01
|
||||
*
|
||||
* On the date above, in accordance with the Business Source License, use
|
||||
* of this software will be governed by version 2 or later of the General
|
||||
@ -28,6 +28,32 @@ extern "C" {
|
||||
#define STRERROR_BUFLEN 512
|
||||
#endif
|
||||
|
||||
/**
|
||||
* If MXS_MODULE_NAME is defined before log_manager.h is included, then all
|
||||
* logged messages will be prefixed with that string enclosed in square brackets.
|
||||
* For instance, the following
|
||||
*
|
||||
* #define MXS_MODULE_NAME "xyz"
|
||||
* #include <log_manager.h>
|
||||
*
|
||||
* will lead to every logged message looking like:
|
||||
*
|
||||
* 2016-08-12 13:49:11 error : [xyz] The gadget was not ready
|
||||
*
|
||||
* In general, the value of MXS_MODULE_NAME should be the name of the shared
|
||||
* library to which the source file, where MXS_MODULE_NAME is defined, belongs.
|
||||
*
|
||||
* Note that a file that is compiled into multiple modules should
|
||||
* have MXS_MODULE_NAME defined as something else than the name of a real
|
||||
* module, or not at all.
|
||||
*
|
||||
* Any file that is compiled into maxscale-common should *not* have
|
||||
* MXS_MODULE_NAME defined.
|
||||
*/
|
||||
#if !defined(MXS_MODULE_NAME)
|
||||
#define MXS_MODULE_NAME NULL
|
||||
#endif
|
||||
|
||||
enum mxs_log_priorities
|
||||
{
|
||||
MXS_LOG_EMERG = (1 << LOG_EMERG),
|
||||
@ -82,6 +108,13 @@ typedef enum
|
||||
MXS_LOG_AUGMENTATION_MASK = (MXS_LOG_AUGMENT_WITH_FUNCTION)
|
||||
} mxs_log_augmentation_t;
|
||||
|
||||
typedef struct mxs_log_throttling
|
||||
{
|
||||
size_t count; // Maximum number of a specific message...
|
||||
size_t window_ms; // ...during this many milliseconds.
|
||||
size_t suppress_ms; // If exceeded, suppress such messages for this many ms.
|
||||
} MXS_LOG_THROTTLING;
|
||||
|
||||
bool mxs_log_init(const char* ident, const char* logdir, mxs_log_target_t target);
|
||||
void mxs_log_finish(void);
|
||||
|
||||
@ -94,10 +127,14 @@ void mxs_log_set_syslog_enabled(bool enabled);
|
||||
void mxs_log_set_maxlog_enabled(bool enabled);
|
||||
void mxs_log_set_highprecision_enabled(bool enabled);
|
||||
void mxs_log_set_augmentation(int bits);
|
||||
void mxs_log_set_throttling(const MXS_LOG_THROTTLING* throttling);
|
||||
|
||||
void mxs_log_get_throttling(MXS_LOG_THROTTLING* throttling);
|
||||
|
||||
int mxs_log_message(int priority,
|
||||
const char* modname,
|
||||
const char* file, int line, const char* function,
|
||||
const char* format, ...) __attribute__((format(printf, 5, 6)));
|
||||
const char* format, ...) __attribute__((format(printf, 6, 7)));
|
||||
/**
|
||||
* Log an error, warning, notice, info, or debug message.
|
||||
*
|
||||
@ -109,7 +146,7 @@ int mxs_log_message(int priority,
|
||||
* MXS_ERROR, MXS_WARNING, etc. macros instead.
|
||||
*/
|
||||
#define MXS_LOG_MESSAGE(priority, format, ...)\
|
||||
mxs_log_message(priority, __FILE__, __LINE__, __func__, format, ##__VA_ARGS__)
|
||||
mxs_log_message(priority, MXS_MODULE_NAME, __FILE__, __LINE__, __func__, format, ##__VA_ARGS__)
|
||||
|
||||
/**
|
||||
* Log an error, warning, notice, info, or debug message.
|
||||
@ -123,6 +160,45 @@ int mxs_log_message(int priority,
|
||||
#define MXS_INFO(format, ...) MXS_LOG_MESSAGE(LOG_INFO, format, ##__VA_ARGS__)
|
||||
#define MXS_DEBUG(format, ...) MXS_LOG_MESSAGE(LOG_DEBUG, format, ##__VA_ARGS__)
|
||||
|
||||
/**
|
||||
* Log an out of memory error using custom message.
|
||||
*
|
||||
* @param message Text to be logged.
|
||||
*/
|
||||
// TODO: In an OOM situation, the default logging will (most likely) *not* work,
|
||||
// TODO: as memory is allocated as part of the process. A custom route, that does
|
||||
// TODO: not allocate memory, must be created for OOM messages.
|
||||
// TODO: So, currently these are primarily placeholders.
|
||||
#define MXS_OOM_MESSAGE(message) MXS_ERROR("OOM: %s", message);
|
||||
|
||||
/**
|
||||
* Log an out of memory error using custom message, if the
|
||||
* provided pointer is NULL.
|
||||
*
|
||||
* @param p If NULL, an OOM message will be logged.
|
||||
* @param message Text to be logged.
|
||||
*/
|
||||
#define MXS_OOM_MESSAGE_IFNULL(p, m) do { if (!p) { MXS_OOM_MESSAGE(m); } } while (false)
|
||||
|
||||
/**
|
||||
* Log an out of memory error using a default message.
|
||||
*/
|
||||
#define MXS_OOM() MXS_OOM_MESSAGE(__func__)
|
||||
|
||||
/**
|
||||
* Log an out of memory error using a default message, if the
|
||||
* provided pointer is NULL.
|
||||
*
|
||||
* @param p If NULL, an OOM message will be logged.
|
||||
*/
|
||||
#define MXS_OOM_IFNULL(p) do { if (!p) { MXS_OOM(); } } while (false)
|
||||
|
||||
enum
|
||||
{
|
||||
MXS_OOM_MESSAGE_MAXLEN = 80 /** Maximum length of an OOM message, including the
|
||||
trailing NULL. If longer, it will be cut. */
|
||||
};
|
||||
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -6,13 +6,14 @@
|
||||
* Use of this software is governed by the Business Source License included
|
||||
* in the LICENSE.TXT file and at www.mariadb.com/bsl.
|
||||
*
|
||||
* Change Date: 2019-01-01
|
||||
* Change Date: 2019-07-01
|
||||
*
|
||||
* On the date above, in accordance with the Business Source License, use
|
||||
* of this software will be governed by version 2 or later of the General
|
||||
* Public License.
|
||||
*/
|
||||
#include <skygw_utils.h>
|
||||
#include <sys/utsname.h>
|
||||
#include <stdint.h>
|
||||
#include <openssl/sha.h>
|
||||
#include <spinlock.h>
|
||||
@ -34,7 +35,6 @@
|
||||
|
||||
#define DEFAULT_NBPOLLS 3 /**< Default number of non block polls before we block */
|
||||
#define DEFAULT_POLLSLEEP 1000 /**< Default poll wait time (milliseconds) */
|
||||
#define _SYSNAME_STR_LENGTH 256 /**< sysname len */
|
||||
#define _RELEASE_STR_LENGTH 256 /**< release len */
|
||||
#define DEFAULT_NTHREADS 1 /**< Default number of polling threads */
|
||||
/**
|
||||
@ -109,8 +109,8 @@ typedef struct
|
||||
{
|
||||
int n_threads; /**< Number of polling threads */
|
||||
char *version_string; /**< The version string of embedded db library */
|
||||
char release_string[_SYSNAME_STR_LENGTH]; /**< The release name string of the system */
|
||||
char sysname[_SYSNAME_STR_LENGTH]; /**< The release name string of the system */
|
||||
char release_string[_RELEASE_STR_LENGTH]; /**< The release name string of the system */
|
||||
char sysname[_UTSNAME_SYSNAME_LENGTH]; /**< The OS name of the system */
|
||||
uint8_t mac_sha1[SHA_DIGEST_LENGTH]; /**< The SHA1 digest of an interface MAC address */
|
||||
unsigned long id; /**< MaxScale ID */
|
||||
unsigned int n_nbpoll; /**< Tune number of non-blocking polls */
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
* Use of this software is governed by the Business Source License included
|
||||
* in the LICENSE.TXT file and at www.mariadb.com/bsl.
|
||||
*
|
||||
* Change Date: 2019-01-01
|
||||
* Change Date: 2019-07-01
|
||||
*
|
||||
* On the date above, in accordance with the Business Source License, use
|
||||
* of this software will be governed by version 2 or later of the General
|
||||
|
||||
5
server/include/maxscale/CMakeLists.txt
Normal file
5
server/include/maxscale/CMakeLists.txt
Normal file
@ -0,0 +1,5 @@
|
||||
file(GLOB HEADERS "*.h")
|
||||
foreach(var ${HEADERS})
|
||||
get_filename_component(header ${var} NAME)
|
||||
install_header(${header} devel)
|
||||
endforeach()
|
||||
74
server/include/maxscale/alloc.h
Normal file
74
server/include/maxscale/alloc.h
Normal file
@ -0,0 +1,74 @@
|
||||
#ifndef _MAXSCALE_ALLOC_H
|
||||
#define _MAXSCALE_ALLOC_H
|
||||
/*
|
||||
* Copyright (c) 2016 MariaDB Corporation Ab
|
||||
*
|
||||
* Use of this software is governed by the Business Source License included
|
||||
* in the LICENSE.TXT file and at www.mariadb.com/bsl.
|
||||
*
|
||||
* Change Date: 2019-07-01
|
||||
*
|
||||
* On the date above, in accordance with the Business Source License, use
|
||||
* of this software will be governed by version 2 or later of the General
|
||||
* Public License.
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <skygw_debug.h>
|
||||
|
||||
EXTERN_C_BLOCK_BEGIN
|
||||
|
||||
/*
|
||||
* NOTE: Do not use these functions directly, use the macros below.
|
||||
*/
|
||||
|
||||
// "caller" arg temporarily disabled so that existing code
|
||||
// using the previous version of mxs_alloc etc. will continue
|
||||
// to compile.
|
||||
void *mxs_malloc(size_t size/*, const char *caller*/);
|
||||
void *mxs_calloc(size_t nmemb, size_t size/*, const char *caller*/);
|
||||
void *mxs_realloc(void *ptr, size_t size/*, const char *caller*/);
|
||||
void mxs_free(void *ptr/*, const char *caller*/);
|
||||
|
||||
char *mxs_strdup(const char *s/*, const char *caller*/);
|
||||
char *mxs_strndup(const char *s, size_t n/*, const char *caller*/);
|
||||
|
||||
char *mxs_strdup_a(const char *s/*, const char *caller*/);
|
||||
char *mxs_strndup_a(const char *s, size_t n/*, const char *caller*/);
|
||||
|
||||
|
||||
/*
|
||||
* NOTE: USE these macros instead of the functions above.
|
||||
*/
|
||||
#define MXS_MALLOC(size) mxs_malloc(size/*, __func__*/)
|
||||
#define MXS_CALLOC(nmemb, size) mxs_calloc(nmemb, size/*, __func__*/)
|
||||
#define MXS_REALLOC(ptr, size) mxs_realloc(ptr, size/*, __func__*/)
|
||||
#define MXS_FREE(ptr) mxs_free(ptr/*, __func__*/)
|
||||
|
||||
#define MXS_STRDUP(s) mxs_strdup(s/*, __func__*/)
|
||||
#define MXS_STRNDUP(s, n) mxs_strndup(s, n/*, __func__*/)
|
||||
|
||||
#define MXS_STRDUP_A(s) mxs_strdup_a(s/*, __func__*/)
|
||||
#define MXS_STRNDUP_A(s, n) mxs_strndup_a(s, n/*, __func__*/)
|
||||
|
||||
|
||||
/**
|
||||
* @brief Abort the process if the pointer is NULL.
|
||||
*
|
||||
* To be used in circumstances where a memory allocation failure
|
||||
* cannot - currently - be dealt with properly.
|
||||
*/
|
||||
#define MXS_ABORT_IF_NULL(p) do { if (!p) { abort(); } } while (false)
|
||||
|
||||
/**
|
||||
* @brief Abort the process if the provided value is non-zero.
|
||||
*
|
||||
* To be used in circumstances where a memory allocation failure
|
||||
* cannot - currently - be dealt with properly.
|
||||
*/
|
||||
#define MXS_ABORT_IF_TRUE(b) do { if (b) { abort(); } } while (false)
|
||||
|
||||
EXTERN_C_BLOCK_END
|
||||
|
||||
#endif
|
||||
@ -6,7 +6,7 @@
|
||||
* Use of this software is governed by the Business Source License included
|
||||
* in the LICENSE.TXT file and at www.mariadb.com/bsl.
|
||||
*
|
||||
* Change Date: 2019-01-01
|
||||
* Change Date: 2019-07-01
|
||||
*
|
||||
* On the date above, in accordance with the Business Source License, use
|
||||
* of this software will be governed by version 2 or later of the General
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
* Use of this software is governed by the Business Source License included
|
||||
* in the LICENSE.TXT file and at www.mariadb.com/bsl.
|
||||
*
|
||||
* Change Date: 2019-01-01
|
||||
* Change Date: 2019-07-01
|
||||
*
|
||||
* On the date above, in accordance with the Business Source License, use
|
||||
* of this software will be governed by version 2 or later of the General
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
* Use of this software is governed by the Business Source License included
|
||||
* in the LICENSE.TXT file and at www.mariadb.com/bsl.
|
||||
*
|
||||
* Change Date: 2019-01-01
|
||||
* Change Date: 2019-07-01
|
||||
*
|
||||
* On the date above, in accordance with the Business Source License, use
|
||||
* of this software will be governed by version 2 or later of the General
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
* Use of this software is governed by the Business Source License included
|
||||
* in the LICENSE.TXT file and at www.mariadb.com/bsl.
|
||||
*
|
||||
* Change Date: 2019-01-01
|
||||
* Change Date: 2019-07-01
|
||||
*
|
||||
* On the date above, in accordance with the Business Source License, use
|
||||
* of this software will be governed by version 2 or later of the General
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
* Use of this software is governed by the Business Source License included
|
||||
* in the LICENSE.TXT file and at www.mariadb.com/bsl.
|
||||
*
|
||||
* Change Date: 2019-01-01
|
||||
* Change Date: 2019-07-01
|
||||
*
|
||||
* On the date above, in accordance with the Business Source License, use
|
||||
* of this software will be governed by version 2 or later of the General
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
* Use of this software is governed by the Business Source License included
|
||||
* in the LICENSE.TXT file and at www.mariadb.com/bsl.
|
||||
*
|
||||
* Change Date: 2019-01-01
|
||||
* Change Date: 2019-07-01
|
||||
*
|
||||
* On the date above, in accordance with the Business Source License, use
|
||||
* of this software will be governed by version 2 or later of the General
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
* Use of this software is governed by the Business Source License included
|
||||
* in the LICENSE.TXT file and at www.mariadb.com/bsl.
|
||||
*
|
||||
* Change Date: 2019-01-01
|
||||
* Change Date: 2019-07-01
|
||||
*
|
||||
* On the date above, in accordance with the Business Source License, use
|
||||
* of this software will be governed by version 2 or later of the General
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
* Use of this software is governed by the Business Source License included
|
||||
* in the LICENSE.TXT file and at www.mariadb.com/bsl.
|
||||
*
|
||||
* Change Date: 2019-01-01
|
||||
* Change Date: 2019-07-01
|
||||
*
|
||||
* On the date above, in accordance with the Business Source License, use
|
||||
* of this software will be governed by version 2 or later of the General
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
* Use of this software is governed by the Business Source License included
|
||||
* in the LICENSE.TXT file and at www.mariadb.com/bsl.
|
||||
*
|
||||
* Change Date: 2019-01-01
|
||||
* Change Date: 2019-07-01
|
||||
*
|
||||
* On the date above, in accordance with the Business Source License, use
|
||||
* of this software will be governed by version 2 or later of the General
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
* Use of this software is governed by the Business Source License included
|
||||
* in the LICENSE.TXT file and at www.mariadb.com/bsl.
|
||||
*
|
||||
* Change Date: 2019-01-01
|
||||
* Change Date: 2019-07-01
|
||||
*
|
||||
* On the date above, in accordance with the Business Source License, use
|
||||
* of this software will be governed by version 2 or later of the General
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
* Use of this software is governed by the Business Source License included
|
||||
* in the LICENSE.TXT file and at www.mariadb.com/bsl.
|
||||
*
|
||||
* Change Date: 2019-01-01
|
||||
* Change Date: 2019-07-01
|
||||
*
|
||||
* On the date above, in accordance with the Business Source License, use
|
||||
* of this software will be governed by version 2 or later of the General
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
* Use of this software is governed by the Business Source License included
|
||||
* in the LICENSE.TXT file and at www.mariadb.com/bsl.
|
||||
*
|
||||
* Change Date: 2019-01-01
|
||||
* Change Date: 2019-07-01
|
||||
*
|
||||
* On the date above, in accordance with the Business Source License, use
|
||||
* of this software will be governed by version 2 or later of the General
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
* Use of this software is governed by the Business Source License included
|
||||
* in the LICENSE.TXT file and at www.mariadb.com/bsl.
|
||||
*
|
||||
* Change Date: 2019-01-01
|
||||
* Change Date: 2019-07-01
|
||||
*
|
||||
* On the date above, in accordance with the Business Source License, use
|
||||
* of this software will be governed by version 2 or later of the General
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
* Use of this software is governed by the Business Source License included
|
||||
* in the LICENSE.TXT file and at www.mariadb.com/bsl.
|
||||
*
|
||||
* Change Date: 2019-01-01
|
||||
* Change Date: 2019-07-01
|
||||
*
|
||||
* On the date above, in accordance with the Business Source License, use
|
||||
* of this software will be governed by version 2 or later of the General
|
||||
@ -26,8 +26,8 @@
|
||||
* @endverbatim
|
||||
*/
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <spinlock.h>
|
||||
#include <skygw_debug.h>
|
||||
|
||||
#define CONNECTION_QUEUE_LIMIT 1000
|
||||
|
||||
@ -35,29 +35,36 @@ typedef struct queue_entry
|
||||
{
|
||||
void *queued_object;
|
||||
long heartbeat;
|
||||
#if defined(SS_DEBUG)
|
||||
long sequence_check;
|
||||
#endif /* SS_DEBUG */
|
||||
} QUEUE_ENTRY;
|
||||
|
||||
typedef struct queue_config
|
||||
{
|
||||
int queue_size;
|
||||
int queue_limit;
|
||||
int start;
|
||||
int end;
|
||||
int timeout;
|
||||
bool has_entries;
|
||||
SPINLOCK queue_lock;
|
||||
QUEUE_ENTRY queue_array[CONNECTION_QUEUE_LIMIT];
|
||||
QUEUE_ENTRY *queue_array;
|
||||
#if defined(SS_DEBUG)
|
||||
long sequence_number;
|
||||
#endif /* SS_DEBUG */
|
||||
} QUEUE_CONFIG;
|
||||
|
||||
QUEUE_CONFIG *mxs_queue_alloc(int limit, int timeout);
|
||||
void mxs_queue_free(QUEUE_CONFIG *queue_config);
|
||||
bool mxs_enqueue(QUEUE_CONFIG *queue_config, void *new_entry);
|
||||
QUEUE_ENTRY *mxs_dequeue(QUEUE_CONFIG *queue_config);
|
||||
bool mxs_dequeue(QUEUE_CONFIG *queue_config, QUEUE_ENTRY *result);
|
||||
bool mxs_dequeue_if_expired(QUEUE_CONFIG *queue_config, QUEUE_ENTRY *result);
|
||||
|
||||
static inline int
|
||||
mxs_queue_count(QUEUE_CONFIG *queue_config)
|
||||
{
|
||||
int count = queue_config->end - queue_config->start;
|
||||
return count < 0 ? (count + queue_config->queue_size) : count;
|
||||
return count < 0 ? (count + queue_config->queue_limit + 1): count;
|
||||
}
|
||||
|
||||
#endif /* QUEUEMANAGER_H */
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
* Use of this software is governed by the Business Source License included
|
||||
* in the LICENSE.TXT file and at www.mariadb.com/bsl.
|
||||
*
|
||||
* Change Date: 2019-01-01
|
||||
* Change Date: 2019-07-01
|
||||
*
|
||||
* On the date above, in accordance with the Business Source License, use
|
||||
* of this software will be governed by version 2 or later of the General
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
* Use of this software is governed by the Business Source License included
|
||||
* in the LICENSE.TXT file and at www.mariadb.com/bsl.
|
||||
*
|
||||
* Change Date: 2019-01-01
|
||||
* Change Date: 2019-07-01
|
||||
*
|
||||
* On the date above, in accordance with the Business Source License, use
|
||||
* of this software will be governed by version 2 or later of the General
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
* Use of this software is governed by the Business Source License included
|
||||
* in the LICENSE.TXT file and at www.mariadb.com/bsl.
|
||||
*
|
||||
* Change Date: 2019-01-01
|
||||
* Change Date: 2019-07-01
|
||||
*
|
||||
* On the date above, in accordance with the Business Source License, use
|
||||
* of this software will be governed by version 2 or later of the General
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
* Use of this software is governed by the Business Source License included
|
||||
* in the LICENSE.TXT file and at www.mariadb.com/bsl.
|
||||
*
|
||||
* Change Date: 2019-01-01
|
||||
* Change Date: 2019-07-01
|
||||
*
|
||||
* On the date above, in accordance with the Business Source License, use
|
||||
* of this software will be governed by version 2 or later of the General
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
* Use of this software is governed by the Business Source License included
|
||||
* in the LICENSE.TXT file and at www.mariadb.com/bsl.
|
||||
*
|
||||
* Change Date: 2019-01-01
|
||||
* Change Date: 2019-07-01
|
||||
*
|
||||
* On the date above, in accordance with the Business Source License, use
|
||||
* of this software will be governed by version 2 or later of the General
|
||||
@ -47,7 +47,12 @@ typedef struct maxkeys
|
||||
unsigned char initvector[MAXSCALE_IV_LEN];
|
||||
} MAXKEYS;
|
||||
|
||||
extern int secrets_writeKeys(const char *filename);
|
||||
enum
|
||||
{
|
||||
MXS_PASSWORD_MAXLEN = 79
|
||||
};
|
||||
|
||||
extern int secrets_writeKeys(const char *directory);
|
||||
extern char *decryptPassword(const char *);
|
||||
extern char *encryptPassword(const char*, const char *);
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
* Use of this software is governed by the Business Source License included
|
||||
* in the LICENSE.TXT file and at www.mariadb.com/bsl.
|
||||
*
|
||||
* Change Date: 2019-01-01
|
||||
* Change Date: 2019-07-01
|
||||
*
|
||||
* On the date above, in accordance with the Business Source License, use
|
||||
* of this software will be governed by version 2 or later of the General
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
* Use of this software is governed by the Business Source License included
|
||||
* in the LICENSE.TXT file and at www.mariadb.com/bsl.
|
||||
*
|
||||
* Change Date: 2019-01-01
|
||||
* Change Date: 2019-07-01
|
||||
*
|
||||
* On the date above, in accordance with the Business Source License, use
|
||||
* of this software will be governed by version 2 or later of the General
|
||||
@ -134,10 +134,8 @@ typedef struct service
|
||||
SERVICE_USER credentials; /**< The cedentials of the service user */
|
||||
SPINLOCK spin; /**< The service spinlock */
|
||||
SERVICE_STATS stats; /**< The service statistics */
|
||||
struct users *users; /**< The user data for this service */
|
||||
int enable_root; /**< Allow root user access */
|
||||
int localhost_match_wildcard_host; /**< Match localhost against wildcard */
|
||||
HASHTABLE *resources; /**< hastable for service resources, i.e. database names */
|
||||
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. */
|
||||
@ -173,7 +171,9 @@ extern SERVICE *service_alloc(const char *, const char *);
|
||||
extern int service_free(SERVICE *);
|
||||
extern SERVICE *service_find(char *);
|
||||
extern int service_isvalid(SERVICE *);
|
||||
extern int serviceAddProtocol(SERVICE *, char *, char *, unsigned short, char *, SSL_LISTENER *);
|
||||
extern int serviceAddProtocol(SERVICE *service, char *name, char *protocol,
|
||||
char *address, unsigned short port,
|
||||
char *authenticator, SSL_LISTENER *ssl);
|
||||
extern int serviceHasProtocol(SERVICE *service, const char *protocol,
|
||||
const char* address, unsigned short port);
|
||||
extern void serviceAddBackend(SERVICE *, SERVER *);
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
* Use of this software is governed by the Business Source License included
|
||||
* in the LICENSE.TXT file and at www.mariadb.com/bsl.
|
||||
*
|
||||
* Change Date: 2019-01-01
|
||||
* Change Date: 2019-07-01
|
||||
*
|
||||
* On the date above, in accordance with the Business Source License, use
|
||||
* of this software will be governed by version 2 or later of the General
|
||||
@ -29,12 +29,14 @@
|
||||
* 29-05-2014 Mark Riddoch Support for filter mechanism
|
||||
* added
|
||||
* 20-02-2015 Markus Mäkelä Added session timeouts
|
||||
* 27/06/2016 Martin Brampton Modify session struct for list manager
|
||||
*
|
||||
* @endverbatim
|
||||
*/
|
||||
#include <time.h>
|
||||
#include <atomic.h>
|
||||
#include <buffer.h>
|
||||
#include <listmanager.h>
|
||||
#include <spinlock.h>
|
||||
#include <resultset.h>
|
||||
#include <skygw_utils.h>
|
||||
@ -52,6 +54,8 @@ typedef struct
|
||||
time_t connect; /**< Time when the session was started */
|
||||
} SESSION_STATS;
|
||||
|
||||
#define SESSION_STATS_INIT {0}
|
||||
|
||||
typedef enum
|
||||
{
|
||||
SESSION_STATE_ALLOC, /*< for all sessions */
|
||||
@ -76,6 +80,8 @@ typedef struct
|
||||
int (*routeQuery)(void *instance, void *session, GWBUF *request);
|
||||
} DOWNSTREAM;
|
||||
|
||||
#define DOWNSTREAM_INIT {0}
|
||||
|
||||
/**
|
||||
* The upstream element in the filter chain. This may refer to
|
||||
* another filter or to the protocol implementation.
|
||||
@ -88,6 +94,8 @@ typedef struct
|
||||
int (*error)(void *instance, void *session, void *);
|
||||
} UPSTREAM;
|
||||
|
||||
#define UPSTREAM_INIT {0}
|
||||
|
||||
/**
|
||||
* Structure used to track the filter instances and sessions of the filters
|
||||
* that are in use within a session.
|
||||
@ -99,6 +107,8 @@ typedef struct
|
||||
void *session;
|
||||
} SESSION_FILTER;
|
||||
|
||||
#define SESSION_FILTER_INIT {0}
|
||||
|
||||
/**
|
||||
* Filter type for the sessionGetList call
|
||||
*/
|
||||
@ -114,13 +124,14 @@ typedef enum
|
||||
* A session status block is created for each user (client) connection
|
||||
* to the database, it links the descriptors, routing implementation
|
||||
* and originating service together for the client session.
|
||||
*
|
||||
* Note that the first few fields (up to and including "entry_is_ready") must
|
||||
* precisely match the LIST_ENTRY structure defined in the list manager.
|
||||
*/
|
||||
typedef struct session
|
||||
{
|
||||
#if defined(SS_DEBUG)
|
||||
LIST_ENTRY_FIELDS
|
||||
skygw_chk_t ses_chk_top;
|
||||
#endif
|
||||
bool ses_is_in_use; /**< Whether session is in use or for later reuse */
|
||||
SPINLOCK ses_lock;
|
||||
session_state_t state; /*< Current descriptor state */
|
||||
size_t ses_id; /*< Unique session identifier */
|
||||
@ -133,14 +144,15 @@ typedef struct session
|
||||
SESSION_FILTER *filters; /*< The filters in use within this session */
|
||||
DOWNSTREAM head; /*< Head of the filter chain */
|
||||
UPSTREAM tail; /*< The tail of the filter chain */
|
||||
struct session *next; /*< Linked list of all sessions */
|
||||
int refcount; /*< Reference count on the session */
|
||||
bool ses_is_child; /*< this is a child session */
|
||||
#if defined(SS_DEBUG)
|
||||
skygw_chk_t ses_chk_tail;
|
||||
#endif
|
||||
} SESSION;
|
||||
|
||||
#define SESSION_INIT {.ses_chk_top = CHK_NUM_SESSION, .ses_lock = SPINLOCK_INIT, \
|
||||
.stats = SESSION_STATS_INIT, .head = DOWNSTREAM_INIT, .tail = UPSTREAM_INIT, \
|
||||
.state = SESSION_STATE_ALLOC, .ses_chk_tail = CHK_NUM_SESSION}
|
||||
|
||||
/** Whether to do session timeout checks */
|
||||
extern bool check_timeouts;
|
||||
|
||||
@ -167,8 +179,8 @@ extern long next_timeout_check;
|
||||
((sess)->tail.clientReply)((sess)->tail.instance, \
|
||||
(sess)->tail.session, (buf))
|
||||
|
||||
SESSION *get_all_sessions();
|
||||
SESSION *session_alloc(struct service *, struct dcb *);
|
||||
bool session_pre_alloc(int number);
|
||||
SESSION *session_set_dummy(struct dcb *);
|
||||
bool session_free(SESSION *);
|
||||
int session_isvalid(SESSION *);
|
||||
@ -177,6 +189,7 @@ char *session_get_remote(SESSION *);
|
||||
char *session_getUser(SESSION *);
|
||||
void printAllSessions();
|
||||
void printSession(SESSION *);
|
||||
void dprintSessionList(DCB *pdcb);
|
||||
void dprintAllSessions(struct dcb *);
|
||||
void dprintSession(struct dcb *, SESSION *);
|
||||
void dListSessions(struct dcb *);
|
||||
|
||||
589
server/include/skygw_debug.h
Normal file
589
server/include/skygw_debug.h
Normal file
@ -0,0 +1,589 @@
|
||||
/*
|
||||
* Copyright (c) 2016 MariaDB Corporation Ab
|
||||
*
|
||||
* Use of this software is governed by the Business Source License included
|
||||
* in the LICENSE.TXT file and at www.mariadb.com/bsl.
|
||||
*
|
||||
* Change Date: 2019-07-01
|
||||
*
|
||||
* On the date above, in accordance with the Business Source License, use
|
||||
* of this software will be governed by version 2 or later of the General
|
||||
* Public License.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <assert.h>
|
||||
#include <limits.h>
|
||||
|
||||
#define __USE_UNIX98 1
|
||||
#include <pthread.h>
|
||||
#include <unistd.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
#if !defined(SKYGW_DEBUG_H)
|
||||
#define SKYGW_DEBUG_H
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
#define EXTERN_C_BLOCK_BEGIN extern "C" {
|
||||
#define EXTERN_C_BLOCK_END }
|
||||
#define EXTERN_C_FUNC extern "C"
|
||||
#else
|
||||
#define EXTERN_C_BLOCK_BEGIN
|
||||
#define EXTERN_C_BLOCK_END
|
||||
#define EXTERN_C_FUNC
|
||||
#endif
|
||||
|
||||
#if defined(SS_DEBUG)
|
||||
# define SS_PROF
|
||||
#endif
|
||||
|
||||
#if defined(SS_DEBUG) || defined(SS_PROF)
|
||||
# define ss_prof(exp) exp
|
||||
#else
|
||||
# define ss_prof(exp)
|
||||
#endif /* SS_DEBUG || SS_PROF */
|
||||
|
||||
#if defined(SS_DEBUG) && defined(LOG_ASSERT)
|
||||
#include <log_manager.h>
|
||||
# define ss_dassert(exp) do { if(!(exp)){\
|
||||
MXS_ERROR("debug assert %s:%d\n", (char*)__FILE__, __LINE__);\
|
||||
mxs_log_flush_sync(); assert(exp);} } while (false)
|
||||
#define ss_info_dassert(exp,info) do { if(!(exp)){\
|
||||
MXS_ERROR("debug assert %s:%d %s\n", (char*)__FILE__, __LINE__, info);\
|
||||
mxs_log_flush_sync();assert(exp);} } while (false)
|
||||
# define ss_debug(exp) exp
|
||||
# define ss_dfprintf fprintf
|
||||
# define ss_dfflush fflush
|
||||
# define ss_dfwrite fwrite
|
||||
#elif defined(SS_DEBUG)
|
||||
|
||||
# define ss_debug(exp) exp
|
||||
# define ss_dfprintf fprintf
|
||||
# define ss_dfflush fflush
|
||||
# define ss_dfwrite fwrite
|
||||
|
||||
# define ss_dassert(exp) \
|
||||
{ \
|
||||
if (!(exp)) { \
|
||||
ss_dfprintf(stderr, \
|
||||
"debug assert %s:%d\n", \
|
||||
(char*)__FILE__, \
|
||||
__LINE__); \
|
||||
ss_dfflush(stderr); \
|
||||
assert(exp); \
|
||||
} \
|
||||
}
|
||||
|
||||
|
||||
# define ss_info_dassert(exp, info) \
|
||||
{ \
|
||||
if (!(exp)) { \
|
||||
ss_dfprintf(stderr, "debug assert %s:%d, %s\n", \
|
||||
(char *)__FILE__, \
|
||||
__LINE__, \
|
||||
info); \
|
||||
ss_dfflush(stderr); \
|
||||
assert((exp)); \
|
||||
} \
|
||||
}
|
||||
|
||||
#else /* SS_DEBUG */
|
||||
|
||||
# define ss_debug(exp)
|
||||
# define ss_dfprintf(a, b, ...)
|
||||
# define ss_dfflush(s)
|
||||
# define ss_dfwrite(a, b, c, d)
|
||||
# define ss_dassert(exp)
|
||||
# define ss_info_dassert(exp, info)
|
||||
|
||||
#endif /* SS_DEBUG */
|
||||
|
||||
#define CHK_NUM_BASE 101
|
||||
|
||||
typedef enum skygw_chk_t
|
||||
{
|
||||
CHK_NUM_SLIST = CHK_NUM_BASE,
|
||||
CHK_NUM_SLIST_NODE,
|
||||
CHK_NUM_SLIST_CURSOR,
|
||||
CHK_NUM_MLIST,
|
||||
CHK_NUM_MLIST_NODE,
|
||||
CHK_NUM_MLIST_CURSOR,
|
||||
CHK_NUM_QUERY_TEST,
|
||||
CHK_NUM_LOGFILE,
|
||||
CHK_NUM_FILEWRITER,
|
||||
CHK_NUM_THREAD,
|
||||
CHK_NUM_SIMPLE_MUTEX,
|
||||
CHK_NUM_MESSAGE,
|
||||
CHK_NUM_RWLOCK,
|
||||
CHK_NUM_FNAMES,
|
||||
CHK_NUM_LOGMANAGER,
|
||||
CHK_NUM_FILE,
|
||||
CHK_NUM_BLOCKBUF,
|
||||
CHK_NUM_HASHTABLE,
|
||||
CHK_NUM_DCB,
|
||||
CHK_NUM_PROTOCOL,
|
||||
CHK_NUM_SESSION,
|
||||
CHK_NUM_SERVER,
|
||||
CHK_NUM_ROUTER_SES,
|
||||
CHK_NUM_MY_SESCMD,
|
||||
CHK_NUM_ROUTER_PROPERTY,
|
||||
CHK_NUM_SESCMD_CUR,
|
||||
CHK_NUM_BACKEND,
|
||||
CHK_NUM_BACKEND_REF,
|
||||
CHK_NUM_PREP_STMT,
|
||||
CHK_NUM_PINFO,
|
||||
CHK_NUM_MYSQLSES,
|
||||
CHK_NUM_ADMINSES,
|
||||
CHK_NUM_MANAGED_LIST
|
||||
} skygw_chk_t;
|
||||
|
||||
# define STRBOOL(b) ((b) ? "true" : "false")
|
||||
|
||||
# define STRQTYPE(t) ((t) == QUERY_TYPE_WRITE ? "QUERY_TYPE_WRITE" : \
|
||||
((t) == QUERY_TYPE_READ ? "QUERY_TYPE_READ" : \
|
||||
((t) == QUERY_TYPE_SESSION_WRITE ? "QUERY_TYPE_SESSION_WRITE" : \
|
||||
((t) == QUERY_TYPE_UNKNOWN ? "QUERY_TYPE_UNKNOWN" : \
|
||||
((t) == QUERY_TYPE_LOCAL_READ ? "QUERY_TYPE_LOCAL_READ" : \
|
||||
((t) == QUERY_TYPE_MASTER_READ ? "QUERY_TYPE_MASTER_READ" : \
|
||||
((t) == QUERY_TYPE_USERVAR_READ ? "QUERY_TYPE_USERVAR_READ" : \
|
||||
((t) == QUERY_TYPE_SYSVAR_READ ? "QUERY_TYPE_SYSVAR_READ" : \
|
||||
((t) == QUERY_TYPE_GSYSVAR_READ ? "QUERY_TYPE_GSYSVAR_READ" : \
|
||||
((t) == QUERY_TYPE_GSYSVAR_WRITE ? "QUERY_TYPE_GSYSVAR_WRITE" : \
|
||||
((t) == QUERY_TYPE_BEGIN_TRX ? "QUERY_TYPE_BEGIN_TRX" : \
|
||||
((t) == QUERY_TYPE_ENABLE_AUTOCOMMIT ? "QUERY_TYPE_ENABLE_AUTOCOMMIT" : \
|
||||
((t) == QUERY_TYPE_DISABLE_AUTOCOMMIT ? "QUERY_TYPE_DISABLE_AUTOCOMMIT" : \
|
||||
((t) == QUERY_TYPE_ROLLBACK ? "QUERY_TYPE_ROLLBACK" : \
|
||||
((t) == QUERY_TYPE_COMMIT ? "QUERY_TYPE_COMMIT" : \
|
||||
((t) == QUERY_TYPE_PREPARE_NAMED_STMT ? "QUERY_TYPE_PREPARE_NAMED_STMT" : \
|
||||
((t) == QUERY_TYPE_PREPARE_STMT ? "QUERY_TYPE_PREPARE_STMT" : \
|
||||
((t) == QUERY_TYPE_EXEC_STMT ? "QUERY_TYPE_EXEC_STMT" : \
|
||||
((t) == QUERY_TYPE_CREATE_TMP_TABLE ? "QUERY_TYPE_CREATE_TMP_TABLE" : \
|
||||
((t) == QUERY_TYPE_READ_TMP_TABLE ? "QUERY_TYPE_READ_TMP_TABLE" : \
|
||||
((t) == QUERY_TYPE_SHOW_DATABASES ? "QUERY_TYPE_SHOW_DATABASES" : \
|
||||
((t) == QUERY_TYPE_SHOW_TABLES ? "QUERY_TYPE_SHOW_TABLES" : \
|
||||
"Unknown query type"))))))))))))))))))))))
|
||||
|
||||
#define STRLOGPRIORITYNAME(n)\
|
||||
((n) == LOG_EMERG ? "LOG_EMERG" : \
|
||||
((n) == LOG_ALERT ? "LOG_ALERT" : \
|
||||
((n) == LOG_CRIT ? "LOG_CRIT" : \
|
||||
((n) == LOG_ERR ? "LOG_ERR" : \
|
||||
((n) == LOG_WARNING ? "LOG_WARNING" : \
|
||||
((n) == LOG_NOTICE ? "LOG_NOTICE" : \
|
||||
((n) == LOG_INFO ? "LOG_INFO" : \
|
||||
((n) == LOG_DEBUG ? "LOG_DEBUG" : \
|
||||
"Unknown log priority"))))))))
|
||||
|
||||
#define STRPACKETTYPE(p) ((p) == MYSQL_COM_INIT_DB ? "COM_INIT_DB" : \
|
||||
((p) == MYSQL_COM_CREATE_DB ? "COM_CREATE_DB" : \
|
||||
((p) == MYSQL_COM_DROP_DB ? "COM_DROP_DB" : \
|
||||
((p) == MYSQL_COM_REFRESH ? "COM_REFRESH" : \
|
||||
((p) == MYSQL_COM_DEBUG ? "COM_DEBUG" : \
|
||||
((p) == MYSQL_COM_PING ? "COM_PING" : \
|
||||
((p) == MYSQL_COM_CHANGE_USER ? "COM_CHANGE_USER" : \
|
||||
((p) == MYSQL_COM_QUERY ? "COM_QUERY" : \
|
||||
((p) == MYSQL_COM_SHUTDOWN ? "COM_SHUTDOWN" : \
|
||||
((p) == MYSQL_COM_PROCESS_INFO ? "COM_PROCESS_INFO" : \
|
||||
((p) == MYSQL_COM_CONNECT ? "COM_CONNECT" : \
|
||||
((p) == MYSQL_COM_PROCESS_KILL ? "COM_PROCESS_KILL" : \
|
||||
((p) == MYSQL_COM_TIME ? "COM_TIME" : \
|
||||
((p) == MYSQL_COM_DELAYED_INSERT ? "COM_DELAYED_INSERT" : \
|
||||
((p) == MYSQL_COM_DAEMON ? "COM_DAEMON" : \
|
||||
((p) == MYSQL_COM_QUIT ? "COM_QUIT" : \
|
||||
((p) == MYSQL_COM_STMT_PREPARE ? "MYSQL_COM_STMT_PREPARE" : \
|
||||
((p) == MYSQL_COM_STMT_EXECUTE ? "MYSQL_COM_STMT_EXECUTE" : \
|
||||
"UNKNOWN MYSQL PACKET TYPE"))))))))))))))))))
|
||||
|
||||
#define STRDCBSTATE(s) ((s) == DCB_STATE_ALLOC ? "DCB_STATE_ALLOC" : \
|
||||
((s) == DCB_STATE_POLLING ? "DCB_STATE_POLLING" : \
|
||||
((s) == DCB_STATE_LISTENING ? "DCB_STATE_LISTENING" : \
|
||||
((s) == DCB_STATE_DISCONNECTED ? "DCB_STATE_DISCONNECTED" : \
|
||||
((s) == DCB_STATE_NOPOLLING ? "DCB_STATE_NOPOLLING" : \
|
||||
((s) == DCB_STATE_ZOMBIE ? "DCB_STATE_ZOMBIE" : \
|
||||
((s) == DCB_STATE_UNDEFINED ? "DCB_STATE_UNDEFINED" : "DCB_STATE_UNKNOWN")))))))
|
||||
|
||||
#define STRSESSIONSTATE(s) ((s) == SESSION_STATE_ALLOC ? "SESSION_STATE_ALLOC" : \
|
||||
((s) == SESSION_STATE_DUMMY ? "SESSION_STATE_DUMMY" : \
|
||||
((s) == SESSION_STATE_READY ? "SESSION_STATE_READY" : \
|
||||
((s) == SESSION_STATE_LISTENER ? "SESSION_STATE_LISTENER" : \
|
||||
((s) == SESSION_STATE_ROUTER_READY ? "SESSION_STATE_ROUTER_READY" : \
|
||||
((s) == SESSION_STATE_LISTENER_STOPPED ? "SESSION_STATE_LISTENER_STOPPED" : \
|
||||
(s) == SESSION_STATE_STOPPING ? "SESSION_STATE_STOPPING":\
|
||||
"SESSION_STATE_UNKNOWN"))))))
|
||||
|
||||
#define STRPROTOCOLSTATE(s) ((s) == MYSQL_ALLOC ? "MYSQL_ALLOC" : \
|
||||
((s) == MYSQL_PENDING_CONNECT ? "MYSQL_PENDING_CONNECT" : \
|
||||
((s) == MYSQL_CONNECTED ? "MYSQL_CONNECTED" : \
|
||||
((s) == MYSQL_AUTH_SENT ? "MYSQL_AUTH_SENT" : \
|
||||
((s) == MYSQL_AUTH_RECV ? "MYSQL_AUTH_RECV" : \
|
||||
((s) == MYSQL_AUTH_FAILED ? "MYSQL_AUTH_FAILED" : \
|
||||
((s) == MYSQL_IDLE ? "MYSQL_IDLE" : \
|
||||
"UNKNOWN MYSQL STATE")))))))
|
||||
|
||||
#define STRITEMTYPE(t) ((t) == Item::FIELD_ITEM ? "FIELD_ITEM" : \
|
||||
((t) == Item::FUNC_ITEM ? "FUNC_ITEM" : \
|
||||
((t) == Item::SUM_FUNC_ITEM ? "SUM_FUNC_ITEM" : \
|
||||
((t) == Item::STRING_ITEM ? "STRING_ITEM" : \
|
||||
((t) == Item::INT_ITEM ? "INT_ITEM" : \
|
||||
((t) == Item::REAL_ITEM ? "REAL_ITEM" : \
|
||||
((t) == Item::NULL_ITEM ? "NULL_ITEM" : \
|
||||
((t) == Item::VARBIN_ITEM ? "VARBIN_ITEM" : \
|
||||
((t) == Item::COPY_STR_ITEM ? "COPY_STR_ITEM" : \
|
||||
((t) == Item::FIELD_AVG_ITEM ? "FIELD_AVG_ITEM" : \
|
||||
((t) == Item::DEFAULT_VALUE_ITEM ? "DEFAULT_VALUE_ITEM" : \
|
||||
((t) == Item::PROC_ITEM ? "PROC_ITEM" : \
|
||||
((t) == Item::COND_ITEM ? "COND_ITEM" : \
|
||||
((t) == Item::REF_ITEM ? "REF_ITEM" : \
|
||||
(t) == Item::FIELD_STD_ITEM ? "FIELD_STD_ITEM" : \
|
||||
((t) == Item::FIELD_VARIANCE_ITEM ? "FIELD_VARIANCE_ITEM" : \
|
||||
((t) == Item::INSERT_VALUE_ITEM ? "INSERT_VALUE_ITEM": \
|
||||
((t) == Item::SUBSELECT_ITEM ? "SUBSELECT_ITEM" : \
|
||||
((t) == Item::ROW_ITEM ? "ROW_ITEM" : \
|
||||
((t) == Item::CACHE_ITEM ? "CACHE_ITEM" : \
|
||||
((t) == Item::TYPE_HOLDER ? "TYPE_HOLDER" : \
|
||||
((t) == Item::PARAM_ITEM ? "PARAM_ITEM" : \
|
||||
((t) == Item::TRIGGER_FIELD_ITEM ? "TRIGGER_FIELD_ITEM" : \
|
||||
((t) == Item::DECIMAL_ITEM ? "DECIMAL_ITEM" : \
|
||||
((t) == Item::XPATH_NODESET ? "XPATH_NODESET" : \
|
||||
((t) == Item::XPATH_NODESET_CMP ? "XPATH_NODESET_CMP" : \
|
||||
((t) == Item::VIEW_FIXER_ITEM ? "VIEW_FIXER_ITEM" : \
|
||||
((t) == Item::EXPR_CACHE_ITEM ? "EXPR_CACHE_ITEM" : \
|
||||
"Unknown item")))))))))))))))))))))))))))
|
||||
|
||||
#define STRDCBROLE(r) ((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" : \
|
||||
"UNKNOWN DCB ROLE")))
|
||||
|
||||
#define STRBETYPE(t) ((t) == BE_MASTER ? "BE_MASTER" : \
|
||||
((t) == BE_SLAVE ? "BE_SLAVE" : \
|
||||
((t) == BE_UNDEFINED ? "BE_UNDEFINED" : \
|
||||
"Unknown backend tpe")))
|
||||
|
||||
#define STRCRITERIA(c) ((c) == UNDEFINED_CRITERIA ? "UNDEFINED_CRITERIA" : \
|
||||
((c) == LEAST_GLOBAL_CONNECTIONS ? "LEAST_GLOBAL_CONNECTIONS" : \
|
||||
((c) == LEAST_ROUTER_CONNECTIONS ? "LEAST_ROUTER_CONNECTIONS" : \
|
||||
((c) == LEAST_BEHIND_MASTER ? "LEAST_BEHIND_MASTER" : \
|
||||
((c) == LEAST_CURRENT_OPERATIONS ? "LEAST_CURRENT_OPERATIONS" : "Unknown criteria")))))
|
||||
|
||||
#define STRSRVSTATUS(s) (SERVER_IS_MASTER(s) ? "RUNNING MASTER" : \
|
||||
(SERVER_IS_SLAVE(s) ? "RUNNING SLAVE" : \
|
||||
(SERVER_IS_JOINED(s) ? "RUNNING JOINED" : \
|
||||
(SERVER_IS_NDB(s) ? "RUNNING NDB" : \
|
||||
((SERVER_IS_RUNNING(s) && SERVER_IN_MAINT(s)) ? "RUNNING MAINTENANCE" : \
|
||||
(SERVER_IS_RELAY_SERVER(s) ? "RUNNING RELAY" : \
|
||||
(SERVER_IS_RUNNING(s) ? "RUNNING (only)" : \
|
||||
(SERVER_IS_DOWN(s) ? "DOWN" : "UNKNOWN STATUS"))))))))
|
||||
|
||||
#define STRTARGET(t) (t == TARGET_ALL ? "TARGET_ALL" : \
|
||||
(t == TARGET_MASTER ? "TARGET_MASTER" : \
|
||||
(t == TARGET_SLAVE ? "TARGET_SLAVE" : \
|
||||
(t == TARGET_NAMED_SERVER ? "TARGET_NAMED_SERVER" : \
|
||||
(t == TARGET_UNDEFINED ? "TARGET_UNDEFINED" : \
|
||||
"Unknown target value")))))
|
||||
|
||||
#define BREFSRV(b) (b->bref_backend->backend_server)
|
||||
|
||||
|
||||
#define STRHINTTYPE(t) (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_PARAMETER ? "HINT_PARAMETER" : "UNKNOWN HINT TYPE"))))))
|
||||
|
||||
#define STRDCBREASON(r) ((r) == DCB_REASON_CLOSE ? "DCB_REASON_CLOSE" : \
|
||||
((r) == DCB_REASON_DRAINED ? "DCB_REASON_DRAINED" : \
|
||||
((r) == DCB_REASON_HIGH_WATER ? "DCB_REASON_HIGH_WATER" : \
|
||||
((r) == DCB_REASON_LOW_WATER ? "DCB_REASON_LOW_WATER" : \
|
||||
((r) == DCB_REASON_ERROR ? "DCB_REASON_ERROR" : \
|
||||
((r) == DCB_REASON_HUP ? "DCB_REASON_HUP" : \
|
||||
((r) == DCB_REASON_NOT_RESPONDING ? "DCB_REASON_NOT_RESPONDING" : \
|
||||
"Unknown DCB reason")))))))
|
||||
|
||||
#define CHK_MLIST(l) { \
|
||||
ss_info_dassert((l->mlist_chk_top == CHK_NUM_MLIST && \
|
||||
l->mlist_chk_tail == CHK_NUM_MLIST), \
|
||||
"Single-linked list structure under- or overflow"); \
|
||||
if (l->mlist_first == NULL) { \
|
||||
ss_info_dassert(l->mlist_nodecount == 0, \
|
||||
"List head is NULL but element counter is not zero."); \
|
||||
ss_info_dassert(l->mlist_last == NULL, \
|
||||
"List head is NULL but tail has node"); \
|
||||
} else { \
|
||||
ss_info_dassert(l->mlist_nodecount > 0, \
|
||||
"List head has node but element counter is not " \
|
||||
"positive."); \
|
||||
CHK_MLIST_NODE(l->mlist_first); \
|
||||
CHK_MLIST_NODE(l->mlist_last); \
|
||||
} \
|
||||
if (l->mlist_nodecount == 0) { \
|
||||
ss_info_dassert(l->mlist_first == NULL, \
|
||||
"Element counter is zero but head has node"); \
|
||||
ss_info_dassert(l->mlist_last == NULL, \
|
||||
"Element counter is zero but tail has node"); \
|
||||
} \
|
||||
}
|
||||
|
||||
|
||||
|
||||
#define CHK_MLIST_NODE(n) { \
|
||||
ss_info_dassert((n->mlnode_chk_top == CHK_NUM_MLIST_NODE && \
|
||||
n->mlnode_chk_tail == CHK_NUM_MLIST_NODE), \
|
||||
"Single-linked list node under- or overflow"); \
|
||||
}
|
||||
|
||||
#define CHK_MLIST_CURSOR(c) { \
|
||||
ss_info_dassert(c->mlcursor_chk_top == CHK_NUM_MLIST_CURSOR && \
|
||||
c->mlcursor_chk_tail == CHK_NUM_MLIST_CURSOR, \
|
||||
"List cursor under- or overflow"); \
|
||||
ss_info_dassert(c->mlcursor_list != NULL, \
|
||||
"List cursor doesn't have list"); \
|
||||
ss_info_dassert(c->mlcursor_pos != NULL || \
|
||||
(c->mlcursor_pos == NULL && \
|
||||
c->mlcursor_list->mlist_first == NULL), \
|
||||
"List cursor doesn't have position"); \
|
||||
}
|
||||
|
||||
#define CHK_SLIST(l) { \
|
||||
ss_info_dassert((l->slist_chk_top == CHK_NUM_SLIST && \
|
||||
l->slist_chk_tail == CHK_NUM_SLIST), \
|
||||
"Single-linked list structure under- or overflow"); \
|
||||
if (l->slist_head == NULL) { \
|
||||
ss_info_dassert(l->slist_nelems == 0, \
|
||||
"List head is NULL but element counter is not zero."); \
|
||||
ss_info_dassert(l->slist_tail == NULL, \
|
||||
"List head is NULL but tail has node"); \
|
||||
} else { \
|
||||
ss_info_dassert(l->slist_nelems > 0, \
|
||||
"List head has node but element counter is not " \
|
||||
"positive."); \
|
||||
CHK_SLIST_NODE(l->slist_head); \
|
||||
CHK_SLIST_NODE(l->slist_tail); \
|
||||
} \
|
||||
if (l->slist_nelems == 0) { \
|
||||
ss_info_dassert(l->slist_head == NULL, \
|
||||
"Element counter is zero but head has node"); \
|
||||
ss_info_dassert(l->slist_tail == NULL, \
|
||||
"Element counter is zero but tail has node"); \
|
||||
} \
|
||||
}
|
||||
|
||||
|
||||
|
||||
#define CHK_SLIST_NODE(n) { \
|
||||
ss_info_dassert((n->slnode_chk_top == CHK_NUM_SLIST_NODE && \
|
||||
n->slnode_chk_tail == CHK_NUM_SLIST_NODE), \
|
||||
"Single-linked list node under- or overflow"); \
|
||||
}
|
||||
|
||||
#define CHK_SLIST_CURSOR(c) { \
|
||||
ss_info_dassert(c->slcursor_chk_top == CHK_NUM_SLIST_CURSOR && \
|
||||
c->slcursor_chk_tail == CHK_NUM_SLIST_CURSOR, \
|
||||
"List cursor under- or overflow"); \
|
||||
ss_info_dassert(c->slcursor_list != NULL, \
|
||||
"List cursor doesn't have list"); \
|
||||
ss_info_dassert(c->slcursor_pos != NULL || \
|
||||
(c->slcursor_pos == NULL && \
|
||||
c->slcursor_list->slist_head == NULL), \
|
||||
"List cursor doesn't have position"); \
|
||||
}
|
||||
|
||||
#define CHK_QUERY_TEST(q) { \
|
||||
ss_info_dassert(q->qt_chk_top == CHK_NUM_QUERY_TEST && \
|
||||
q->qt_chk_tail == CHK_NUM_QUERY_TEST, \
|
||||
"Query test under- or overflow."); \
|
||||
}
|
||||
|
||||
#define CHK_LOGFILE(lf) { \
|
||||
ss_info_dassert(lf->lf_chk_top == CHK_NUM_LOGFILE && \
|
||||
lf->lf_chk_tail == CHK_NUM_LOGFILE, \
|
||||
"Logfile struct under- or overflow"); \
|
||||
ss_info_dassert(lf->lf_filepath != NULL && \
|
||||
lf->lf_name_prefix != NULL && \
|
||||
lf->lf_name_suffix != NULL && \
|
||||
lf->lf_full_file_name != NULL, \
|
||||
"NULL in name variable\n"); \
|
||||
ss_debug( \
|
||||
(lf->lf_chk_top != CHK_NUM_LOGFILE || \
|
||||
lf->lf_chk_tail != CHK_NUM_LOGFILE ? \
|
||||
false : \
|
||||
(lf->lf_filepath == NULL || \
|
||||
lf->lf_name_prefix == NULL || \
|
||||
lf->lf_name_suffix == NULL || \
|
||||
lf->lf_full_file_name == NULL ? false : true));) \
|
||||
}
|
||||
|
||||
#define CHK_FILEWRITER(fwr) { \
|
||||
ss_info_dassert(fwr->fwr_chk_top == CHK_NUM_FILEWRITER && \
|
||||
fwr->fwr_chk_tail == CHK_NUM_FILEWRITER, \
|
||||
"File writer struct under- or overflow"); \
|
||||
}
|
||||
|
||||
#define CHK_THREAD(thr) { \
|
||||
ss_info_dassert(thr->sth_chk_top == CHK_NUM_THREAD && \
|
||||
thr->sth_chk_tail == CHK_NUM_THREAD, \
|
||||
"Thread struct under- or overflow"); \
|
||||
}
|
||||
|
||||
#define CHK_SIMPLE_MUTEX(sm) { \
|
||||
ss_info_dassert(sm->sm_chk_top == CHK_NUM_SIMPLE_MUTEX && \
|
||||
sm->sm_chk_tail == CHK_NUM_SIMPLE_MUTEX, \
|
||||
"Simple mutex struct under- or overflow"); \
|
||||
}
|
||||
|
||||
#define CHK_MESSAGE(mes) { \
|
||||
ss_info_dassert(mes->mes_chk_top == CHK_NUM_MESSAGE && \
|
||||
mes->mes_chk_tail == CHK_NUM_MESSAGE, \
|
||||
"Message struct under- or overflow"); \
|
||||
}
|
||||
|
||||
|
||||
#define CHK_MLIST_ISLOCKED(l) { \
|
||||
ss_info_dassert((l.mlist_uselock && l.mlist_islocked) || \
|
||||
!(l.mlist_uselock || l.mlist_islocked), \
|
||||
("mlist is not locked although it should.")); \
|
||||
CHK_MUTEXED_FOR_THR(l.mlist_uselock,l.mlist_rwlock); \
|
||||
}
|
||||
|
||||
#define CHK_MUTEXED_FOR_THR(b,l) { \
|
||||
ss_info_dassert(!b || \
|
||||
(b && (l->srw_rwlock_thr == pthread_self())), \
|
||||
"rwlock is not acquired although it should be."); \
|
||||
}
|
||||
|
||||
#define CHK_FNAMES_CONF(fn) { \
|
||||
ss_info_dassert(fn->fn_chk_top == CHK_NUM_FNAMES && \
|
||||
fn->fn_chk_tail == CHK_NUM_FNAMES, \
|
||||
"File names confs struct under- or overflow"); \
|
||||
}
|
||||
|
||||
#define CHK_LOGMANAGER(lm) { \
|
||||
ss_info_dassert(lm->lm_chk_top == CHK_NUM_LOGMANAGER && \
|
||||
lm->lm_chk_tail == CHK_NUM_LOGMANAGER, \
|
||||
"Log manager struct under- or overflow"); \
|
||||
}
|
||||
|
||||
#define CHK_FILE(f) { \
|
||||
ss_info_dassert(f->sf_chk_top == CHK_NUM_FILE && \
|
||||
f->sf_chk_tail == CHK_NUM_FILE, \
|
||||
"File struct under- or overflow"); \
|
||||
}
|
||||
|
||||
|
||||
#define CHK_BLOCKBUF(bb) { \
|
||||
ss_info_dassert(bb->bb_chk_top == CHK_NUM_BLOCKBUF, \
|
||||
"Block buf under- or overflow"); \
|
||||
}
|
||||
|
||||
#define CHK_HASHTABLE(t) { \
|
||||
ss_info_dassert(t->ht_chk_top == CHK_NUM_HASHTABLE && \
|
||||
t->ht_chk_tail == CHK_NUM_HASHTABLE, \
|
||||
"Hashtable under- or overflow"); \
|
||||
}
|
||||
|
||||
#define CHK_MANAGED_LIST(l) { \
|
||||
ss_info_dassert(l->list_entry_chk_top == CHK_NUM_MANAGED_LIST && \
|
||||
l->list_entry_chk_tail == CHK_NUM_MANAGED_LIST, \
|
||||
"Managed list under- or overflow"); \
|
||||
}
|
||||
|
||||
#define CHK_DCB(d) { \
|
||||
ss_info_dassert(d->dcb_chk_top == CHK_NUM_DCB && \
|
||||
d->dcb_chk_tail == CHK_NUM_DCB, \
|
||||
"Dcb under- or overflow"); \
|
||||
CHK_MANAGED_LIST(d) \
|
||||
}
|
||||
|
||||
#define CHK_PROTOCOL(p) { \
|
||||
ss_info_dassert(p->protocol_chk_top == CHK_NUM_PROTOCOL && \
|
||||
p->protocol_chk_tail == CHK_NUM_PROTOCOL, \
|
||||
"Protocol under- or overflow"); \
|
||||
}
|
||||
|
||||
#define CHK_SESSION(s) { \
|
||||
ss_info_dassert(s->ses_chk_top == CHK_NUM_SESSION && \
|
||||
s->ses_chk_tail == CHK_NUM_SESSION, \
|
||||
"Session under- or overflow"); \
|
||||
CHK_MANAGED_LIST(s) \
|
||||
}
|
||||
|
||||
#define CHK_SERVER(s) { \
|
||||
ss_info_dassert(s->server_chk_top == CHK_NUM_SERVER && \
|
||||
s->server_chk_tail == CHK_NUM_SERVER, \
|
||||
"Server under- or overflow"); \
|
||||
}
|
||||
|
||||
#define CHK_GWBUF(b) { \
|
||||
ss_info_dassert(((char *)(b)->start <= (char *)(b)->end), \
|
||||
"gwbuf start has passed the endpoint"); \
|
||||
}
|
||||
|
||||
#define CHK_CLIENT_RSES(r) { \
|
||||
ss_info_dassert((r)->rses_chk_top == CHK_NUM_ROUTER_SES && \
|
||||
(r)->rses_chk_tail == CHK_NUM_ROUTER_SES, \
|
||||
"Router client session has invalid check fields"); \
|
||||
}
|
||||
|
||||
#define CHK_RSES_PROP(p) { \
|
||||
ss_info_dassert((p)->rses_prop_chk_top == CHK_NUM_ROUTER_PROPERTY && \
|
||||
(p)->rses_prop_chk_tail == CHK_NUM_ROUTER_PROPERTY, \
|
||||
"Router property has invalid check fields"); \
|
||||
}
|
||||
|
||||
#define CHK_MYSQL_SESCMD(s) { \
|
||||
ss_info_dassert((s)->my_sescmd_chk_top == CHK_NUM_MY_SESCMD && \
|
||||
(s)->my_sescmd_chk_tail == CHK_NUM_MY_SESCMD, \
|
||||
"Session command has invalid check fields"); \
|
||||
}
|
||||
|
||||
#define CHK_SESCMD_CUR(c) { \
|
||||
ss_info_dassert((c)->scmd_cur_chk_top == CHK_NUM_SESCMD_CUR && \
|
||||
(c)->scmd_cur_chk_tail == CHK_NUM_SESCMD_CUR, \
|
||||
"Session command cursor has invalid check fields"); \
|
||||
}
|
||||
|
||||
#define CHK_BACKEND(b) { \
|
||||
ss_info_dassert((b)->be_chk_top == CHK_NUM_BACKEND && \
|
||||
(b)->be_chk_tail == CHK_NUM_BACKEND, \
|
||||
"BACKEND has invalid check fields"); \
|
||||
}
|
||||
|
||||
#define CHK_BACKEND_REF(r) { \
|
||||
ss_info_dassert((r)->bref_chk_top == CHK_NUM_BACKEND_REF && \
|
||||
(r)->bref_chk_tail == CHK_NUM_BACKEND_REF, \
|
||||
"Backend reference has invalid check fields"); \
|
||||
}
|
||||
|
||||
#define CHK_PREP_STMT(p) { \
|
||||
ss_info_dassert((p)->pstmt_chk_top == CHK_NUM_PREP_STMT && \
|
||||
(p)->pstmt_chk_tail == CHK_NUM_PREP_STMT, \
|
||||
"Prepared statement struct has invalid check fields"); \
|
||||
}
|
||||
|
||||
#define CHK_PARSING_INFO(p) { \
|
||||
ss_info_dassert((p)->pi_chk_top == CHK_NUM_PINFO && \
|
||||
(p)->pi_chk_tail == CHK_NUM_PINFO, \
|
||||
"Parsing info struct has invalid check fields"); \
|
||||
}
|
||||
|
||||
#define CHK_MYSQL_SESSION(s) { \
|
||||
ss_info_dassert((s)->myses_chk_top == CHK_NUM_MYSQLSES && \
|
||||
(s)->myses_chk_tail == CHK_NUM_MYSQLSES, \
|
||||
"MYSQL session struct has invalid check fields"); \
|
||||
}
|
||||
|
||||
#define CHK_ADMIN_SESSION(s) { \
|
||||
ss_info_dassert((s)->adminses_chk_top == CHK_NUM_ADMINSES && \
|
||||
(s)->adminses_chk_tail == CHK_NUM_ADMINSES, \
|
||||
"Admin session struct has invalid check fields"); \
|
||||
}
|
||||
|
||||
|
||||
#if defined(FAKE_CODE)
|
||||
static bool conn_open[10240];
|
||||
#endif /* FAKE_CODE */
|
||||
|
||||
#endif /* SKYGW_DEBUG_H */
|
||||
47
server/include/skygw_types.h
Normal file
47
server/include/skygw_types.h
Normal file
@ -0,0 +1,47 @@
|
||||
/*
|
||||
* Copyright (c) 2016 MariaDB Corporation Ab
|
||||
*
|
||||
* Use of this software is governed by the Business Source License included
|
||||
* in the LICENSE.TXT file and at www.mariadb.com/bsl.
|
||||
*
|
||||
* Change Date: 2019-07-01
|
||||
*
|
||||
* On the date above, in accordance with the Business Source License, use
|
||||
* of this software will be governed by version 2 or later of the General
|
||||
* Public License.
|
||||
*/
|
||||
|
||||
#if !defined(SKYGW_TYPES_H)
|
||||
#define SKYGW_TYPES_H
|
||||
|
||||
#include <math.h>
|
||||
#include <stdbool.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#define SECOND_USEC (1024*1024L)
|
||||
#define MSEC_USEC (1024L)
|
||||
|
||||
#define KILOBYTE_BYTE (1024L)
|
||||
#define MEGABYTE_BYTE (1024*1024L)
|
||||
#define GIGABYTE_BYTE (1024*1024*1024L)
|
||||
|
||||
#define KB KILOBYTE_BYTE
|
||||
#define MB MEGABYTE_BYTE
|
||||
#define GB GIGABYTE_BYTE
|
||||
|
||||
#define CALCLEN(i) ((size_t)(floor(log10(abs(i))) + 1))
|
||||
|
||||
#define UINTLEN(i) (i<10 ? 1 : (i<100 ? 2 : (i<1000 ? 3 : CALCLEN(i))))
|
||||
|
||||
#if !defined(PATH_MAX)
|
||||
# if defined(__USE_POSIX)
|
||||
# define PATH_MAX _POSIX_PATH_MAX
|
||||
# else
|
||||
# define PATH_MAX 256
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#define MAX_ERROR_MSG PATH_MAX
|
||||
#define array_nelems(a) ((uint)(sizeof(a)/sizeof(a[0])))
|
||||
|
||||
#endif /* SKYGW_TYPES_H */
|
||||
208
server/include/skygw_utils.h
Normal file
208
server/include/skygw_utils.h
Normal file
@ -0,0 +1,208 @@
|
||||
#ifndef _SKYGW_UTILS_H
|
||||
#define _SKYGW_UTILS_H
|
||||
/*
|
||||
* Copyright (c) 2016 MariaDB Corporation Ab
|
||||
*
|
||||
* Use of this software is governed by the Business Source License included
|
||||
* in the LICENSE.TXT file and at www.mariadb.com/bsl.
|
||||
*
|
||||
* Change Date: 2019-07-01
|
||||
*
|
||||
* On the date above, in accordance with the Business Source License, use
|
||||
* of this software will be governed by version 2 or later of the General
|
||||
* Public License.
|
||||
*/
|
||||
|
||||
/*
|
||||
* We need a common.h file that is included by every component.
|
||||
*/
|
||||
#if !defined(STRERROR_BUFLEN)
|
||||
#define STRERROR_BUFLEN 512
|
||||
#endif
|
||||
|
||||
#ifndef MIN
|
||||
#define MIN(a,b) (a<b ? a : b)
|
||||
#endif
|
||||
#ifndef MAX
|
||||
#define MAX(a,b) (a>b ? a : b)
|
||||
#endif
|
||||
#define FSYNCLIMIT 10
|
||||
|
||||
#include "skygw_types.h"
|
||||
#include "skygw_debug.h"
|
||||
|
||||
#define DISKWRITE_LATENCY (5*MSEC_USEC)
|
||||
|
||||
typedef struct skygw_file_st skygw_file_t;
|
||||
typedef struct skygw_thread_st skygw_thread_t;
|
||||
typedef struct skygw_message_st skygw_message_t;
|
||||
|
||||
typedef struct simple_mutex_st
|
||||
{
|
||||
skygw_chk_t sm_chk_top;
|
||||
pthread_mutex_t sm_mutex;
|
||||
pthread_t sm_lock_thr;
|
||||
bool sm_locked;
|
||||
int sm_enabled; /**< defined as in to minimize mutexing */
|
||||
bool sm_flat;
|
||||
char* sm_name;
|
||||
skygw_chk_t sm_chk_tail;
|
||||
} simple_mutex_t;
|
||||
|
||||
typedef struct skygw_rwlock_st
|
||||
{
|
||||
skygw_chk_t srw_chk_top;
|
||||
pthread_rwlock_t* srw_rwlock;
|
||||
pthread_t srw_rwlock_thr;
|
||||
skygw_chk_t srw_chk_tail;
|
||||
} skygw_rwlock_t;
|
||||
|
||||
|
||||
typedef enum { THR_INIT, THR_RUNNING, THR_STOPPED, THR_DONE } skygw_thr_state_t;
|
||||
typedef enum { MES_RC_FAIL, MES_RC_SUCCESS, MES_RC_TIMEOUT } skygw_mes_rc_t;
|
||||
|
||||
|
||||
static const char* timestamp_formatstr = "%04d-%02d-%02d %02d:%02d:%02d ";
|
||||
/** One for terminating '\0' */
|
||||
static const size_t timestamp_len = (4+1 +2+1 +2+1 +2+1 +2+1 +2+3 +1) * sizeof(char);
|
||||
|
||||
static const char* timestamp_formatstr_hp = "%04d-%02d-%02d %02d:%02d:%02d.%03d ";
|
||||
/** One for terminating '\0' */
|
||||
static const size_t timestamp_len_hp = (4+1 +2+1 +2+1 +2+1 +2+1 +2+1+3+3 +1) * sizeof(char);
|
||||
|
||||
struct skygw_thread_st
|
||||
{
|
||||
skygw_chk_t sth_chk_top;
|
||||
bool sth_must_exit;
|
||||
simple_mutex_t* sth_mutex;
|
||||
pthread_t sth_parent;
|
||||
pthread_t sth_thr;
|
||||
int sth_errno;
|
||||
#if defined(SS_DEBUG)
|
||||
skygw_thr_state_t sth_state;
|
||||
#endif
|
||||
char* sth_name;
|
||||
void* (*sth_thrfun)(void* data);
|
||||
void* sth_data;
|
||||
skygw_chk_t sth_chk_tail;
|
||||
};
|
||||
|
||||
struct skygw_message_st
|
||||
{
|
||||
skygw_chk_t mes_chk_top;
|
||||
bool mes_sent;
|
||||
pthread_mutex_t mes_mutex;
|
||||
pthread_cond_t mes_cond;
|
||||
skygw_chk_t mes_chk_tail;
|
||||
};
|
||||
|
||||
struct skygw_file_st
|
||||
{
|
||||
skygw_chk_t sf_chk_top;
|
||||
char* sf_fname;
|
||||
FILE* sf_file;
|
||||
int sf_fd;
|
||||
skygw_chk_t sf_chk_tail;
|
||||
};
|
||||
|
||||
EXTERN_C_BLOCK_BEGIN
|
||||
|
||||
bool utils_init(); /*< Call this first before using any other function */
|
||||
void utils_end();
|
||||
|
||||
EXTERN_C_BLOCK_END
|
||||
|
||||
/** Skygw thread routines */
|
||||
skygw_thread_t* skygw_thread_init(const char* name,
|
||||
void* (*sth_thrfun)(void* data),
|
||||
void* data);
|
||||
void skygw_thread_done(skygw_thread_t* th);
|
||||
int skygw_thread_start(skygw_thread_t* thr);
|
||||
skygw_thr_state_t skygw_thread_get_state(skygw_thread_t* thr);
|
||||
pthread_t skygw_thread_gettid(skygw_thread_t* thr);
|
||||
|
||||
size_t get_timestamp_len(void);
|
||||
size_t get_timestamp_len_hp(void);
|
||||
size_t snprint_timestamp(char* p_ts, size_t tslen);
|
||||
size_t snprint_timestamp_hp(char* p_ts, size_t tslen);
|
||||
|
||||
EXTERN_C_BLOCK_BEGIN
|
||||
|
||||
void skygw_thread_set_state(skygw_thread_t* thr,
|
||||
skygw_thr_state_t state);
|
||||
void* skygw_thread_get_data(skygw_thread_t* thr);
|
||||
bool skygw_thread_must_exit(skygw_thread_t* thr);
|
||||
bool skygw_thread_set_exitflag(skygw_thread_t* thr,
|
||||
skygw_message_t* sendmes,
|
||||
skygw_message_t* recmes);
|
||||
|
||||
EXTERN_C_BLOCK_END
|
||||
|
||||
/** Skygw thread routines */
|
||||
|
||||
/** Skygw file routines */
|
||||
typedef enum skygw_open_mode
|
||||
{
|
||||
SKYGW_OPEN_APPEND,
|
||||
SKYGW_OPEN_TRUNCATE,
|
||||
} skygw_open_mode_t;
|
||||
|
||||
skygw_file_t* skygw_file_alloc(const char* fname);
|
||||
void skygw_file_free(skygw_file_t* file);
|
||||
skygw_file_t* skygw_file_init(const char* fname,
|
||||
const char* symlinkname,
|
||||
skygw_open_mode_t mode);
|
||||
void skygw_file_close(skygw_file_t* file);
|
||||
int skygw_file_write(skygw_file_t* file,
|
||||
void* data,
|
||||
size_t nbytes,
|
||||
bool flush);
|
||||
/** Skygw file routines */
|
||||
|
||||
EXTERN_C_BLOCK_BEGIN
|
||||
|
||||
void acquire_lock(int* l);
|
||||
void release_lock(int* l);
|
||||
|
||||
simple_mutex_t* simple_mutex_init(simple_mutex_t* mutexptr, const char* name);
|
||||
int simple_mutex_done(simple_mutex_t* sm);
|
||||
int simple_mutex_lock(simple_mutex_t* sm, bool block);
|
||||
int simple_mutex_unlock(simple_mutex_t* sm);
|
||||
|
||||
/** Skygw message routines */
|
||||
skygw_message_t* skygw_message_init(void);
|
||||
void skygw_message_done(skygw_message_t* mes);
|
||||
skygw_mes_rc_t skygw_message_send(skygw_message_t* mes);
|
||||
void skygw_message_wait(skygw_message_t* mes);
|
||||
skygw_mes_rc_t skygw_message_request(skygw_message_t* mes);
|
||||
void skygw_message_reset(skygw_message_t* mes);
|
||||
|
||||
/** Skygw message routines */
|
||||
|
||||
EXTERN_C_BLOCK_END
|
||||
|
||||
int skygw_rwlock_wrlock(skygw_rwlock_t* rwlock);
|
||||
int skygw_rwlock_rdlock(skygw_rwlock_t* rwlock);
|
||||
int skygw_rwlock_unlock(skygw_rwlock_t* rwlock);
|
||||
int skygw_rwlock_init(skygw_rwlock_t** rwlock);
|
||||
|
||||
EXTERN_C_BLOCK_BEGIN
|
||||
|
||||
size_t get_decimal_len(size_t s);
|
||||
|
||||
char* remove_mysql_comments(const char** src, const size_t* srcsize, char** dest,
|
||||
size_t* destsize);
|
||||
char* replace_values(const char** src, const size_t* srcsize, char** dest,
|
||||
size_t* destsize);
|
||||
char* replace_literal(char* haystack,
|
||||
const char* needle,
|
||||
const char* replacement);
|
||||
char* replace_quoted(const char** src, const size_t* srcsize, char** dest, size_t* destsize);
|
||||
bool is_valid_posix_path(char* path);
|
||||
bool strip_escape_chars(char*);
|
||||
char* trim(char *str);
|
||||
char* squeeze_whitespace(char* str);
|
||||
|
||||
EXTERN_C_BLOCK_END
|
||||
|
||||
#endif /* SKYGW_UTILS_H */
|
||||
@ -6,7 +6,7 @@
|
||||
* Use of this software is governed by the Business Source License included
|
||||
* in the LICENSE.TXT file and at www.mariadb.com/bsl.
|
||||
*
|
||||
* Change Date: 2019-01-01
|
||||
* Change Date: 2019-07-01
|
||||
*
|
||||
* On the date above, in accordance with the Business Source License, use
|
||||
* of this software will be governed by version 2 or later of the General
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
* Use of this software is governed by the Business Source License included
|
||||
* in the LICENSE.TXT file and at www.mariadb.com/bsl.
|
||||
*
|
||||
* Change Date: 2019-01-01
|
||||
* Change Date: 2019-07-01
|
||||
*
|
||||
* On the date above, in accordance with the Business Source License, use
|
||||
* of this software will be governed by version 2 or later of the General
|
||||
@ -23,8 +23,9 @@
|
||||
* for the lock to be released. However they are useful in that they do not involve
|
||||
* system calls and are light weight when the expected wait time for a lock is low.
|
||||
*/
|
||||
#include <thread.h>
|
||||
#include <stdbool.h>
|
||||
#include <skygw_debug.h>
|
||||
|
||||
EXTERN_C_BLOCK_BEGIN
|
||||
|
||||
#define SPINLOCK_PROFILE 0
|
||||
|
||||
@ -68,9 +69,11 @@ typedef struct spinlock
|
||||
#define SPINLOCK_IS_LOCKED(l) ((l)->lock != 0 ? true : false)
|
||||
|
||||
extern void spinlock_init(SPINLOCK *lock);
|
||||
extern void spinlock_acquire(SPINLOCK *lock);
|
||||
extern int spinlock_acquire_nowait(SPINLOCK *lock);
|
||||
extern void spinlock_release(SPINLOCK *lock);
|
||||
extern void spinlock_stats(SPINLOCK *lock, void (*reporter)(void *, char *, int), void *hdl);
|
||||
extern void spinlock_acquire(const SPINLOCK *lock);
|
||||
extern int spinlock_acquire_nowait(const SPINLOCK *lock);
|
||||
extern void spinlock_release(const SPINLOCK *lock);
|
||||
extern void spinlock_stats(const SPINLOCK *lock, void (*reporter)(void *, char *, int), void *hdl);
|
||||
|
||||
EXTERN_C_BLOCK_END
|
||||
|
||||
#endif
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
* Use of this software is governed by the Business Source License included
|
||||
* in the LICENSE.TXT file and at www.mariadb.com/bsl.
|
||||
*
|
||||
* Change Date: 2019-01-01
|
||||
* Change Date: 2019-07-01
|
||||
*
|
||||
* On the date above, in accordance with the Business Source License, use
|
||||
* of this software will be governed by version 2 or later of the General
|
||||
@ -19,8 +19,9 @@
|
||||
* @verbatim
|
||||
* Revision History
|
||||
*
|
||||
* Date Who Description
|
||||
* 21/01/16 Markus Makela Initial implementation
|
||||
* Date Who Description
|
||||
* 21/01/16 Markus Makela Initial implementation
|
||||
* 15/06/16 Martin Brampton Frequently used functions inlined
|
||||
* @endverbatim
|
||||
*/
|
||||
|
||||
@ -32,13 +33,37 @@ void ts_stats_init();
|
||||
/** No-op for now */
|
||||
void ts_stats_end();
|
||||
|
||||
/** Every thread should call set_current_thread_id only once */
|
||||
void ts_stats_set_thread_id(int id);
|
||||
|
||||
ts_stats_t ts_stats_alloc();
|
||||
void ts_stats_free(ts_stats_t stats);
|
||||
void ts_stats_add(ts_stats_t stats, int value);
|
||||
void ts_stats_set(ts_stats_t stats, int value);
|
||||
int ts_stats_sum(ts_stats_t stats);
|
||||
|
||||
/**
|
||||
* @brief Increment thread statistics by one
|
||||
*
|
||||
* @param stats Statistics to add to
|
||||
* @param thread_id ID of thread
|
||||
*/
|
||||
static void inline
|
||||
ts_stats_increment(ts_stats_t stats, int thread_id)
|
||||
{
|
||||
((int*)stats)[thread_id]++;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Assign a value to a statistics element
|
||||
*
|
||||
* This sets the value for the specified thread.
|
||||
*
|
||||
* @param stats Statistics to set
|
||||
* @param value Value to set to
|
||||
* @param thread_id ID of thread
|
||||
*
|
||||
* @note Appears to be unused
|
||||
*/
|
||||
static void inline
|
||||
ts_stats_set(ts_stats_t stats, int value, int thread_id)
|
||||
{
|
||||
((int*)stats)[thread_id] = value;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
* Use of this software is governed by the Business Source License included
|
||||
* in the LICENSE.TXT file and at www.mariadb.com/bsl.
|
||||
*
|
||||
* Change Date: 2019-01-01
|
||||
* Change Date: 2019-07-01
|
||||
*
|
||||
* On the date above, in accordance with the Business Source License, use
|
||||
* of this software will be governed by version 2 or later of the General
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
* Use of this software is governed by the Business Source License included
|
||||
* in the LICENSE.TXT file and at www.mariadb.com/bsl.
|
||||
*
|
||||
* Change Date: 2019-01-01
|
||||
* Change Date: 2019-07-01
|
||||
*
|
||||
* On the date above, in accordance with the Business Source License, use
|
||||
* of this software will be governed by version 2 or later of the General
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
* Use of this software is governed by the Business Source License included
|
||||
* in the LICENSE.TXT file and at www.mariadb.com/bsl.
|
||||
*
|
||||
* Change Date: 2019-01-01
|
||||
* Change Date: 2019-07-01
|
||||
*
|
||||
* On the date above, in accordance with the Business Source License, use
|
||||
* of this software will be governed by version 2 or later of the General
|
||||
|
||||
Reference in New Issue
Block a user