Merge branch 'release-1.0GA' of https://github.com/mariadb-corporation/MaxScale into release-1.0GA

This commit is contained in:
VilhoRaatikka 2014-12-02 20:03:14 +02:00
commit bdfdc3b522
3 changed files with 70 additions and 15 deletions

View File

@ -94,7 +94,9 @@ char* syslog_ident_str = NULL;
*/
static int lmlock;
static logmanager_t* lm;
static bool flushall_flag;
static bool flushall_started_flag;
static bool flushall_done_flag;
/** Writer thread structure */
struct filewriter_st {
@ -292,7 +294,8 @@ static bool check_file_and_path(
static bool file_is_symlink(char* filename);
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);
void flushall_logfiles(bool flush);
bool thr_flushall_check();
const char* get_suffix_default(void)
{
@ -2850,13 +2853,15 @@ static void* thr_filewriter_fun(
int i;
blockbuf_state_t flush_blockbuf; /**< flush single block buffer. */
bool flush_logfile; /**< flush logfile */
bool flushall_logfiles;/**< flush all logfiles */
bool do_flushall = false;
bool rotate_logfile; /*< close current and open new file */
size_t vn1;
size_t vn2;
thr = (skygw_thread_t *)data;
fwr = (filewriter_t *)skygw_thread_get_data(thr);
flushall_logfiles(false);
CHK_FILEWRITER(fwr);
ss_debug(skygw_thread_set_state(thr, THR_RUNNING));
@ -2869,8 +2874,9 @@ static void* thr_filewriter_fun(
* Reset message to avoid redundant calls.
*/
skygw_message_wait(fwr->fwr_logmes);
flushall_logfiles = skygw_thread_must_exit(thr);
if(skygw_thread_must_exit(thr)){
flushall_logfiles(true);
}
/** Process all logfiles which have buffered writes. */
for (i=LOGFILE_FIRST; i<=LOGFILE_LAST; i <<= 1)
@ -2879,6 +2885,10 @@ static void* thr_filewriter_fun(
/**
* Get file pointer of current logfile.
*/
do_flushall = thr_flushall_check();
file = fwr->fwr_file[i];
lf = &lm->lm_logfile[(logfile_id_t)i];
@ -2949,7 +2959,7 @@ static void* thr_filewriter_fun(
if (bb->bb_buf_used != 0 &&
(flush_blockbuf == BB_FULL ||
flush_logfile ||
flushall_logfiles))
do_flushall))
{
/**
* buffer is at least half-full
@ -2968,7 +2978,7 @@ static void* thr_filewriter_fun(
(void *)bb->bb_buf,
bb->bb_buf_used,
(flush_logfile ||
flushall_logfiles));
do_flushall));
if (err)
{
fprintf(stderr,
@ -3015,13 +3025,28 @@ static void* thr_filewriter_fun(
* Loop is restarted to ensure that all logfiles are
* 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;
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) */
ss_debug(skygw_thread_set_state(thr, THR_STOPPED));
@ -3121,4 +3146,34 @@ static int find_last_seqno(
free(snstr);
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);
}

View File

@ -374,8 +374,8 @@ int rc;
rc = listen(listener->fd, SOMAXCONN);
if (rc == 0) {
LOGIF(LD, (skygw_log_write(
LOGFILE_DEBUG,
LOGIF(LM, (skygw_log_write(
LOGFILE_MESSAGE,
"Listening maxscale connections at %s\n",
config)));
} else {

View File

@ -577,8 +577,8 @@ int gw_send_authentication_to_backend(
dcb = conn->owner_dcb;
final_capabilities = gw_mysql_get_byte4((uint8_t *)&server_capabilities);
/** Copy client's flags to backend */
final_capabilities |= conn->client_capabilities;
/** Copy client's flags to backend but with the known capabilities mask */
final_capabilities |= (conn->client_capabilities & GW_MYSQL_CAPABILITIES_CLIENT);
/* get charset the client sent and use it for connection auth */
charset = conn->charset;