Description
We should defer only if an error isn't returned from the `GetIndexes` call. Reproduced when running against data lake:
$ mongodump -d test -c wild -umhuser -ppencil --authenticationDatabase admin -vvvv
|
2019-06-27T08:32:43.526-0400 initializing mongodump object
|
2019-06-27T08:32:43.527-0400 will listen for SIGTERM, SIGINT, and SIGKILL
|
2019-06-27T08:32:43.574-0400 starting Dump()
|
2019-06-27T08:32:44.857-0400 enqueued collection 'test.wild'
|
2019-06-27T08:32:44.857-0400 dump phase I: metadata, indexes, users, roles, version
|
2019-06-27T08:32:44.857-0400 reading indexes for `test.wild`
|
panic: runtime error: invalid memory address or nil pointer dereference
|
[signal SIGSEGV: segmentation violation code=0x1 addr=0x18 pc=0x14133e2]
|
|
goroutine 1 [running]:
|
github.com/mongodb/mongo-tools/vendor/go.mongodb.org/mongo-driver/mongo.(*Cursor).Close(0x0, 0x16c8760, 0xc00001a090, 0x0, 0x0)
|
/data/mci/40fb8f9904e99c7989355aabef2669e9/src/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/go.mongodb.org/mongo-driver/mongo/cursor.go:131 +0x22
|
github.com/mongodb/mongo-tools/mongodump.(*MongoDump).dumpMetadata(0xc000012960, 0xc000202360, 0x16c6120, 0xc0000100d0, 0x16be020, 0xc0000bc680)
|
/data/mci/40fb8f9904e99c7989355aabef2669e9/src/src/mongo/gotools/src/github.com/mongodb/mongo-tools/mongodump/metadata_dump.go:70 +0xf0e
|
github.com/mongodb/mongo-tools/mongodump.(*MongoDump).DumpMetadata(0xc000012960, 0x3, 0x1577475)
|
/data/mci/40fb8f9904e99c7989355aabef2669e9/src/src/mongo/gotools/src/github.com/mongodb/mongo-tools/mongodump/mongodump.go:813 +0xac
|
github.com/mongodb/mongo-tools/mongodump.(*MongoDump).Dump(0xc000012960, 0x0, 0x0)
|
/data/mci/40fb8f9904e99c7989355aabef2669e9/src/src/mongo/gotools/src/github.com/mongodb/mongo-tools/mongodump/mongodump.go:313 +0x684
|
main.main()
|
This panic also causes the underlying error to be hidden from the user.