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

Expect command errors in validation when querying $collStats, and improve the error message

    • Type: Icon: Task Task
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 7.0.0-rc0, 4.4.20, 5.0.16, 6.0.6, 6.3.1
    • Affects Version/s: None
    • Component/s: None
    • Labels:
    • Fully Compatible
    • v6.3, v6.0, v5.0, v4.4
    • Execution Team 2023-03-20
    • 18

      In production this is fine, validate will just log a message, though ideally the log doesn't talk about expecting a cursor to be present. In our testing environments, the command failure should be handled before escalating to an invariant

      [conn69] "Invariant failure","attr":{"expr":"!collStatsResult.getObjectField(\"cursor\").isEmpty() && !collStatsResult.getObjectField(\"cursor\").getObjectField(\"firstBatch\").isEmpty()","msg":"Expected a cursor to be present in the $collStats results: { ok: 0.0, errmsg: \"PlanExecutor error during aggregation :: caused by :: Unable to retrieve count in $collStats stage :: caused by :: Collection [test.capped1] not found.\", code: 26, codeName: \"NamespaceNotFound\", $clusterTime: { clusterTime: Timestamp(1678833862, 262), signature: { hash: BinData(0, 0000000000000000000000000000000000000000), keyId: 0 } }, operationTime: Timestamp(1678833862, 262) }","file":"src/mongo/db/commands/validate.cpp","line":90}
      [conn69] "\n\n***aborting after invariant() failure\n\n"

            dianna.hohensee@mongodb.com Dianna Hohensee (Inactive)
            dianna.hohensee@mongodb.com Dianna Hohensee (Inactive)
            0 Vote for this issue
            3 Start watching this issue