Renamed and improved the synchronous log flushing function.
This commit is contained in:
@ -3077,27 +3077,31 @@ static int find_last_seqno(
|
||||
/**
|
||||
* Flush all log files synchronously
|
||||
*/
|
||||
void skygw_log_force_flush_all(void)
|
||||
void skygw_log_sync_all(void)
|
||||
{
|
||||
int rval = 0, i;
|
||||
int i;
|
||||
bool nflushed = true;
|
||||
logfile_t* lf;
|
||||
|
||||
for (i = LOGFILE_FIRST; i <= LOGFILE_LAST; i <<= 1)
|
||||
|
||||
for (i = LOGFILE_FIRST; i <= LOGFILE_LAST; i <<= 1)
|
||||
{
|
||||
|
||||
bool nflushed = true;
|
||||
|
||||
lf = &lm->lm_logfile[(logfile_id_t)i];
|
||||
acquire_lock(&lf->lf_spinlock);
|
||||
lf->lf_flushflag = true;
|
||||
release_lock(&lf->lf_spinlock);
|
||||
skygw_message_send(lf->lf_logmes);
|
||||
|
||||
while(nflushed){
|
||||
acquire_lock(&lf->lf_spinlock);
|
||||
nflushed = lf->lf_flushflag;
|
||||
release_lock(&lf->lf_spinlock);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
skygw_message_send(lf->lf_logmes);
|
||||
|
||||
for (i = LOGFILE_FIRST; i <= LOGFILE_LAST; i <<= 1)
|
||||
{
|
||||
|
||||
while(nflushed)
|
||||
{
|
||||
acquire_lock(&lf->lf_spinlock);
|
||||
nflushed = lf->lf_flushflag;
|
||||
release_lock(&lf->lf_spinlock);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -113,7 +113,7 @@ void skygw_logmanager_exit(void);
|
||||
void skygw_log_done(void);
|
||||
int skygw_log_write(logfile_id_t id, const char* format, ...);
|
||||
int skygw_log_flush(logfile_id_t id);
|
||||
void skygw_log_force_flush_all(void);
|
||||
void skygw_log_sync_all(void);
|
||||
int skygw_log_rotate(logfile_id_t id);
|
||||
int skygw_log_write_flush(logfile_id_t id, const char* format, ...);
|
||||
int skygw_log_enable(logfile_id_t id);
|
||||
|
Reference in New Issue
Block a user