[SERVER-43946] Converting BinData of type ByteArrayDeprecated from KeyString -> BSON -> KeyString returns a different KeyString Created: 10/Oct/19  Updated: 29/Oct/23  Resolved: 15/Oct/19

Status: Closed
Project: Core Server
Component/s: Storage
Affects Version/s: None
Fix Version/s: 4.3.1

Type: Bug Priority: Major - P3
Reporter: Gregory Wlodarek Assignee: Gregory Wlodarek
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
Problem/Incident
is caused by SERVER-41994 Shell does not add length to BSON bin... Closed
Related
is related to SERVER-42504 Allow explicit encryption of BinData ... Backlog
Backwards Compatibility: Fully Compatible
Operating System: ALL
Steps To Reproduce:

diff --git a/src/mongo/db/storage/key_string_test.cpp b/src/mongo/db/storage/key_string_test.cpp
index 23285183ec..fee6b276b4 100644
--- a/src/mongo/db/storage/key_string_test.cpp
+++ b/src/mongo/db/storage/key_string_test.cpp
@@ -306,6 +306,10 @@ TEST_F(KeyStringBuilderTest, Simple1) {
         }                                                                  \
     } while (0)
 
+TEST_F(KeyStringBuilderTest, DeprecatedBinData) {
+    ROUNDTRIP(version, BSON("" << BSONBinData(nullptr, 0, ByteArrayDeprecated)));
+}
+
 TEST_F(KeyStringBuilderTest, ActualBytesDouble) {
     // just one test like this for utter sanity

Sprint: Execution Team 2019-10-21
Participants:
Linked BF Score: 50

 Description   

SERVER-41994 changed the way we convert KeyString to BSON objects for BinData of type ByteArrayDeprecated. Creating the BSONElement for this type will now try to fix previously improperly made ByteArrayDeprecated elements by the shell. However, this causes a different KeyString to be created when converting from KeyString -> BSON -> KeyString for this type.

 

 

 



 Comments   
Comment by Githook User [ 15/Oct/19 ]

Author:

{'name': 'Gregory Wlodarek', 'username': 'GWlodarek', 'email': 'gregory.wlodarek@mongodb.com'}

Message: SERVER-43946 Converting BinData of type ByteArrayDeprecated from KeyString->BSON->KeyString should produce identical KeyStrings
Branch: master
https://github.com/mongodb/mongo/commit/ca5ed314bf2588025c0d3300f305d3efc74417ef

Comment by Gregory Wlodarek [ 15/Oct/19 ]

SERVER-41994 changes were reverted, so for this ticket I will be pushing a unit test change to improve our coverage of the deprecated type.

Comment by Gregory Wlodarek [ 15/Oct/19 ]

After discussing with gabriel.russell, we're going to be reverting the changes made in SERVER-41994. Once the revert is in, we can push a unit test to future proof this behavior.

Generated at Thu Feb 08 05:04:32 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.