Create a property-based test for collections clustered on _id

    • Type: Task
    • Resolution: Unresolved
    • Priority: Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • None
    • Storage Execution
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      Create a property-based test for collections clustered on _id that specifically stresses clustered-only edge cases around _id encoding, duplicate-key handling, and lookup semantics. This should complement the broader regular-vs-clustered equivalence work proposed in SERVER-127218 by focusing on failure modes that are unique to clustered-on-_id collections.

      Clustered collections are materially different from regular collections: documents are stored in _id order, the clustered key must be {_id: 1}, and the collection uses the clustered key as the storage ordering rather than maintaining a separate _id index file.

      Because of that, clustered collections have clustered-specific correctness risks around how id values are encoded and how lookups and duplicate detection behave. We have already seen a concrete example: duplicate insert on a clustered collection with Decimal128 in _id could throw an internal _KeyString format error instead of a normal DuplicateKey error (SERVER-128392). The root cause was specific to the clustered collection duplicate-key path and the fact that clustered RecordIds are derived from _id encoding.

      A PBT is a good fit here because these bugs are driven by unusual _id shapes and operation sequences that are hard to cover exhaustively with example-based tests. The internal PBT primer also recommends fast-check for JSTests and shows how shrinking and seed replay help isolate minimal counterexamples.

            Assignee:
            Unassigned
            Reporter:
            Ernesto Rodriguez Reina
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: