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

Introduce ScalarGenerator interface for creating values of different BSON types in idempotency testing

    • Fully Compatible
    • TIG 2017-08-21

      The DocumentStructureEnumerator class added as part of SERVER-29795 always uses 0 for the scalar value in documents it generates. The UpdateSequenceGenerator class introduced in SERVER-29939 randomly selects between null, true, false, and double values between -INT_MAX and INT_MAX. In order to be able to detect idempotency issues related to different BSON types (e.g. type fidelity in $set, see SERVER-16801), we should accomodate being able to generate all possible BSON types.

      To work around the lack of a BSONValue class (i.e. a BSONElement is a view into the memory owned by a BSONObj), we should use the Value class from the aggregation framework as the generic return type of some kind of generate() method.

      We should have two concrete implementations of the ScalarGenerator interface:

      1. TrivialScalarGenerator should just return Value(0) and is what the self-tests for DocumentStructureEnumerator should use.
      2. RandomizedScalarGenerator should implement the existing behavior of UpdateSequenceGenerator.

            Assignee:
            may.hoque@mongodb.com May Hoque
            Reporter:
            max.hirschhorn@mongodb.com Max Hirschhorn
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: