summaryrefslogtreecommitdiff
path: root/src/mongo/s/shard.cpp
diff options
context:
space:
mode:
authorGreg Studer <greg@10gen.com>2014-04-28 16:54:17 -0400
committerGreg Studer <greg@10gen.com>2014-05-15 14:23:15 -0400
commit945ed48cc77ecbc97f7fdc6f7a06c8968a7a14c5 (patch)
treeeb08e75a0bfd47649c426541b1fa02b886455089 /src/mongo/s/shard.cpp
parentfef6805061b31e1c6269a438c1922f17db72213b (diff)
downloadmongo-945ed48cc77ecbc97f7fdc6f7a06c8968a7a14c5.tar.gz
SERVER-11332 hookup of fastest query to SyncClusterConnection
(cherry picked from commit d2e4b7d17a8b4a406f053e39f692f394d66e6b11)
Diffstat (limited to 'src/mongo/s/shard.cpp')
-rw-r--r--src/mongo/s/shard.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/mongo/s/shard.cpp b/src/mongo/s/shard.cpp
index 0d86a24a496..2a319765724 100644
--- a/src/mongo/s/shard.cpp
+++ b/src/mongo/s/shard.cpp
@@ -49,6 +49,7 @@
#include "mongo/s/client_info.h"
#include "mongo/s/config.h"
#include "mongo/s/request.h"
+#include "mongo/s/scc_fast_query_handler.h"
#include "mongo/s/type_shard.h"
#include "mongo/s/version_manager.h"
@@ -497,6 +498,15 @@ namespace mongo {
// to the end of every runCommand. mongod uses this information to produce auditing
// records attributed to the proper authenticated user(s).
conn->setRunCommandHook(boost::bind(&audit::appendImpersonatedUsers, _1));
+
+ // For every SCC created, add a hook that will allow fastest-config-first config reads if
+ // the appropriate server options are set.
+ if ( conn->type() == ConnectionString::SYNC ) {
+ SyncClusterConnection* scc = dynamic_cast<SyncClusterConnection*>( conn );
+ if ( scc ) {
+ scc->attachQueryHandler( new SCCFastQueryHandler );
+ }
+ }
}
void ShardingConnectionHook::onDestroy( DBClientBase * conn ) {