diff --git a/src/sf_binlog_writer.c b/src/sf_binlog_writer.c index 3de5770..f809070 100644 --- a/src/sf_binlog_writer.c +++ b/src/sf_binlog_writer.c @@ -632,8 +632,10 @@ void sf_push_to_binlog_write_queue(SFBinlogWriterInfo *writer, int64_t last_timestamp; last_timestamp = FC_ATOMIC_GET(writer->thread->flow_ctrol.last_timestamp); - if (last_timestamp > 0 && g_current_time - last_timestamp > - writer->thread->flow_ctrol.max_delay) + if ((last_timestamp > 0 && g_current_time - last_timestamp > writer-> + thread->flow_ctrol.max_delay) && !(writer->order_by == + SF_BINLOG_WRITER_TYPE_ORDER_BY_VERSION && buffer-> + version.first - writer->version_ctx.next < 128)) { time_t start_time; time_t last_log_timestamp; diff --git a/src/sf_binlog_writer.h b/src/sf_binlog_writer.h index 9d7c5b6..c01f13c 100644 --- a/src/sf_binlog_writer.h +++ b/src/sf_binlog_writer.h @@ -89,7 +89,7 @@ typedef struct sf_binlog_writer_info { struct { SFBinlogWriterBufferRing ring; - int64_t next; + volatile int64_t next; int64_t change_count; //version change count } version_ctx; SFBinlogWriterThread *thread;