[SERVER-65501] BSONColumnBuilder stores objects as scalars when field was previously encountered as scalar Created: 12/Apr/22  Updated: 29/Oct/23  Resolved: 26/Apr/22

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: 6.1.0-rc0

Type: Task Priority: Major - P3
Reporter: Henrik Edin Assignee: Henrik Edin
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Backports
Backwards Compatibility: Fully Compatible
Backport Requested:
v6.0
Sprint: Execution Team 2022-05-02
Participants:

 Description   

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.



 Comments   
Comment by Githook User [ 27/Apr/22 ]

Author:

{'name': 'Henrik Edin', 'email': 'henrik.edin@mongodb.com', 'username': 'henrikedin'}

Message: SERVER-65501 Re-start interleaved object compression when scalar field is encountered as object

This makes the behavior the same as when going from object to scalar.

(cherry picked from commit 8566a0723be819ade9a79b5c5c4d60590e4a895e)
Branch: v6.0
https://github.com/mongodb/mongo/commit/aa0eff62c534fba56b437a2e046ce91f08d082ef

Comment by Githook User [ 22/Apr/22 ]

Author:

{'name': 'Henrik Edin', 'email': 'henrik.edin@mongodb.com', 'username': 'henrikedin'}

Message: SERVER-65501 Re-start interleaved object compression when scalar field is encountered as object

This makes the behavior the same as when going from object to scalar.
Branch: master
https://github.com/mongodb/mongo/commit/8566a0723be819ade9a79b5c5c4d60590e4a895e

Comment by Githook User [ 20/Apr/22 ]

Author:

{'name': 'Uladzimir Makouski', 'email': 'uladzimir.makouski@mongodb.com', 'username': 'umakouski'}

Message: Revert "SERVER-65501 Re-start interleaved object compression when scalar field is encountered as object"

This reverts commit 31864e3866ce9cc54c08463019846ded2ad9e6e5.
Branch: master
https://github.com/mongodb/mongo/commit/4caee7fb10e974d331b343a7aae06ba9fde439b6

Comment by Githook User [ 19/Apr/22 ]

Author:

{'name': 'Henrik Edin', 'email': 'henrik.edin@mongodb.com', 'username': 'henrikedin'}

Message: SERVER-65501 Re-start interleaved object compression when scalar field is encountered as object

This makes the behavior the same as when going from object to scalar.
Branch: master
https://github.com/mongodb/mongo/commit/31864e3866ce9cc54c08463019846ded2ad9e6e5

Generated at Thu Feb 08 06:02:53 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.