From bbab56051a643a51b40fe53e5ecd936b374bf135 Mon Sep 17 00:00:00 2001 From: Spencer T Brody Date: Thu, 3 Sep 2015 17:24:35 -0400 Subject: SERVER-20270 SERVER-19608 Fix race condition around updating ShardRegistry on CSRS membership changes --- src/mongo/client/replica_set_monitor.h | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'src/mongo/client/replica_set_monitor.h') diff --git a/src/mongo/client/replica_set_monitor.h b/src/mongo/client/replica_set_monitor.h index a766f9a4722..cf005f6c7fd 100644 --- a/src/mongo/client/replica_set_monitor.h +++ b/src/mongo/client/replica_set_monitor.h @@ -162,7 +162,19 @@ public: * * The hook must not be changed while the program has multiple threads. */ - static void setConfigChangeHook(ConfigChangeHook hook); + static void setAsynchronousConfigChangeHook(ConfigChangeHook hook); + + /** + * Sets the hook to be called whenever the config of any replica set changes. + * Currently only 1 globally, so this asserts if one already exists. + * + * The hook will be called inline while refreshing the ReplicaSetMonitor's view of the set + * membership. It is important that the hook not block for long as it will be running under + * the ReplicaSetMonitor's mutex. + * + * The hook must not be changed while the program has multiple threads. + */ + static void setSynchronousConfigChangeHook(ConfigChangeHook hook); /** * Permanently stops all monitoring on replica sets and clears all cached information -- cgit v1.2.1