diff options
author | Hari Khalsa <hkhalsa@10gen.com> | 2013-08-08 16:30:51 -0400 |
---|---|---|
committer | Hari Khalsa <hkhalsa@10gen.com> | 2013-08-12 11:47:37 -0400 |
commit | 525f2f11ac545221f1b0af0746d0891c40ed9aa7 (patch) | |
tree | d5fe0399a15a36aceee0440b88ae684c8a4b2bb9 /src/mongo/db/clientcursor.h | |
parent | 554b31cde9256f77fbf880261ea90067ef277abd (diff) | |
download | mongo-525f2f11ac545221f1b0af0746d0891c40ed9aa7.tar.gz |
SERVER-10026 SERVER-10461 runner registry: short-term safe yielding for non-cached runners
Diffstat (limited to 'src/mongo/db/clientcursor.h')
-rw-r--r-- | src/mongo/db/clientcursor.h | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/src/mongo/db/clientcursor.h b/src/mongo/db/clientcursor.h index 09311ad5045..67cdf93b877 100644 --- a/src/mongo/db/clientcursor.h +++ b/src/mongo/db/clientcursor.h @@ -85,11 +85,23 @@ namespace mongo { const NamespaceDetails* nsd, const DiskLoc& dl); + /** + * Register a runner so that it can be notified of deletion/invalidation during yields. + * Must be called before a runner yields. If a runner is cached (inside a ClientCursor) it + * MUST NOT be registered; the two are mutually exclusive. + */ + static void registerRunner(Runner* runner); + + /** + * Remove a runner from the runner registry. + */ + static void deregisterRunner(Runner* runner); + // // Yielding. // - static void staticYield(int micros, const StringData& ns, Record* rec ); + static void staticYield(int micros, const StringData& ns, Record* rec); // // Static methods about all ClientCursors TODO: Document. @@ -253,6 +265,13 @@ namespace mongo { typedef map<CursorId, ClientCursor*> CCById; static CCById clientCursorsById; + // A list of NON-CACHED runners. Any runner that yields must be put into this map before + // yielding in order to be notified of invalidation and namespace deletion. Before the + // runner is deleted, it must be removed from this map. + // + // TODO: This is temporary and as such is highly NOT optimized. + static set<Runner*> nonCachedRunners; + // How many cursors have timed out? static long long numberTimedOut; |