summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDwight <dmerriman@gmail.com>2008-12-17 15:47:25 -0500
committerDwight <dmerriman@gmail.com>2008-12-17 15:47:25 -0500
commit752dbb0f45fc6e8e67ceca2626dfc0d2508f73e7 (patch)
tree32ee76e0ded16cbb5d4fa78c82bf69082cc12a3d
parent1d8082574af3844607a882b8d953cd1843235509 (diff)
downloadmongo-752dbb0f45fc6e8e67ceca2626dfc0d2508f73e7.tar.gz
fix linker warnings for vc++
defensive code for cursors abouttodelete
-rw-r--r--db/clientcursor.cpp21
-rw-r--r--db/db.vcproj5
-rw-r--r--db/dbwebserver.cpp10
-rw-r--r--dbgrid/dbgrid.vcproj4
-rw-r--r--pcre-7.4/pcre.h1
-rw-r--r--pcre-7.4/pcreposix.c1
-rw-r--r--stdafx.h2
7 files changed, 36 insertions, 8 deletions
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 <time.h>
+#include "db.h"
/* TODO: FIX cleanup of clientCursors when hit the end. (ntoreturn insufficient) */
@@ -35,6 +36,9 @@ CCById clientCursorsById;
typedef multimap<DiskLoc, ClientCursor*> 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<ClientCursor*> 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<ClientCursor*>::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="&quot;..\pcre-7.4&quot;;&quot;c:\Program Files\boost\boost_1_35_0&quot;;&quot;c:\program files\java\jdk\include&quot;;&quot;c:\program files\java\jdk\include\win32&quot;"
- 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 @@
<Tool
Name="VCLinkerTool"
AdditionalDependencies="ws2_32.lib"
- ShowProgress="2"
LinkIncremental="2"
AdditionalLibraryDirectories="&quot;c:\Program Files\boost\boost_1_35_0\lib&quot;"
IgnoreAllDefaultLibraries="false"
@@ -123,7 +122,7 @@
Optimization="2"
EnableIntrinsicFunctions="true"
AdditionalIncludeDirectories="&quot;..\pcre-7.4&quot;;&quot;c:\Program Files\boost\boost_1_35_0&quot;;&quot;c:\program files\java\jdk\include&quot;;&quot;c:\program files\java\jdk\include\win32&quot;"
- PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;HAVE_CONFIG_H"
+ PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;HAVE_CONFIG_H;PCRE_STATIC"
RuntimeLibrary="2"
EnableFunctionLevelLinking="true"
UsePrecompiledHeader="2"
diff --git a/db/dbwebserver.cpp b/db/dbwebserver.cpp
index 5d2a65901f4..972e3c3feb4 100644
--- a/db/dbwebserver.cpp
+++ b/db/dbwebserver.cpp
@@ -85,6 +85,15 @@ void statsThread() {
}
}
+unsigned byLocSize();
+
+bool _bold;
+string bold(bool x) {
+ _bold = x;
+ return x ? "<b>" : "";
+}
+string bold() { return _bold ? "</b>" : ""; }
+
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 << "\n<b>replication</b>\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="&quot;..\pcre-7.4&quot;;&quot;C:\Program Files\boost\boost_1_35_0&quot;"
- 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="&quot;..\pcre-7.4&quot;;&quot;c:\Program Files\boost\boost_1_35_0\&quot;"
- 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 )