Skip to content

Commit 9eacb63

Browse files
committed
Prevent WritesOff from hanging when the change stream has failed.
1 parent c21b9f5 commit 9eacb63

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

internal/verifier/migration_verifier.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,11 @@ func (verifier *Verifier) WritesOff(ctx context.Context) error {
261261
// This has to happen under the lock because the change stream
262262
// might be inserting docs into the recheck queue, which happens
263263
// under the lock.
264-
verifier.changeStreamWritesOffTsChan <- finalTs
264+
select {
265+
case verifier.changeStreamWritesOffTsChan <- finalTs:
266+
case err := <-verifier.changeStreamErrChan:
267+
return errors.Wrap(err, "tried to send writes-off timestamp to change stream, but change stream already failed")
268+
}
265269
} else {
266270
verifier.mux.Unlock()
267271
}

0 commit comments

Comments
 (0)