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

update7.js is not resilient to ObjectID wraparound

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 5.1.0-rc0
    • Component/s: None
    • Labels:
      None
    • Backwards Compatibility:
      Fully Compatible
    • Operating System:
      ALL
    • Sprint:
      Execution Team 2021-07-26
    • Linked BF Score:
      20

      Description

      The udpate7 test asserts that the documents with 'x' values 1,2,3, inserted in that order, return in the same order when sorted by _id.

      function s() {
          return t.find().sort({_id: 1}).map(function(z) {
              return z.x;
          });
      }
      // snip
      t.save({x: 1});
      t.save({x: 2});
      t.save({x: 3});
       
      t.createIndex({x: 1});
       
      assert.eq("1,2,3", s(), "F1");
      

      This test fails if the _id increment happens to wrap around in the same second that all 3 documents are inserted.

        Attachments

          Activity

            People

            Assignee:
            yuhong.zhang Yuhong Zhang
            Reporter:
            louis.williams Louis Williams
            Participants:
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: