Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-17497

Initial sync can fail due to frequently altered TTL index

    • Type: Icon: Bug Bug
    • Resolution: Duplicate
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 2.6.8
    • Component/s: Replication
    • Labels:
      None
    • ALL

      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:

      1. 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
        
      2. The index gets altered on the primary again, and expireAfterSeconds is changed
      3. 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
        

            Assignee:
            Unassigned Unassigned
            Reporter:
            alex.komyagin@mongodb.com Alexander Komyagin (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            7 Start watching this issue

              Created:
              Updated:
              Resolved: