Details
-
Task
-
Resolution: Fixed
-
Major - P3
-
None
-
None
-
None
-
Query 2018-03-26
-
(copied to CRM)
Description
$snapshot is being removed in MongoDB 4.0, SERVER-32174. As a workaround, hint the _id index:
diff --git a/src/mongo/gotools/common/db/command.go b/src/mongo/gotools/common/db/command.go
|
index f777d94..159bdfb 100644
|
--- a/src/mongo/gotools/common/db/command.go
|
+++ b/src/mongo/gotools/common/db/command.go
|
@@ -204,7 +204,9 @@ func (sp *SessionProvider) FindOne(db, collection string, skip int, query interf
|
// ApplyFlags applies flags to the given query session.
|
func ApplyFlags(q *mgo.Query, session *mgo.Session, flags int) *mgo.Query {
|
if flags&Snapshot > 0 {
|
- q = q.Snapshot()
|
+ // The snapshot option for find has been removed in the server, workaround by hinting the
|
+ // _id index instead.
|
+ q = q.Hint("_id")
|
}
|
if flags&LogReplay > 0 {
|
q = q.LogReplay()
|
diff --git a/src/mongo/gotools/mongodump/mongodump.go b/src/mongo/gotools/mongodump/mongodump.go
|
index 41b37e3..e05b83e 100644
|
--- a/src/mongo/gotools/mongodump/mongodump.go
|
+++ b/src/mongo/gotools/mongodump/mongodump.go
|
@@ -544,7 +544,7 @@ func (dump *MongoDump) DumpIntent(intent *intents.Intent, buffer resettableOutpu
|
// ---forceTablesScan runs the query without snapshot enabled
|
findQuery = session.DB(intent.DB).C(intent.C).Find(nil)
|
default:
|
- findQuery = session.DB(intent.DB).C(intent.C).Find(nil).Snapshot()
|
+ findQuery = session.DB(intent.DB).C(intent.C).Find(nil).Hint("_id")
|
}
|
|
var dumpCount int64
|
--
|
2.7.4
|
Attachments
Issue Links
- is depended on by
-
SERVER-32174 Remove old snapshot query option
-
- Closed
-
- is related to
-
TOOLS-2103 mongoexport uses deprecated snapshot query option
-
- Closed
-
- related to
-
TOOLS-1952 Use --forceTableScan by default when running against WiredTiger nodes
-
- Closed
-