Sharded change stream open blocks ~1s (periodicNoopIntervalSecs?) before returning the first batch

    • Type: Bug
    • Resolution: Unresolved
    • Priority: Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • None
    • Query Execution
    • ALL
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      On a latest (9.0.0-alpha0-d6d27ec8) sharded cluster, opening a change stream and issuing:

      {aggregate: 1, pipeline: [{$changeStream: …}], cursor: {}}
      

      returns its first (empty) batch after a delay that differs by server version:

      • 8.3 sharded: ~5–13ms, every time (6/6).
      • latest sharded: ~1.0s (driver evergreen tools sets periodicNoopIntervalSecs=1 🤷), most of the time (~5/6; the rest ~10ms).

      The slow case still succeeds, returning an empty firstBatch and a postBatchResumeToken after ~1.0s. It's not an error from the server, but is a delay.

      Repro:

        for (let i = 0; i < 6; i++) {
          const t0 = Date.now();
          const r = db.getSiblingDB("admin").runCommand({
            aggregate: 1,
            pipeline: [{ $changeStream: { allChangesForCluster: true } }],
            cursor: {}
          });
          print(`open #${i}: ${Date.now() - t0}ms  ok=${r.ok}  firstBatch=${r.cursor.firstBatch.length}`);
          sleep(250);
        }
      

            Assignee:
            Unassigned
            Reporter:
            Preston Vasquez
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: