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

Libraries s/coreshard and s/client/sharding_client are circularly dependent

    • Type: Icon: Bug Bug
    • Resolution: Duplicate
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 3.6.0
    • Component/s: Build, Sharding
    • None
    • Fully Compatible
    • ALL
    • Hide

      Remove the LIBDEPS_TAG from s/coreshard, and remove the link of s/coreshard from s/client/sharding_client.

      Show
      Remove the LIBDEPS_TAG from s/coreshard , and remove the link of s/coreshard from s/client/sharding_client .

      The libraries s/coreshard and s/client/sharding_client are mutually interdependent. Currently, this is worked around by tagging s/coreshard as incomplete, so that it does not actually express the link-time dependency on s/client/sharding_client and gets a temporarily exemption from the rule that a library must express all of its dependencies.

      If s/coreshard is linked without the exemption and without s/client/sharding_client, the following link errors are generated:

      src/mongo/s/catalog_cache.cpp:207: error: undefined reference to 'mongo::ShardRegistry::getShard(mongo::OperationContext*, mongo::ShardId const&)'
      src/mongo/s/catalog_cache.cpp:111: error: undefined reference to 'mongo::ShardRegistry::getShard(mongo::OperationContext*, mongo::ShardId const&)'
      src/mongo/s/config_server_client.cpp:53: error: undefined reference to 'mongo::ShardRegistry::getConfigShard() const'
      src/mongo/s/config_server_client.cpp:54: error: undefined reference to 'mongo::Shard::runCommand(mongo::OperationContext*, mongo::ReadPreferenceSetting const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, mongo::BSONObj const&, mongo::Shard::RetryPolicy)'
      src/mongo/s/config_server_client.cpp:70: error: undefined reference to 'mongo::ShardRegistry::getConfigShard() const'
      src/mongo/s/config_server_client.cpp:71: error: undefined reference to 'mongo::Shard::runCommandWithFixedRetryAttempts(mongo::OperationContext*, mongo::ReadPreferenceSetting const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, mongo::BSONObj const&, mongo::Shard::RetryPolicy)'
      src/mongo/s/grid.cpp:92: error: undefined reference to 'mongo::ShardRegistry::init()'
      /usr/bin/../lib/gcc/x86_64-linux-gnu/5.4.0/../../../../include/c++/5.4.0/bits/unique_ptr.h:76: error: undefined reference to 'mongo::ShardRegistry::~ShardRegistry()'
      src/mongo/s/shard_util.cpp:57: error: undefined reference to 'mongo::ShardRegistry::getShard(mongo::OperationContext*, mongo::ShardId const&)'
      src/mongo/s/shard_util.cpp:66: error: undefined reference to 'mongo::Shard::runCommandWithFixedRetryAttempts(mongo::OperationContext*, mongo::ReadPreferenceSetting const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, mongo::BSONObj const&, mongo::Duration<std::ratio<1l, 1000l> >, mongo::Shard::RetryPolicy)'
      src/mongo/s/shard_util.cpp:106: error: undefined reference to 'mongo::ShardRegistry::getShard(mongo::OperationContext*, mongo::ShardId const&)'
      src/mongo/s/shard_util.cpp:111: error: undefined reference to 'mongo::Shard::runCommandWithFixedRetryAttempts(mongo::OperationContext*, mongo::ReadPreferenceSetting const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, mongo::BSONObj const&, mongo::Shard::RetryPolicy)'
      src/mongo/s/shard_util.cpp:191: error: undefined reference to 'mongo::Shard::runCommandWithFixedRetryAttempts(mongo::OperationContext*, mongo::ReadPreferenceSetting const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, mongo::BSONObj const&, mongo::Shard::RetryPolicy)'
      src/mongo/s/sharding_egress_metadata_hook.cpp:78: error: undefined reference to 'mongo::ShardRegistry::getShardNoReload(mongo::ShardId const&)'
      src/mongo/s/sharding_egress_metadata_hook.cpp:84: error: undefined reference to 'mongo::Shard::isConfig() const'
      

      Conversely, if s/client/sharding_client is linked without s/coreshard, the following linker errors occur:

      src/mongo/s/client/shard_connection.cpp:277: error: undefined reference to 'mongo::grid'
      src/mongo/s/client/shard_connection.cpp:285: error: undefined reference to 'mongo::grid'
      src/mongo/s/client/shard_registry.cpp:325: error: undefined reference to 'mongo::grid'
      src/mongo/s/client/shard_registry.cpp:335: error: undefined reference to 'mongo::Grid::get(mongo::OperationContext*)'
      src/mongo/s/client/shard_registry.cpp:348: error: undefined reference to 'mongo::Grid::get(mongo::OperationContext*)'
      src/mongo/s/client/shard_registry.cpp:374: error: undefined reference to 'mongo::grid'
      src/mongo/s/client/shard_remote.cpp:175: error: undefined reference to 'mongo::Grid::configOpTime() const'
      src/mongo/s/client/shard_remote.cpp:197: error: undefined reference to 'mongo::Grid::get(mongo::OperationContext*)'
      src/mongo/s/client/shard_remote.cpp:240: error: undefined reference to 'mongo::Grid::configOpTime() const'
      src/mongo/s/client/shard_remote.cpp:295: error: undefined reference to 'mongo::Grid::configOpTime() const'
      src/mongo/s/client/shard_remote.cpp:321: error: undefined reference to 'mongo::Grid::get(mongo::OperationContext*)'
      src/mongo/s/client/version_manager.cpp:263: error: undefined reference to 'mongo::CatalogCache::invalidateShardedCollection(mongo::NamespaceString const&)'
      src/mongo/s/client/version_manager.cpp:266: error: undefined reference to 'mongo::CatalogCache::getCollectionRoutingInfo(mongo::OperationContext*, mongo::NamespaceString const&)'
      src/mongo/s/client/version_manager.cpp:296: error: undefined reference to 'mongo::ChunkManager::compatibleWith(mongo::ChunkManager const&, mongo::ShardId const&) const'
      src/mongo/s/client/version_manager.cpp:297: error: undefined reference to 'mongo::ChunkManager::getVersion(mongo::ShardId const&) const'
      src/mongo/s/client/version_manager.cpp:298: error: undefined reference to 'mongo::ChunkManager::getVersion(mongo::ShardId const&) const'
      src/mongo/s/client/version_manager.cpp:329: error: undefined reference to 'mongo::ChunkManager::getVersion(mongo::ShardId const&) const'
      src/mongo/s/client/version_manager.cpp:343: error: undefined reference to 'mongo::ChunkManager::getVersion(mongo::ShardId const&) const'
      src/mongo/s/client/version_manager.cpp:382: error: undefined reference to 'mongo::CatalogCache::onStaleConfigError(mongo::CachedCollectionRoutingInfo&&)'
      

      These libraries should either be merged, or some number of common libraries should be factored out, such that they no longer form a cycle.

            Assignee:
            andrew.morrow@mongodb.com Andrew Morrow (Inactive)
            Reporter:
            andrew.morrow@mongodb.com Andrew Morrow (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: