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

Duplicate index because of deprecation of background

    • Type: Icon: Bug Bug
    • Resolution: Works as Designed
    • Priority: Icon: Minor - P4 Minor - P4
    • None
    • Affects Version/s: None
    • Component/s: Index Maintenance
    • Labels:
      None
    • ALL
    • Hide

      Example: runing db.test.createIndex({'a.b': 1}, {background: true});

      Index existing in 4.0

       

      {
        "v" : 2,
        "key" : {
          "a.b" : NumberLong(1)
        },
        "name" : "a_b_1",
        "ns" : "test.test"
      },
      

      Running db.test.createIndex({'a.b': 1}, {background: true}); is valid, and produces "all indexes already exist"

       

      Same index, running db.test.createIndex({'a.b': 1}, {background: true});  in mongo 4.2 produces "Index with name: a.b_1 already exists with a different name"

       

      Note the name using a period instead of an underscore

      Show
      Example: runing db.test.createIndex({'a.b': 1}, {background: true}); Index existing in 4.0   { "v" : 2, "key" : { "a.b" : NumberLong(1) }, "name" : "a_b_1" , "ns" : "test.test" }, Running db.test.createIndex({'a.b': 1}, {background: true}); is valid, and produces "all indexes already exist"   Same index, running db.test.createIndex({'a.b': 1}, {background: true});  in mongo 4.2 produces "Index with name: a.b_1 already exists with a different name"   Note the name using a period instead of an underscore

      After upgrading to mongo 4.2 and running an "install" script on an application, I started getting some errors in regards to "Index with name: INDEX_NAME already exists with a different name"

      The problem appears to be that related to index names (at some point in mongo's past, automatic index naming used an underscore to delineate field names, for example "a_b_1" instead of "a.b_1" for an index created on {'a.b': 1} and the background flag.

       

      This isn't a big deal to me, I will just manually recreate indexes, but I did think it was a problem worth mentioning in case it ties to something else.

       

       

       

            Assignee:
            carl.champain@mongodb.com Carl Champain (Inactive)
            Reporter:
            ben@ethika.com Ben Rotz
            Votes:
            0 Vote for this issue
            Watchers:
            9 Start watching this issue

              Created:
              Updated:
              Resolved: