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

Refactor the structs used to represent collation options

    • Type: Icon: Task Task
    • Resolution: Unresolved
    • Priority: Icon: Minor - P4 Minor - P4
    • None
    • Affects Version/s: 4.9.0
    • Component/s: Querying
    • Labels:
      None
    • Replication

      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.

            Assignee:
            backlog-server-repl [DO NOT USE] Backlog - Replication Team
            Reporter:
            jesse@mongodb.com A. Jesse Jiryu Davis
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: