Add CHK_SERVER capability and test in dcb_persistent_clean_count
This commit is contained in:
@ -2316,8 +2316,9 @@ dcb_persistent_clean_count(DCB *dcb)
|
|||||||
DCB *previousdcb = NULL;
|
DCB *previousdcb = NULL;
|
||||||
DCB *persistentdcb = server->persistent;
|
DCB *persistentdcb = server->persistent;
|
||||||
|
|
||||||
|
CHK_SERVER(server);
|
||||||
while (persistentdcb) {
|
while (persistentdcb) {
|
||||||
CHK_DCB(persistentdcb);
|
CHK_DCB(persistentdcb);
|
||||||
if (count >= server->persistpoolmax || (persistentdcb->last_read + server->persistmaxtime) < time(NULL))
|
if (count >= server->persistpoolmax || (persistentdcb->last_read + server->persistmaxtime) < time(NULL))
|
||||||
{
|
{
|
||||||
if (previousdcb) {
|
if (previousdcb) {
|
||||||
|
@ -76,6 +76,9 @@ typedef struct {
|
|||||||
* between the gateway and the server.
|
* between the gateway and the server.
|
||||||
*/
|
*/
|
||||||
typedef struct server {
|
typedef struct server {
|
||||||
|
#if defined(SS_DEBUG)
|
||||||
|
skygw_chk_t server_chk_top;
|
||||||
|
#endif
|
||||||
char *unique_name; /**< Unique name for the server */
|
char *unique_name; /**< Unique name for the server */
|
||||||
char *name; /**< Server name/IP address*/
|
char *name; /**< Server name/IP address*/
|
||||||
unsigned short port; /**< Port to listen on */
|
unsigned short port; /**< Port to listen on */
|
||||||
@ -99,6 +102,9 @@ typedef struct server {
|
|||||||
SPINLOCK persistlock; /**< Lock for adjusting the persistent connections list */
|
SPINLOCK persistlock; /**< Lock for adjusting the persistent connections list */
|
||||||
long persistpoolmax; /**< Maximum size of persistent connections pool */
|
long persistpoolmax; /**< Maximum size of persistent connections pool */
|
||||||
long persistmaxtime; /**< Maximum number of seconds connection can live */
|
long persistmaxtime; /**< Maximum number of seconds connection can live */
|
||||||
|
#if defined(SS_DEBUG)
|
||||||
|
skygw_chk_t server_chk_tail;
|
||||||
|
#endif
|
||||||
} SERVER;
|
} SERVER;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -131,6 +131,7 @@ typedef enum skygw_chk_t {
|
|||||||
CHK_NUM_DCB,
|
CHK_NUM_DCB,
|
||||||
CHK_NUM_PROTOCOL,
|
CHK_NUM_PROTOCOL,
|
||||||
CHK_NUM_SESSION,
|
CHK_NUM_SESSION,
|
||||||
|
CHK_NUM_SERVER,
|
||||||
CHK_NUM_ROUTER_SES,
|
CHK_NUM_ROUTER_SES,
|
||||||
CHK_NUM_MY_SESCMD,
|
CHK_NUM_MY_SESCMD,
|
||||||
CHK_NUM_ROUTER_PROPERTY,
|
CHK_NUM_ROUTER_PROPERTY,
|
||||||
@ -506,6 +507,12 @@ typedef enum skygw_chk_t {
|
|||||||
"Session under- or overflow"); \
|
"Session under- or overflow"); \
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#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) { \
|
#define CHK_GWBUF(b) { \
|
||||||
ss_info_dassert(((char *)(b)->start <= (char *)(b)->end), \
|
ss_info_dassert(((char *)(b)->start <= (char *)(b)->end), \
|
||||||
"gwbuf start has passed the endpoint"); \
|
"gwbuf start has passed the endpoint"); \
|
||||||
|
Reference in New Issue
Block a user