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

find command should reject $_internalReadAtClusterTime values less than afterClusterTime

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 4.7.0
    • Affects Version/s: 4.5.1
    • Component/s: None
    • None
    • Fully Compatible
    • ALL
    • Hide
      (function() {
      
      let rst = new ReplSetTest({nodes: 1});
      rst.startSet();
      rst.initiate();
      
      const primary = rst.getPrimary();
      const session = primary.startSession({causalConsistency: false});
      const db = session.getDatabase('test');
      assert.commandWorked(db.test.insert({a: 1}));
      
      let time1 = session.getOperationTime();
      
      assert.commandWorked(db.test.insert({a: 2}));
      let time2 = session.getOperationTime();
      
      // Crashes
      assert.commandWorked(assert.commandWorked(db.runCommand({
          find: 'test',
          $_internalReadAtClusterTime: time1,
          readConcern: {afterClusterTime: time2},
      })));
      
      rst.stopSet();
      })();
      
      Show
      ( function () { let rst = new ReplSetTest({nodes: 1}); rst.startSet(); rst.initiate(); const primary = rst.getPrimary(); const session = primary.startSession({causalConsistency: false }); const db = session.getDatabase( 'test' ); assert.commandWorked(db.test.insert({a: 1})); let time1 = session.getOperationTime(); assert.commandWorked(db.test.insert({a: 2})); let time2 = session.getOperationTime(); // Crashes assert.commandWorked(assert.commandWorked(db.runCommand({ find: 'test' , $_internalReadAtClusterTime: time1, readConcern: {afterClusterTime: time2}, }))); rst.stopSet(); })();
    • Execution Team 2020-06-15
    • 11

      I added an invariant on the master branch that fails when commands attempt to read at a timestamp that is less than the afterClusterTime readConcern argument, which is contradictory.

      "$_internalReadAtClusterTime" can specify any timestamp and afterClusterTime it wants, easily crashing the server with a simple request.

      We should reject find and getMore commands formed in this way. dbhash does not accept afterClusterTime.

            Assignee:
            louis.williams@mongodb.com Louis Williams
            Reporter:
            louis.williams@mongodb.com Louis Williams
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: