send flush message to follower before shutting down logBuffer

This commit is contained in:
chrislu
2024-04-01 16:01:26 -07:00
parent e568e742c9
commit f07875e8e1
4 changed files with 41 additions and 1 deletions

View File

@@ -41,6 +41,16 @@ func (b *MessageQueueBroker) genLogFlushFunc(t topic.Topic, partition *mq_pb.Par
}
atomic.StoreInt64(&logBuffer.LastFlushTsNs, stopTime.UnixNano())
b.accessLock.Lock()
defer b.accessLock.Unlock()
p := topic.FromPbPartition(partition)
if localPartition:=b.localTopicManager.GetLocalPartition(t, p); localPartition!=nil {
localPartition.NotifyLogFlushed(logBuffer.LastFlushTsNs)
}
println("flushing at", logBuffer.LastFlushTsNs, "to", targetFile, "size", len(buf))
}
}