From ea2c6c41acd5a805cbf28d388fc137d2d9cf8b59 Mon Sep 17 00:00:00 2001 From: JP Phillips Date: Tue, 15 Aug 2017 16:38:22 -0500 Subject: [PATCH] refresh mgo session when the iter errors (#398) --- CHANGELOG.md | 1 + adaptor/mongodb/reader.go | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d44f896b9..662f37fa0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ ### Bugfixes - when using MongoDB as a source with tailing enabled and namespace filtering, it was possible for documents from others collections to be sent down the pipeline, fixed via [#386](https://github.com/compose/transporter/pull/386) +- if transporter lost connection to MongoDB while tailing the oplog, the connection never successfully reconnected, fixed via [#398](https://github.com/compose/transporter/pull/398) ## v0.3.1 [2017-03-24] diff --git a/adaptor/mongodb/reader.go b/adaptor/mongodb/reader.go index 5db27c887..e2001858d 100644 --- a/adaptor/mongodb/reader.go +++ b/adaptor/mongodb/reader.go @@ -292,7 +292,7 @@ func (r *Reader) tailCollection(c string, mgoSession *mgo.Session, oplogTime bso } if iter.Err() != nil { log.With("path", db).Errorf("error tailing oplog, %s", iter.Err()) - // return adaptor.NewError(adaptor.CRITICAL, m.path, fmt.Sprintf("MongoDB error (error reading collection %s)", iter.Err()), nil) + mgoSession.Refresh() } query = bson.M{"ts": bson.M{"$gte": oplogTime}}