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

InitSync should drop the collection if _id index is dropped

    • Type: Icon: Improvement Improvement
    • Resolution: Duplicate
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • None
    • Replication
    • 200

      As seen in BF-34058, if any error is encountered during the collection cloning phase (example: NSS resolution errors) of InitSync the indexes (including the _id index) are dropped but not the collection.

      [js_test:resharding_abort_command] d21318| 2024-07-08T04:56:04.547+00:00 D2 INITSYNC 21147   [S] [ReplCoordExtern-0] "Allowing cloning of collectionInfo","attr":
      {
          info: {
              name: "analyzeShardKeySplitPoints",
              type: "collection",
              options: {},
              info: {
                  readOnly: false,
                  uuid: {
                      $uuid: "831f607d-f914-4a17-9743-43d0be072587"
                  }
              },
              idIndex: {
                  v: 2,
                  key: {
                      _id: 1
                  },
                  name: "_id_"
              }
          }
      [js_test:resharding_abort_command] d21318| 2024-07-08T04:56:04.588+00:00 I  STORAGE  20320   [S] [ReplCoordExtern-0] "createCollection","attr":
      {
          namespace: "config.analyzeShardKeySplitPoints",
          uuidDisposition: "provided",
          uuid: {
              uuid: {
                  $uuid: "831f607d-f914-4a17-9743-43d0be072587"
              }
          },
          options: {
              uuid: {
                  $uuid: "831f607d-f914-4a17-9743-43d0be072587"
              }
          }
      }
      [js_test:resharding_abort_command] d21318| 2024-07-08T04:56:04.591+00:00 I  INDEX    20384   [S] [ReplCoordExtern-0] "Index build: starting","attr":
      {
          buildUUID: null,
          collectionUUID: {
              uuid: {
                  $uuid: "831f607d-f914-4a17-9743-43d0be072587"
              }
          },
          namespace: "config.analyzeShardKeySplitPoints",
          properties: {
              v: 2,
              key: {
                  expireAt: 1
              },
              name: "AnalyzeShardKeySplitPointsTTLIndex",
              expireAfterSeconds: 0
          },
          specIndex: 0,
          numSpecs: 1,
          method: "Foreground",
          ident: "index-31-2677140698021578913",
          collectionIdent: "collection-30-2677140698021578913",
          maxTemporaryMemoryUsageMB: 200
      }
      [js_test:resharding_abort_command] d21318| 2024-07-08T04:56:04.592+00:00 I  INDEX    20384   [S] [ReplCoordExtern-0] "Index build: starting","attr":
      {
          buildUUID: null,
          collectionUUID: {
              uuid: {
                  $uuid: "831f607d-f914-4a17-9743-43d0be072587"
              }
          },
          namespace: "config.analyzeShardKeySplitPoints",
          properties: {
              v: 2,
              key: {
                  _id: 1
              },
              name: "_id_"
          },
          specIndex: 0,
          numSpecs: 1,
          method: "Foreground",
          ident: "index-32-2677140698021578913",
          collectionIdent: "collection-30-2677140698021578913",
          maxTemporaryMemoryUsageMB: 200
      }
      ...
      [js_test:resharding_abort_command] d21318| 2024-07-08T04:56:04.593+00:00 I  INITSYNC 21132   [S] [ReplCoordExtern-0] "CollectionCloner stopped because collection was dropped on source","attr":
      {
          namespace: "config.analyzeShardKeySplitPoints",
          uuid: {
              uuid: {
                  $uuid: "831f607d-f914-4a17-9743-43d0be072587"
              }
          }
      }
      
      Dropping of only the indexes:
      
      [js_test:resharding_abort_command] d21318| 2024-07-08T04:56:04.593+00:00 I  STORAGE  22206   [S] [ReplCoordExtern-0] "Deferring table drop for index","attr":
      {
          index: "AnalyzeShardKeySplitPointsTTLIndex",
          namespace: "config.analyzeShardKeySplitPoints",
          uuid: {
              uuid: {
                  $uuid: "831f607d-f914-4a17-9743-43d0be072587"
              }
          },
          ident: "index-31-2677140698021578913",
          dropTime: {
              checkpointIteration: "0"
          }
      }
      [js_test:resharding_abort_command] d21318| 2024-07-08T04:56:04.593+00:00 I  STORAGE  22206   [S] [ReplCoordExtern-0] "Deferring table drop for index","attr":
      {
          index: "_id_",
          namespace: "config.analyzeShardKeySplitPoints",
          uuid: {
              uuid: {
                  $uuid: "831f607d-f914-4a17-9743-43d0be072587"
              }
          },
          ident: "index-32-2677140698021578913",
          dropTime: {
              checkpointIteration: "0"
          }
      }

      This causes issues during the oplog application phase where we see a "create" oplog entry (which contains the _id index creation) but the oplog application fails since the collection already exists. This leads to the scenario where a collection's _id index is missing and may result in data corruption.

            Assignee:
            Unassigned Unassigned
            Reporter:
            nandini.bhartiya@mongodb.com Nandini Bhartiya
            Votes:
            0 Vote for this issue
            Watchers:
            11 Start watching this issue

              Created:
              Updated:
              Resolved: