Uploaded image for project: 'Documentation'
  1. Documentation
  2. DOCS-10777

3.2 users reading 3.4 version of createIndex should be warned specifying collation is a silent, but upgrade-blocking, error.

    • Type: Icon: Task Task
    • Resolution: Fixed
    • Priority: Icon: Critical - P2 Critical - P2
    • None
    • Affects Version/s: None
    • Component/s: None
    • Labels:
      None

      A 3.2 user can create an index with a "collation" option. It succeeds, even though collation is not supported in 3.2. I.e. it seems to be silently ignored.

      Unable to find source-code formatter for language: txt. Available languages are: actionscript, ada, applescript, bash, c, c#, c++, cpp, css, erlang, go, groovy, haskell, html, java, javascript, js, json, lua, none, nyan, objc, perl, php, python, r, rainbow, ruby, scala, sh, sql, swift, visualbasic, xml, yaml
      2017-09-12T12:42:10.774+1000 I CONTROL  [initandlisten] MongoDB starting : pid=5962 port=27017 dbpath=/tmp/data 64-bit host=10gensyd2
      2017-09-12T12:42:10.774+1000 I CONTROL  [initandlisten] db version v3.2.10
      ...
      2017-09-12T12:53:19.782+1000 I NETWORK  [initandlisten] connection accepted from 127.0.0.1:36858 #2 (1 connection now open)
      2017-09-12T13:06:16.784+1000 I INDEX    [conn2] build index on: product.foo properties: { v: 1, key: { orderDate: 1.0, category: 1.0 }, name: "date_category_fr", ns: "product.foo", collation: { locale: "fr", strength: 2.0 } }
      2017-09-12T13:06:16.784+1000 I INDEX    [conn2]          building index using bulk method
      2017-09-12T13:06:16.785+1000 I INDEX    [conn2] build index done.  scanned 0 total records. 0 secs
      

      The problem is when they upgrade 3.4. As they do an in-place, binary-version only upgrade the 3.4 mongod will not be running in "3.4" feature compatibility mode at first. In this mode it strictly checks that indexes are 3.2 compatible, and exits with "Fatal Assertion 28782" when it finds the index with the collation:

      Unable to find source-code formatter for language: txt. Available languages are: actionscript, ada, applescript, bash, c, c#, c++, cpp, css, erlang, go, groovy, haskell, html, java, javascript, js, json, lua, none, nyan, objc, perl, php, python, r, rainbow, ruby, scala, sh, sql, swift, visualbasic, xml, yaml
      2017-09-12T13:34:31.762+1000 I CONTROL  [initandlisten] MongoDB starting : pid=6705 port=27017 dbpath=/tmp/data 64-bit host=10gensyd2
      2017-09-12T13:34:31.762+1000 I CONTROL  [initandlisten] db version v3.4.1-126-gdd491eeb54
      ...
      2017-09-12T13:34:31.933+1000 F INDEX    [initandlisten] Found an invalid index { v: 1, key: { orderDate: 1.0, category: 1.0 }, name: "date_category_fr", ns: "product.foo", collation: { locale: "fr", strength: 2.0 } } on the product.foo collection: CannotCreateIndex: Index version v=1 does not support the 'collation' option
      2017-09-12T13:34:31.933+1000 I -        [initandlisten] Fatal Assertion 28782 at src/mongo/db/catalog/index_catalog.cpp 144
      2017-09-12T13:34:31.933+1000 I -        [initandlisten]
      
      ***aborting after fassert() failure
      

      I think we should add a warning, in only the 3.4 version of documentation, at the following section. https://docs.mongodb.com/manual/reference/method/db.collection.createIndex/#option-for-collation

      E.g. 'Warning: 3.2 users should not specify collation option - it will be silently accepted but then block the upgrade to 3.4'

            Assignee:
            kay.kim@mongodb.com Kay Kim (Inactive)
            Reporter:
            akira.kurogane Akira Kurogane
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved:
              5 years, 38 weeks, 2 days ago