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

$$CLUSTER_TIME is influenced by the insertion of Timestamp(0,0)

    • Type: Icon: Bug Bug
    • Resolution: Unresolved
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 8.1.0-rc0
    • Component/s: None
    • None
    • Query Optimization
    • ALL
    • Hide
      db.ct.drop();
      db.ct.insert({a:1});
      
      # Error message is expected:
      db.ct.find({},{"a": "$$CLUSTER_TIME"});
      MongoServerError[Location51144]: Executor error during find command: test.ct :: caused by :: Builtin variable '$$CLUSTER_TIME' is not available
      
      db.other.drop();
      db.other.insertOne({a: Timestamp(0, 0)});
      
      # $$CLUSTER_TIME does not error out any longer.
      db.ct.find({},{"a": "$$CLUSTER_TIME"});
      [
        {
          _id: ObjectId('67ab337b3e3a0067eec77410'),
          a: Timestamp({ t: 1739273083, i: 1 })
        }
      ]
      
      # $$CLUSTER_TIME is 1739273083, as before
      db.ct.find({},{"a": "$$CLUSTER_TIME"});
      [
        {
          _id: ObjectId('67ab337b3e3a0067eec77410'),
          a: Timestamp({ t: 1739273083, i: 1 })
        }
      ]
      
      db.other.insertOne({a: Timestamp(0, 0)});
      
      # $$CLUSTER_TIME has now advanced
      db.ct.find({},{"a": "$$CLUSTER_TIME"});
      [
        {
          _id: ObjectId('67ab337b3e3a0067eec77410'),
          a: Timestamp({ t: 1739273084, i: 1 })
        }
      ]
      
      # $$CLUSTER_TIME is not advancing anymore
      db.ct.find({},{"a": "$$CLUSTER_TIME"});
      [
        {
          _id: ObjectId('67ab337b3e3a0067eec77410'),
          a: Timestamp({ t: 1739273084, i: 1 })
        }
      ]
      
       
      Show
      db.ct.drop(); db.ct.insert({a:1}); # Error message is expected: db.ct.find({},{ "a" : "$$CLUSTER_TIME" }); MongoServerError[Location51144]: Executor error during find command: test.ct :: caused by :: Builtin variable '$$CLUSTER_TIME' is not available db.other.drop(); db.other.insertOne({a: Timestamp(0, 0)}); # $$CLUSTER_TIME does not error out any longer. db.ct.find({},{ "a" : "$$CLUSTER_TIME" }); [   {     _id: ObjectId( '67ab337b3e3a0067eec77410' ),     a: Timestamp({ t: 1739273083, i: 1 })   } ] # $$CLUSTER_TIME is 1739273083, as before db.ct.find({},{ "a" : "$$CLUSTER_TIME" }); [   {     _id: ObjectId( '67ab337b3e3a0067eec77410' ),     a: Timestamp({ t: 1739273083, i: 1 })   } ] db.other.insertOne({a: Timestamp(0, 0)}); # $$CLUSTER_TIME has now advanced db.ct.find({},{ "a" : "$$CLUSTER_TIME" }); [   {     _id: ObjectId( '67ab337b3e3a0067eec77410' ),     a: Timestamp({ t: 1739273084, i: 1 })   } ] # $$CLUSTER_TIME is not advancing anymore db.ct.find({},{ "a" : "$$CLUSTER_TIME" }); [   {     _id: ObjectId( '67ab337b3e3a0067eec77410' ),     a: Timestamp({ t: 1739273084, i: 1 })   } ]
    • 200

      If I insert a Timestamp(0,0) value in some collection, the following things happen:

      1. If $$CLUSTER_TIME did not exist previously because it is not a replica set or a sharded cluster, it now exists.
      2. The value of $CLUSTER_TIME seems stuck to the time of the latest insertion of Timestamp(0,0) , until another such insertion occurs.

            Assignee:
            milena.ivanova@mongodb.com Milena Ivanova
            Reporter:
            philip.stoev@mongodb.com Philip Stoev
            Votes:
            0 Vote for this issue
            Watchers:
            7 Start watching this issue

              Created:
              Updated: