mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2026-12-06 11:07:31 +01:00
mq broker test: wait for the follower's ack before retiring the leader (#13490)
TestRetiredLeaderClosesItsFollowerOnlyWhenAllIsStored retired the partition right after an unacked publish. When the abandon closed the client connection before gRPC's writer goroutine had sent the follow stream's headers, the transport refused to start the stream, so the follower never saw it and could not report it broken. A publisher only gets its ack once the follower holds the entry, so wait for that ack as well. Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
6820fdafea
commit
02f4c8dfe0
1 file changed
+6
-1
@@ -409,7 +409,12 @@ func TestRetiredLeaderClosesItsFollowerOnlyWhenAllIsStored(t *testing.T) {
|
||||
lp := topic.NewLocalPartition(fenceTestPartition, 3600, flush, nil)
|
||||
lp.Replica = startReplica(t, addr)
|
||||
manager.AddLocalPartition(fenceTestTopic, lp)
|
||||
if _, err := lp.PublishWithOffset(&mq_pb.DataMessage{Key: []byte("k"), Value: []byte("v"), TsNs: time.Now().UnixNano()}); err != nil {
|
||||
offset, err := lp.PublishWithOffset(&mq_pb.DataMessage{Key: []byte("k"), Value: []byte("v"), TsNs: time.Now().UnixNano()})
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
// as before a publish is acked; a stream closed before it is sent never reaches the follower
|
||||
if err := lp.Replica.WaitAcked(offset); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
manager.RemoveLocalPartition(fenceTestTopic, lp)
|
||||
|
||||
Reference in new issue
Block a user