SeaweedFS is a distributed storage system for object storage (S3), file systems, Iceberg table buckets, and Lance vector buckets, designed to handle billions of files with O(1) disk access and effortless horizontal scaling.
Go blob-storagecloud-drivedistributed-file-systemdistributed-storageerasure-codingfusehadoop-hdfshdfskuberneteslancelancedbobject-storageposixs3s3-storageseaweedfstiered-file-systemvector-search
ensure montonically increasing tsNs
Chris Lu4b7fa31468eb
diff --git a/weed/util/log_buffer/log_buffer.go b/weed/util/log_buffer/log_buffer.goindex 67c44dc578..b02c45b52f 100644--- a/weed/util/log_buffer/log_buffer.go+++ b/weed/util/log_buffer/log_buffer.go@@ -34,6 +34,7 @@ type LogBuffer struct {notifyFn func()isStopping boolflushChan chan *dataToFlush+ lastTsNs int64sync.RWMutex}@@ -64,8 +65,15 @@ func (m *LogBuffer) AddToBuffer(partitionKey, data []byte) {// need to put the timestamp inside the lockts := time.Now()+ tsNs := ts.UnixNano()+ if m.lastTsNs >= tsNs {+ // this is unlikely to happen, but just in case+ tsNs = m.lastTsNs + 1+ ts = time.Unix(0, tsNs)+ }+ m.lastTsNs = tsNslogEntry := &filer_pb.LogEntry{- TsNs: ts.UnixNano(),+ TsNs: tsNs,PartitionKeyHash: util.HashToInt32(partitionKey),Data: data,}