Skip to content

Commit

Permalink
remove autoIndexId when autoIndexId and idIndex co-exists in create c…
Browse files Browse the repository at this point in the history
…ollection oplog. #400
  • Loading branch information
vinllen committed Aug 13, 2020
1 parent 5a1c74d commit bddf6db
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 5 additions & 0 deletions src/mongoshake/executor/db_writer.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,11 @@ func RunCommand(database, operation string, log *oplog.PartialLog, session *mgo.
case "dropDatabase":
err = dbHandler.DropDatabase()
case "create":
if oplog.GetKey(log.Object, "autoIndexId") != nil &&
oplog.GetKey(log.Object, "idIndex") != nil {
// exits "autoIndexId" and "idIndex", remove "autoIndexId"
log.Object = oplog.RemoveFiled(log.Object, "autoIndexId")
}
fallthrough
case "collMod":
fallthrough
Expand Down
2 changes: 0 additions & 2 deletions src/mongoshake/oplog/oplog.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import (
"fmt"
"encoding/json"

"github.com/gugemichael/nimo4go"
"github.com/vinllen/mgo/bson"

)
Expand Down Expand Up @@ -122,7 +121,6 @@ func GetKeyWithIndex(log bson.D, wanted string) (interface{}, int) {
}
}

nimo.Assert("you can't see me")
return nil, 0
}

Expand Down

0 comments on commit bddf6db

Please sign in to comment.