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
avoid concurrent processing for the same key
chrislu3148dec1f631
diff --git a/weed/mq/broker/broker_grpc_sub.go b/weed/mq/broker/broker_grpc_sub.goindex 7cbde21f86..b4475c525f 100644--- a/weed/mq/broker/broker_grpc_sub.go+++ b/weed/mq/broker/broker_grpc_sub.go@@ -162,6 +162,10 @@ func (b *MessageQueueBroker) SubscribeMessage(stream mq_pb.SeaweedMessaging_Subs// reset the sleep interval countsleepIntervalCount = 0+ for imt.IsInflight(logEntry.Key) {+ time.Sleep(137 * time.Millisecond)+ }+imt.InflightMessage(logEntry.Key, logEntry.TsNs)if err := stream.Send(&mq_pb.SubscribeMessageResponse{Message: &mq_pb.SubscribeMessageResponse_Data{diff --git a/weed/mq/sub_coordinator/inflight_message_tracker.go b/weed/mq/sub_coordinator/inflight_message_tracker.goindex f483354356..1b1caca00a 100644--- a/weed/mq/sub_coordinator/inflight_message_tracker.go+++ b/weed/mq/sub_coordinator/inflight_message_tracker.go@@ -67,6 +67,14 @@ func (imt *InflightMessageTracker) GetOldest() int64 {return imt.timestamps.Oldest()}+// IsInflight returns true if the message with the key is inflight.+func (imt *InflightMessageTracker) IsInflight(key []byte) bool {+ imt.mu.Lock()+ defer imt.mu.Unlock()+ _, found := imt.messages[string(key)]+ return found+}+// RingBuffer represents a circular buffer to hold timestamps.type RingBuffer struct {buffer []int64