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

dropxIndexes command suppresses write concern errors.

    • Type: Icon: Bug Bug
    • Resolution: Unresolved
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • None
    • Catalog and Routing
    • ALL

      On master, the dropIndexes suppresses writeConcern errors.

      Successful execution of the dropIndexes command:

        1 {
        2     "nIndexesWas" : 2,
        3     "ok" : 1,
        4     "raw" : {
        5             "mongos_noop_writes_wait_for_write_concern-rs0/ip-10-122-1-7:20043,ip-10-122-1-7:20044,ip-10-122-1-7:20045" : {
        6                     "nIndexesWas" : 2,
        7                     "ok" : 1
        8             }
        9     },
       10     "$clusterTime" : {
       11             "clusterTime" : Timestamp(1731848532, 1),
       12             "signature" : {
       13                     "hash" : BinData(0,"AAAAAAAAAAAAAAAAAAAAAAAAAAA="),
       14                     "keyId" : NumberLong(0)
       15             }
       16     },
       17     "operationTime" : Timestamp(1731848532, 1)
       18 }

       

      Note the writeConcern error in case of a successful execution of createIndexes:

        1 {
        2     "numIndexesBefore" : 1,
        3     "numIndexesAfter" : 2,
        4     "createdCollectionAutomatically" : false,
        5     "commitQuorum" : "majority",
        6     "writeConcernError" : {
        7             "code" : 64,
        8             "codeName" : "WriteConcernFailed",
        9             "errmsg" : "waiting for replication timed out",
       10             "errInfo" : {
       11                     "wtimeout" : true,
       12                     "writeConcern" : {
       13                             "w" : 3,
       14                             "wtimeout" : 1000,
       15                             "provenance" : "clientSupplied"
       16                     }
       17             }
       18 },

       

       

      In v5.0, on retrying a dropIndexes command (due to some transient error), write concern errors may be suppressed by a write error such as "IndexNotFound", and a user may mistakenly believe that the dropIndexes command was executed successfully on a majority of nodes; when in fact this dropIndexes action can be rolled back.
       
      The response on running a dropIndexes command in v5.0 contains the wCE when the index is first dropped:

        1 {
        2     "raw" : {
        3             "mongos_noop_writes_wait_for_write_concern-rs0/ip-10-122-1-7:20020,ip-10-122-1-7:20021,ip-10-122-1-7:20022" : {
        4                     "nIndexesWas" : 2,
        5                     "writeConcernError" : {
        6                             "code" : 64,
        7                             "codeName" : "WriteConcernFailed",
        8                             "errmsg" : "waiting for replication timed out",
        9                             "errInfo" : {
       10                                     "wtimeout" : true,
       11                                     "writeConcern" : {
       12                                             "w" : 3,
       13                                             "wtimeout" : 1000,
       14                                             "provenance" : "clientSupplied"
       15                                     }
       16                             }
       17                     },
       18                     "ok" : 1
       19             }
       20     },

      On retrying the dropIndexes command:

       1 {
        2     "raw" : {
        3             "mongos_noop_writes_wait_for_write_concern-rs0/ip-10-122-1-7:20020,ip-10-122-1-7:20021,ip-10-122-1-7:20022" : {
        4                     "ok" : 0,
        5                     "errmsg" : "can't find index with key: { a: 1.0 }",
        6                     "code" : 27,
        7                     "codeName" : "IndexNotFound"
        8             }
        9     },
       10     "code" : 27,
       11     "codeName" : "IndexNotFound",
       12     "ok" : 0,
       13     "errmsg" : "can't find index with key: { a: 1.0 }",
       14     "$clusterTime" : {
       15             "clusterTime" : Timestamp(1731597701, 1),
       16             "signature" : {
       17                     "hash" : BinData(0,"AAAAAAAAAAAAAAAAAAAAAAAAAAA="),
       18                     "keyId" : NumberLong(0)
       19             }
       20     },
       21     "operationTime" : Timestamp(1731597701, 1)
       22 }

      Response when a createIndexes command (contains the wCE) is retried:

      {
        2      "raw" : {
        3              "mongos_noop_writes_wait_for_write_concern-rs0/ip-10-122-1-7:20020,ip-10-122-1-7:20021,ip-10-122-1-7:20022" : {
        4                      "numIndexesBefore" : 2,
        5                      "numIndexesAfter" : 2,
        6                      "note" : "all indexes already exist",
        7                      "writeConcernError" : {
        8                              "code" : 64,
        9                              "codeName" : "WriteConcernFailed",
       10                              "errmsg" : "waiting for replication timed out",
       11                              "errInfo" : {
       12                                      "wtimeout" : true,
       13                                      "writeConcern" : {
       14                                              "w" : 3,
       15                                              "wtimeout" : 1000,
       16                                              "provenance" : "clientSupplied"
       17                                      }
       18                              }
       19                      },
       20                      "ok" : 1
       21              }
       22      },
       23      "writeConcernError" : {
       24              "code" : 64,
       25              "codeName" : "WriteConcernFailed",
       26              "errmsg" : "waiting for replication timed out; Error details: { wtimeout: true, writeConcern: { w: 3, wtimeout: 1000, provenance: \"clientSupplied\" } } at mongos_noop_wri      tes_wait_for_write_concern-rs0",
       27              "errInfo" : {
       28                      "wtimeout" : true,
       29                      "writeConcern" : {
       30                              "w" : 3,
       31                              "wtimeout" : 1000,
       32                              "provenance" : "clientSupplied"
       33                      }
       34              }
       35      },
       36      "ok" : 1,
       37      "$clusterTime" : {
       38              "clusterTime" : Timestamp(1731597700, 6),
       39              "signature" : {
       40                      "hash" : BinData(0,"AAAAAAAAAAAAAAAAAAAAAAAAAAA="),
       41                      "keyId" : NumberLong(0)
       42              }
       43      },
       44      "operationTime" : Timestamp(1731597700, 6)
       45  }

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

              Created:
              Updated: