[SERVER-54257] Refactor the structs used to represent collation options Created: 03/Feb/21  Updated: 06/Dec/22

Status: Backlog
Project: Core Server
Component/s: Querying
Affects Version/s: 4.9.0
Fix Version/s: None

Type: Task Priority: Minor - P4
Reporter: A. Jesse Jiryu Davis Assignee: Backlog - Replication Team
Resolution: Unresolved Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Problem/Incident
is caused by SERVER-52538 Update IDL definition for create command Closed
Assigned Teams:
Replication
Participants:

 Description   

Some weirdness has arisen as a result of my SERVER-52538 changes.

When you execute a command like "create", it parses the BSON input and creates a Collation object with all fields initialized (except "backwards" if the user didn't provide it). The Collation is turned into BSON, then parsed again, see CmdCreate in dbcommands.cpp:

            if (cmd.getCollation()) {
                auto collatorStatus =
CollatorFactoryInterface::get(opCtx->getServiceContext())
                                         
->makeFromBSON(cmd.getCollation()->toBSON());
                uassertStatusOK(collatorStatus.getStatus());
                defaultCollator = std::move(collatorStatus.getValue());
            }

The call to CollatorFactoryICU::makeFromBSON(), above, parses the BSON back into
a Collation. Then makeFromBSON() calls updateCollationSpecFromICUCollator with
BSONObj spec, Collation* collation.

This isn't perfect, but fixing it is a larger refactor than I'm willing to do
right now. I think the ideal code would represent collation options using Collation structs exclusively, rather than BSON objects, except when parsing the client request and serializing the reply.


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