diff --git a/src/github.com/mongodb/mongo-tools/mongorestore/oplog.go b/src/github.com/mongodb/mongo-tools/mongorestore/oplog.go index 91919aa..e50a7e1 100644 --- a/src/github.com/mongodb/mongo-tools/mongorestore/oplog.go +++ b/src/github.com/mongodb/mongo-tools/mongorestore/oplog.go @@ -108,11 +108,15 @@ func (restore *MongoRestore) RestoreOplog() error { if meta.IsTxn() { err := restore.HandleTxnOp(oplogCtx, meta, entryAsOplog) if err != nil { + // LoadNext to close readBufChan if demux goroutine is waiting on it in Close() + bsonSource.LoadNext() return fmt.Errorf("error handling transaction oplog entry: %v", err) } } else { err := restore.HandleNonTxnOp(oplogCtx, entryAsOplog) if err != nil { + // LoadNext to close readBufChan if demux goroutine is waiting on it in Close() + bsonSource.LoadNext() return fmt.Errorf("error applying oplog: %v", err) } }