summaryrefslogtreecommitdiff
path: root/storage/maria/ma_loghandler.c
diff options
context:
space:
mode:
authorunknown <sanja@askmonty.org>2009-03-17 21:05:01 +0200
committerunknown <sanja@askmonty.org>2009-03-17 21:05:01 +0200
commit36252821b3ca0e2af0064dfeee6ed7b3fff14e4f (patch)
tree61ef5204deb8c31f538c5a987083dd97623e8da8 /storage/maria/ma_loghandler.c
parentc97f25a02fe4fc4033b285f54663f6fe4ecdcc7c (diff)
downloadmariadb-git-36252821b3ca0e2af0064dfeee6ed7b3fff14e4f.tar.gz
Fixed bug of waiting for flush pass end.
storage/maria/ma_loghandler.c: Fixed bug of waiting for flush pass end: in case of two sequential flushes waiting thread can not detect end of the pass it is waiting because till the time it will check the flush in progress flag will be set on again. Solution is to have pass number and compare the number before before waits start and check it as condition of the flush pass end (of course it does not matter if the counter of pass number overflows).
Diffstat (limited to 'storage/maria/ma_loghandler.c')
-rw-r--r--storage/maria/ma_loghandler.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/storage/maria/ma_loghandler.c b/storage/maria/ma_loghandler.c
index 545019ffb57..6fc15186fcd 100644
--- a/storage/maria/ma_loghandler.c
+++ b/storage/maria/ma_loghandler.c
@@ -333,6 +333,8 @@ struct st_translog_descriptor
my_bool is_everything_flushed;
/* True when flush pass is in progress */
my_bool flush_in_progress;
+ /* The flush number (used to distinguish two flushes goes one by one) */
+ volatile int flush_no;
/* Next flush pass variables */
TRANSLOG_ADDRESS next_pass_max_lsn;
pthread_t max_lsn_requester;
@@ -3484,6 +3486,8 @@ my_bool translog_init_with_table(const char *directory,
id_to_share= NULL;
log_descriptor.directory_fd= -1;
log_descriptor.is_everything_flushed= 1;
+ log_descriptor.flush_in_progress= 0;
+ log_descriptor.flush_no= 0;
log_descriptor.next_pass_max_lsn= LSN_IMPOSSIBLE;
(*init_table_func)();
@@ -7548,6 +7552,7 @@ void translog_flush_wait_for_end(LSN lsn)
void translog_flush_set_new_goal_and_wait(TRANSLOG_ADDRESS lsn)
{
+ int flush_no= log_descriptor.flush_no;
DBUG_ENTER("translog_flush_set_new_goal_and_wait");
DBUG_PRINT("enter", ("LSN: (%lu,0x%lx)", LSN_IN_PARTS(lsn)));
safe_mutex_assert_owner(&log_descriptor.log_flush_lock);
@@ -7556,7 +7561,7 @@ void translog_flush_set_new_goal_and_wait(TRANSLOG_ADDRESS lsn)
log_descriptor.next_pass_max_lsn= lsn;
log_descriptor.max_lsn_requester= pthread_self();
}
- while (log_descriptor.flush_in_progress)
+ while (flush_no == log_descriptor.flush_no)
{
pthread_cond_wait(&log_descriptor.log_flush_cond,
&log_descriptor.log_flush_lock);
@@ -7735,6 +7740,7 @@ out:
if (sent_to_disk != LSN_IMPOSSIBLE)
log_descriptor.flushed= sent_to_disk;
log_descriptor.flush_in_progress= 0;
+ log_descriptor.flush_no++;
DBUG_PRINT("info", ("flush_in_progress is dropped"));
pthread_mutex_unlock(&log_descriptor.log_flush_lock);\
pthread_cond_broadcast(&log_descriptor.log_flush_cond);