improve robustness of binlog writer flow control

pull/6/head
YuQing 2023-07-27 10:49:25 +08:00
parent 6ce1a711f9
commit 024a6b0e8a
2 changed files with 5 additions and 3 deletions

View File

@ -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;

View File

@ -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;