Add test extension and integration tests for shardId propagation

XMLWordPrintableJSON

    • Type: Sub-task
    • Resolution: Fixed
    • Priority: Major - P3
    • 9.0.0-rc0
    • Affects Version/s: None
    • Component/s: None
    • None
    • Query Integration
    • Fully Compatible
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      Integration Tests

      • Add a new shard_id.cpp test extension that propagates shardId from AstNode to LogicalStage through its bind() implementation (see example above).
      • For the tests below, it’s necessary to have a version that executes on the router and one that executes on the shard.
      • Add an integration test that uses shard_id.cpp in a pipeline:
      • When in a standalone environment, shardId should be empty.
      • When in a sharded environment on the shard, shardId should exist and be correct.

      When in a sharded environment on the router, shardId should be empty.

      Extension Implementation Example

      class ShardIdAstNode : public sdk::AggStageAstNode {
          // ...
          std::unique_ptr<sdk::LogicalAggStage> bind(
              const ::MongoExtensionCatalogContext& catalogContext) const override {
              std::string shardId(extension::byteViewAsStringView(catalogContext.shardId));
              return std::make_unique<ShardIdLogicalStage>(getName(),
                                                std::move(shardId));
          }
          // ...
      }; 

       

            Assignee:
            Josh Siegel
            Reporter:
            Josh Siegel
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: