s3notification: lose the test lock on the fetch of the records' partition (#13324)

TestALeadThatLostItsLockDoesNotSend dropped the forwarder lock on the
first fetch of any partition, then waited for a fetch of partition 0.
When another partition's goroutine fetched first, the lead stopped before
partition 0 was fetched and the wait timed out (seen on the 32-bit job).
The hook now gets the request and drops the lock on partition 0's fetch.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Chris LuandClaude Opus 5.5 authored and GitHub committed 2026-12-02 23:47:50 -08:00
1 parent 1606fe4f39
commit 515b905011
2 files changed
+7 -4

No files matched your search

+6 -3
View File
@@ -148,7 +148,7 @@ func (b *fakeBroker) FetchMessage(ctx context.Context, req *mq_pb.FetchMessageRe
hook := b.onFetch
b.mu.Unlock()
if hook != nil {
hook()
hook(req)
}
b.mu.Lock()
defer b.mu.Unlock()
@@ -1235,8 +1235,11 @@ func TestALeadThatLostItsLockDoesNotSend(t *testing.T) {
s.broker.appendRecords("a", "b")
var once sync.Once
s.broker.mu.Lock()
s.broker.onFetch = func() {
once.Do(func() { s.locks.holder(ForwarderLockPrefix + "lost").held.Store(false) })
s.broker.onFetch = func(req *mq_pb.FetchMessageRequest) {
// another partition can fetch first, so lose the lock on the records' one
if req.Partition.RangeStart == 0 {
once.Do(func() { s.locks.holder(ForwarderLockPrefix + "lost").held.Store(false) })
}
}
s.broker.mu.Unlock()
s.forwarder(t, "gw1").Sync(s.registry(t, "lost"))
+1 -1
View File
@@ -507,7 +507,7 @@ type fakeBroker struct {
holding bool
holdAt int64
// onFetch runs as a fetch arrives
onFetch func()
onFetch func(req *mq_pb.FetchMessageRequest)
// fetchErrorCode, when set, answers every fetch with that broker error, as a broker that cannot read the files does
fetchErrorCode int32
}