diff options
author | Mihai Andrei <mihai.andrei@mongodb.com> | 2023-01-06 19:46:33 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2023-01-06 20:35:05 +0000 |
commit | 55efeeb9d858a5c93deaa7ca5f943ed97958a3ed (patch) | |
tree | 964790d1dbcb10cbd68a404e28cf5a95c44ae861 | |
parent | e264b20b47195185ac21f5ca591fca9cc91b1540 (diff) | |
download | mongo-55efeeb9d858a5c93deaa7ca5f943ed97958a3ed.tar.gz |
SERVER-72597 Adjust 'cursorSeeks' assertion in explain_operation_metrics.js
-rw-r--r-- | jstests/noPassthrough/explain_operation_metrics.js | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/jstests/noPassthrough/explain_operation_metrics.js b/jstests/noPassthrough/explain_operation_metrics.js index 741d286451c..65e5cbcb334 100644 --- a/jstests/noPassthrough/explain_operation_metrics.js +++ b/jstests/noPassthrough/explain_operation_metrics.js @@ -48,11 +48,14 @@ const runTest = (db) => { assert.eq(12, idxFindOperationMetrics.idxEntryBytesRead, idxFindResult); assert.eq(3, idxFindOperationMetrics.idxEntryUnitsRead, idxFindResult); - // The number of cursorSeeks can change depending on whether a yield has occurred. We - // account for this by incrementing the expected value by the number of calls to - // 'restoreState'. - const numAdditionalCursorSeeks = idxFindExecutionStats.executionStages.restoreState; - assert.eq(4 + numAdditionalCursorSeeks, idxFindOperationMetrics.cursorSeeks, idxFindResult); + // The number of cursorSeeks can change depending on whether a yield has occurred. Note + // however, that the number of calls to 'restoreState' represents an upper bound and not an + // exact number of cursor seeks. We therefore assert that the number of cursor seeks is at + // least the number of documents (3) plus the number of (non-yielding) index seeks (1), but + // is no greater than this quantity plus the number of calls to 'restoreState'. + const numRestoreStateCalls = idxFindExecutionStats.executionStages.restoreState; + assert.lte(4, idxFindOperationMetrics.cursorSeeks, idxFindResult); + assert.gte(4 + numRestoreStateCalls, idxFindOperationMetrics.cursorSeeks, idxFindResult); } }; |