|
Let's assume there is a collection with a TTL index that has frequently changed expireAfterSecs parameter (via collMod).
Now if initial sync is started on a secondary, it's possible to have the following sequence of events:
- Secondary creates the index during the oplog syncup stage:
[rsSync] replSet initial sync data copy, starting
|
[rsSync] oplog sync 1 of 3
|
...
|
[repl index builder 1] build index on: db.col properties: { v: 1, key: { date: 1 }, name: "date_1", ns: "db.col", expireAfterSeconds: 604800, background: true }
|
[repl index builder 1] building index in background
|
[repl index builder 1] build index done. scanned 128 total records. 0 secs
|
- The index gets altered on the primary again, and expireAfterSeconds is changed
- During the index clone stage the secondary tries to clone the altered index and fails:
[rsSync] replSet initial sync building indexes
|
...
|
[rsSync] replSet initial sync cloning indexes for : db
|
[rsSync] ERROR: error creating index when cloning spec: { key: { date: 1 }, name: "date_1", ns: "db.col", expireAfterSeconds: 173250, background: true } error: IndexOptionsConflict Index with name: date_1 already exists with different options
|
[rsSync] replSet initial sync exception: 85 Index with name: date_1 already exists with different options 9 attempts remaining
|
|