diff --git a/db/clientcursor.cpp b/db/clientcursor.cpp index c8c81cd24bf..04ff705bad8 100644 --- a/db/clientcursor.cpp +++ b/db/clientcursor.cpp @@ -26,6 +26,7 @@ #include "query.h" #include "introspect.h" #include +#include "db.h" /* TODO: FIX cleanup of clientCursors when hit the end. (ntoreturn insufficient) */ @@ -35,6 +36,9 @@ CCById clientCursorsById; typedef multimap ByLoc; ByLoc byLoc; +unsigned byLocSize() { + return byLoc.size(); +} void ClientCursor::setLastLoc(DiskLoc L) { if( L == _lastLoc ) @@ -90,13 +94,24 @@ void aboutToDeleteBucket(const DiskLoc& b) { /* must call this on a delete so we clean up the cursors. */ void aboutToDelete(const DiskLoc& dl) { + ByLoc::iterator j = byLoc.lower_bound(dl); + ByLoc::iterator stop = byLoc.upper_bound(dl); + if( j == stop ) + return; + + assert( dbMutexInfo.isLocked() ); vector toAdvance; - for( ByLoc::iterator i = byLoc.lower_bound(dl); - i != byLoc.upper_bound(dl); ++i ) { - toAdvance.push_back(i->second); + while( 1 ) { + toAdvance.push_back(j->second); + WIN assert( j->first == dl ); + ++j; + if( j == stop ) + break; } + wassert( toAdvance.size() < 5000 ); + for( vector::iterator i = toAdvance.begin(); i != toAdvance.end(); ++i ) { diff --git a/db/db.vcproj b/db/db.vcproj index 061f4676b1e..4b592bc316d 100644 --- a/db/db.vcproj +++ b/db/db.vcproj @@ -44,7 +44,7 @@ Name="VCCLCompilerTool" Optimization="0" AdditionalIncludeDirectories=""..\pcre-7.4";"c:\Program Files\boost\boost_1_35_0";"c:\program files\java\jdk\include";"c:\program files\java\jdk\include\win32"" - PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;HAVE_CONFIG_H" + PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;HAVE_CONFIG_H;PCRE_STATIC" MinimalRebuild="true" BasicRuntimeChecks="3" RuntimeLibrary="3" @@ -64,7 +64,6 @@ " : ""; +} +string bold() { return _bold ? "" : ""; } + class DbWebServer : public MiniWebServer { public: // caller locks @@ -94,6 +103,7 @@ public: ss << "curclient: " << database->name; ss << '\n'; } + ss << bold(byLocSize()>10000) << "Cursors byLoc.size(): " << byLocSize() << bold() << '\n'; ss << "\nreplication\n"; ss << "master: " << master << '\n'; ss << "slave: " << slave << '\n'; diff --git a/dbgrid/dbgrid.vcproj b/dbgrid/dbgrid.vcproj index 356c4134022..7ec49d3cebc 100644 --- a/dbgrid/dbgrid.vcproj +++ b/dbgrid/dbgrid.vcproj @@ -42,7 +42,7 @@ Name="VCCLCompilerTool" Optimization="0" AdditionalIncludeDirectories=""..\pcre-7.4";"C:\Program Files\boost\boost_1_35_0"" - PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;HAVE_CONFIG_H" + PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;HAVE_CONFIG_H;PCRE_STATIC" MinimalRebuild="true" BasicRuntimeChecks="3" RuntimeLibrary="3" @@ -119,7 +119,7 @@ Optimization="2" EnableIntrinsicFunctions="true" AdditionalIncludeDirectories=""..\pcre-7.4";"c:\Program Files\boost\boost_1_35_0\"" - PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS" + PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;PCRE_STATIC" RuntimeLibrary="2" EnableFunctionLevelLinking="true" UsePrecompiledHeader="2" diff --git a/pcre-7.4/pcre.h b/pcre-7.4/pcre.h index ecc0f8db323..098ae6d5739 100644 --- a/pcre-7.4/pcre.h +++ b/pcre-7.4/pcre.h @@ -52,6 +52,7 @@ export setting is defined in pcre_internal.h, which includes this file. So we don't change existing definitions of PCRE_EXP_DECL and PCRECPP_EXP_DECL. */ #if defined(_WIN32) && !defined(PCRE_STATIC) +#error why are we here? # ifndef PCRE_EXP_DECL # define PCRE_EXP_DECL extern __declspec(dllimport) # endif diff --git a/pcre-7.4/pcreposix.c b/pcre-7.4/pcreposix.c index c88f65c705c..2409e435425 100644 --- a/pcre-7.4/pcreposix.c +++ b/pcre-7.4/pcreposix.c @@ -53,6 +53,7 @@ they are set for an application (using these functions) if they have not previously been set. */ #if defined(_WIN32) && !defined(PCRE_STATIC) +#error why are we here? # define PCREPOSIX_EXP_DECL extern __declspec(dllexport) # define PCREPOSIX_EXP_DEFN __declspec(dllexport) #endif diff --git a/stdafx.h b/stdafx.h index e25794e27de..8c24ea05309 100644 --- a/stdafx.h +++ b/stdafx.h @@ -207,8 +207,10 @@ extern const char *curNs; */ #if defined(_WIN32) #define DEV if( 0 ) +#define WIN if( 1 ) #else #define DEV if( 0 ) +#define WIN if( 0 ) #endif #define DEBUGGING if( 0 )