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

Redundant assignment of FTSSpec in stage_builder.cpp

    • Fully Compatible
    • ALL

      The assignment on line 269 in db/query/stage_builder.cpp is a no-op and should be removed. Credit to paul.pedersen for spotting this.

      258     } else if (STAGE_TEXT == root->getType()) {
      259         const TextNode* node = static_cast<const TextNode*>(root);
      260         IndexDescriptor* desc =
      261             collection->getIndexCatalog()->findIndexByKeyPattern(txn, node->indexKeyPattern);
      262         invariant(desc);
      263         const FTSAccessMethod* fam =
      264             static_cast<FTSAccessMethod*>(collection->getIndexCatalog()->getIndex(desc));
      265         invariant(fam);
      266 
      267         TextStageParams params(fam->getSpec());
      268         params.index = desc;
      269         params.spec = fam->getSpec();
      270         params.indexPrefix = node->indexPrefix;
      271         // We assume here that node->ftsQuery is an FTSQueryImpl, not an FTSQueryNoop. In practice,
      272         // this means that it is illegal to use the StageBuilder on a QuerySolution created by
      273         // planning a query that contains "no-op" expressions. TODO: make StageBuilder::build()
      274         // fail in this case (this improvement is being tracked by SERVER-21510).
      275         params.query = static_cast<FTSQueryImpl&>(*node->ftsQuery);
      276         return new TextStage(txn, params, ws, node->filter.get());
      277     }
      

            Assignee:
            charlie.swanson@mongodb.com Charlie Swanson
            Reporter:
            rassi J Rassi
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: