Merge branch 'release-1.0GA' of https://github.com/mariadb-corporation/MaxScale into release-1.0GA
This commit is contained in:
@ -94,7 +94,9 @@ char* syslog_ident_str = NULL;
|
|||||||
*/
|
*/
|
||||||
static int lmlock;
|
static int lmlock;
|
||||||
static logmanager_t* lm;
|
static logmanager_t* lm;
|
||||||
|
static bool flushall_flag;
|
||||||
|
static bool flushall_started_flag;
|
||||||
|
static bool flushall_done_flag;
|
||||||
|
|
||||||
/** Writer thread structure */
|
/** Writer thread structure */
|
||||||
struct filewriter_st {
|
struct filewriter_st {
|
||||||
@ -292,7 +294,8 @@ static bool check_file_and_path(
|
|||||||
static bool file_is_symlink(char* filename);
|
static bool file_is_symlink(char* filename);
|
||||||
static int skygw_log_disable_raw(logfile_id_t id, bool emergency); /*< no locking */
|
static int skygw_log_disable_raw(logfile_id_t id, bool emergency); /*< no locking */
|
||||||
static int find_last_seqno(strpart_t* parts, int seqno, int seqnoidx);
|
static int find_last_seqno(strpart_t* parts, int seqno, int seqnoidx);
|
||||||
|
void flushall_logfiles(bool flush);
|
||||||
|
bool thr_flushall_check();
|
||||||
|
|
||||||
const char* get_suffix_default(void)
|
const char* get_suffix_default(void)
|
||||||
{
|
{
|
||||||
@ -2850,13 +2853,15 @@ static void* thr_filewriter_fun(
|
|||||||
int i;
|
int i;
|
||||||
blockbuf_state_t flush_blockbuf; /**< flush single block buffer. */
|
blockbuf_state_t flush_blockbuf; /**< flush single block buffer. */
|
||||||
bool flush_logfile; /**< flush logfile */
|
bool flush_logfile; /**< flush logfile */
|
||||||
bool flushall_logfiles;/**< flush all logfiles */
|
bool do_flushall = false;
|
||||||
bool rotate_logfile; /*< close current and open new file */
|
bool rotate_logfile; /*< close current and open new file */
|
||||||
size_t vn1;
|
size_t vn1;
|
||||||
size_t vn2;
|
size_t vn2;
|
||||||
|
|
||||||
thr = (skygw_thread_t *)data;
|
thr = (skygw_thread_t *)data;
|
||||||
fwr = (filewriter_t *)skygw_thread_get_data(thr);
|
fwr = (filewriter_t *)skygw_thread_get_data(thr);
|
||||||
|
flushall_logfiles(false);
|
||||||
|
|
||||||
CHK_FILEWRITER(fwr);
|
CHK_FILEWRITER(fwr);
|
||||||
ss_debug(skygw_thread_set_state(thr, THR_RUNNING));
|
ss_debug(skygw_thread_set_state(thr, THR_RUNNING));
|
||||||
|
|
||||||
@ -2869,8 +2874,9 @@ static void* thr_filewriter_fun(
|
|||||||
* Reset message to avoid redundant calls.
|
* Reset message to avoid redundant calls.
|
||||||
*/
|
*/
|
||||||
skygw_message_wait(fwr->fwr_logmes);
|
skygw_message_wait(fwr->fwr_logmes);
|
||||||
|
if(skygw_thread_must_exit(thr)){
|
||||||
flushall_logfiles = skygw_thread_must_exit(thr);
|
flushall_logfiles(true);
|
||||||
|
}
|
||||||
|
|
||||||
/** Process all logfiles which have buffered writes. */
|
/** Process all logfiles which have buffered writes. */
|
||||||
for (i=LOGFILE_FIRST; i<=LOGFILE_LAST; i <<= 1)
|
for (i=LOGFILE_FIRST; i<=LOGFILE_LAST; i <<= 1)
|
||||||
@ -2879,6 +2885,10 @@ static void* thr_filewriter_fun(
|
|||||||
/**
|
/**
|
||||||
* Get file pointer of current logfile.
|
* Get file pointer of current logfile.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
do_flushall = thr_flushall_check();
|
||||||
file = fwr->fwr_file[i];
|
file = fwr->fwr_file[i];
|
||||||
lf = &lm->lm_logfile[(logfile_id_t)i];
|
lf = &lm->lm_logfile[(logfile_id_t)i];
|
||||||
|
|
||||||
@ -2949,7 +2959,7 @@ static void* thr_filewriter_fun(
|
|||||||
if (bb->bb_buf_used != 0 &&
|
if (bb->bb_buf_used != 0 &&
|
||||||
(flush_blockbuf == BB_FULL ||
|
(flush_blockbuf == BB_FULL ||
|
||||||
flush_logfile ||
|
flush_logfile ||
|
||||||
flushall_logfiles))
|
do_flushall))
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* buffer is at least half-full
|
* buffer is at least half-full
|
||||||
@ -2968,7 +2978,7 @@ static void* thr_filewriter_fun(
|
|||||||
(void *)bb->bb_buf,
|
(void *)bb->bb_buf,
|
||||||
bb->bb_buf_used,
|
bb->bb_buf_used,
|
||||||
(flush_logfile ||
|
(flush_logfile ||
|
||||||
flushall_logfiles));
|
do_flushall));
|
||||||
if (err)
|
if (err)
|
||||||
{
|
{
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
@ -3015,13 +3025,28 @@ static void* thr_filewriter_fun(
|
|||||||
* Loop is restarted to ensure that all logfiles are
|
* Loop is restarted to ensure that all logfiles are
|
||||||
* flushed.
|
* flushed.
|
||||||
*/
|
*/
|
||||||
if (!flushall_logfiles && skygw_thread_must_exit(thr))
|
|
||||||
|
if(flushall_started_flag){
|
||||||
|
flushall_started_flag = false;
|
||||||
|
flushall_done_flag = true;
|
||||||
|
i = LOGFILE_FIRST;
|
||||||
|
goto retry_flush_on_exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!thr_flushall_check() && skygw_thread_must_exit(thr))
|
||||||
{
|
{
|
||||||
flushall_logfiles = true;
|
flushall_logfiles(true);
|
||||||
i = LOGFILE_FIRST;
|
i = LOGFILE_FIRST;
|
||||||
goto retry_flush_on_exit;
|
goto retry_flush_on_exit;
|
||||||
}
|
}
|
||||||
} /* for */
|
}/* for */
|
||||||
|
|
||||||
|
if(flushall_done_flag){
|
||||||
|
flushall_done_flag = false;
|
||||||
|
flushall_logfiles(false);
|
||||||
|
skygw_message_send(fwr->fwr_clientmes);
|
||||||
|
}
|
||||||
|
|
||||||
} /* while (!skygw_thread_must_exit) */
|
} /* while (!skygw_thread_must_exit) */
|
||||||
|
|
||||||
ss_debug(skygw_thread_set_state(thr, THR_STOPPED));
|
ss_debug(skygw_thread_set_state(thr, THR_STOPPED));
|
||||||
@ -3121,4 +3146,34 @@ static int find_last_seqno(
|
|||||||
free(snstr);
|
free(snstr);
|
||||||
|
|
||||||
return seqno;
|
return seqno;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool thr_flushall_check()
|
||||||
|
{
|
||||||
|
bool rval = false;
|
||||||
|
simple_mutex_lock(&lm->lm_mutex,true);
|
||||||
|
rval = flushall_flag;
|
||||||
|
if(rval && !flushall_started_flag && !flushall_done_flag){
|
||||||
|
flushall_started_flag = true;
|
||||||
|
}
|
||||||
|
simple_mutex_unlock(&lm->lm_mutex);
|
||||||
|
return rval;
|
||||||
|
}
|
||||||
|
|
||||||
|
void flushall_logfiles(bool flush)
|
||||||
|
{
|
||||||
|
simple_mutex_lock(&lm->lm_mutex,true);
|
||||||
|
flushall_flag = flush;
|
||||||
|
simple_mutex_unlock(&lm->lm_mutex);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Flush all log files synchronously
|
||||||
|
*/
|
||||||
|
void skygw_log_sync_all(void)
|
||||||
|
{
|
||||||
|
skygw_log_write(LOGFILE_TRACE,"Starting log flushing to disk.");
|
||||||
|
flushall_logfiles(true);
|
||||||
|
skygw_message_send(lm->lm_logmes);
|
||||||
|
skygw_message_wait(lm->lm_clientmes);
|
||||||
|
}
|
||||||
|
@ -374,8 +374,8 @@ int rc;
|
|||||||
rc = listen(listener->fd, SOMAXCONN);
|
rc = listen(listener->fd, SOMAXCONN);
|
||||||
|
|
||||||
if (rc == 0) {
|
if (rc == 0) {
|
||||||
LOGIF(LD, (skygw_log_write(
|
LOGIF(LM, (skygw_log_write(
|
||||||
LOGFILE_DEBUG,
|
LOGFILE_MESSAGE,
|
||||||
"Listening maxscale connections at %s\n",
|
"Listening maxscale connections at %s\n",
|
||||||
config)));
|
config)));
|
||||||
} else {
|
} else {
|
||||||
|
@ -577,8 +577,8 @@ int gw_send_authentication_to_backend(
|
|||||||
dcb = conn->owner_dcb;
|
dcb = conn->owner_dcb;
|
||||||
final_capabilities = gw_mysql_get_byte4((uint8_t *)&server_capabilities);
|
final_capabilities = gw_mysql_get_byte4((uint8_t *)&server_capabilities);
|
||||||
|
|
||||||
/** Copy client's flags to backend */
|
/** Copy client's flags to backend but with the known capabilities mask */
|
||||||
final_capabilities |= conn->client_capabilities;
|
final_capabilities |= (conn->client_capabilities & GW_MYSQL_CAPABILITIES_CLIENT);
|
||||||
|
|
||||||
/* get charset the client sent and use it for connection auth */
|
/* get charset the client sent and use it for connection auth */
|
||||||
charset = conn->charset;
|
charset = conn->charset;
|
||||||
|
Reference in New Issue
Block a user