mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2026-12-05 02:27:26 +01:00
replication: the redial control waits for the dropped connection
The control slept a fixed time and could pass with no connection accepted and dropped. It now waits for the listener's accept-then-drop and fails if none happened; without the transport fix it fails at the store assertion. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
353df5993e
commit
cd0d17bcd8
1 file changed
+11
-1
@@ -123,6 +123,7 @@ func TestStoreLearnerRedialsAfterABrokenConnection(t *testing.T) {
|
||||
t.Fatal(err)
|
||||
}
|
||||
addr := drop.Addr().String()
|
||||
dropped := make(chan struct{}, 64)
|
||||
go func() {
|
||||
for {
|
||||
c, err := drop.Accept()
|
||||
@@ -130,6 +131,10 @@ func TestStoreLearnerRedialsAfterABrokenConnection(t *testing.T) {
|
||||
return
|
||||
}
|
||||
_ = c.Close() // connected, then the read fails
|
||||
select {
|
||||
case dropped <- struct{}{}:
|
||||
default:
|
||||
}
|
||||
}
|
||||
}()
|
||||
v := NewReplicationVolume("v", storage.NewBlockStore(64, 4096))
|
||||
@@ -138,7 +143,12 @@ func TestStoreLearnerRedialsAfterABrokenConnection(t *testing.T) {
|
||||
if err := v.UpdateReplicaSet(1, []ReplicaTarget{{ReplicaID: "r2", DataAddr: addr, ControlAddr: addr, Epoch: 1, EndpointVersion: 1}}); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
time.Sleep(400 * time.Millisecond) // a few connected, failed attempts
|
||||
// The learner did hold a connection whose read failed.
|
||||
select {
|
||||
case <-dropped:
|
||||
case <-time.After(10 * time.Second):
|
||||
t.Fatal("no learner barrier was accepted and dropped: the schedule did not run")
|
||||
}
|
||||
_ = drop.Close()
|
||||
|
||||
s, err := storage.CreateWALStore(filepath.Join(t.TempDir(), "r2.wal"), 64, 4096)
|
||||
|
||||
Reference in new issue
Block a user