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

BSONColumnBuilder stores objects as scalars when field was previously encountered as scalar

    • Type: Icon: Task Task
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 6.1.0-rc0
    • Affects Version/s: None
    • Component/s: None
    • Labels:
      None
    • Fully Compatible
    • v6.0
    • Execution Team 2022-05-02

      Storing the following values in BSONColumn opens object compression with a single interleaved stream for "x":

      {"x": 1}
      {"x": 2}
      {"x": {"y": 2, "z": 3}}
      {"x": {"y": 3, "z": 4}}
      

      The {"y": 2, "z": 3} in the third and forth object are stored as uncompressed scalars in that single interleaved stream.

      However, if the ordering of appends were reversed:

      {"x": {"y": 3, "z": 4}}
      {"x": {"y": 2, "z": 3}}
      {"x": 2}
      {"x": 1}
      

      We would start with object compression with two streams and end it when the third object is encountered and restart object compression with a single stream for "x" as a scalar.

      The behavior should be the same regardless of order. When going from scalar to object we should also re-start object compression.

            Assignee:
            henrik.edin@mongodb.com Henrik Edin
            Reporter:
            henrik.edin@mongodb.com Henrik Edin
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: