From 190c9fb91712cf2075829f104963bad664c02349 Mon Sep 17 00:00:00 2001 From: Aaron Date: Wed, 12 May 2010 10:58:16 -0700 Subject: [PATCH] compile all --- db/queryoptimizer.h | 3 +++ dbtests/queryoptimizertests.cpp | 16 ++++++++-------- s/chunk.cpp | 8 ++++---- 3 files changed, 15 insertions(+), 12 deletions(-) diff --git a/db/queryoptimizer.h b/db/queryoptimizer.h index 6330f4e97d6..be08e76b555 100644 --- a/db/queryoptimizer.h +++ b/db/queryoptimizer.h @@ -139,6 +139,9 @@ namespace mongo { BSONObj explain() const; bool usingPrerecordedPlan() const { return usingPrerecordedPlan_; } PlanPtr getBestGuess() const; + + //for testing + const FieldRangeSet &fbs() const { return fbs_; } private: void addOtherPlans( bool checkFirst ); void addPlan( PlanPtr plan, bool checkFirst ) { diff --git a/dbtests/queryoptimizertests.cpp b/dbtests/queryoptimizertests.cpp index 445e2a905b3..24a36fdf579 100644 --- a/dbtests/queryoptimizertests.cpp +++ b/dbtests/queryoptimizertests.cpp @@ -130,7 +130,7 @@ namespace QueryOptimizerTests { class TwoGt : public Gt { virtual BSONObj query() { return BSON( "a" << GT << 0 << GT << 1 ); } }; - + class EqGte : public Eq { virtual BSONObj query() { return BSON( "a" << 1 << "a" << GTE << 1 ); } }; @@ -146,10 +146,10 @@ namespace QueryOptimizerTests { struct RegexBase : Base { void run() { //need to only look at first interval FieldRangeSet s( "ns", query() ); - checkElt( lower(), s.range( "a" ).intervals()[0].lower_.bound_ ); - checkElt( upper(), s.range( "a" ).intervals()[0].upper_.bound_ ); - ASSERT_EQUALS( lowerInclusive(), s.range( "a" ).intervals()[0].lower_.inclusive_ ); - ASSERT_EQUALS( upperInclusive(), s.range( "a" ).intervals()[0].upper_.inclusive_ ); + checkElt( lower(), s.range( "a" ).intervals()[0]._lower._bound ); + checkElt( upper(), s.range( "a" ).intervals()[0]._upper._bound ); + ASSERT_EQUALS( lowerInclusive(), s.range( "a" ).intervals()[0]._lower._inclusive ); + ASSERT_EQUALS( upperInclusive(), s.range( "a" ).intervals()[0]._upper._inclusive ); } }; @@ -325,9 +325,9 @@ namespace QueryOptimizerTests { vector< FieldInterval >::const_iterator j = intervals.begin(); double expected[] = { 3, 5, 9 }; for( int i = 0; i < 3; ++i, ++j ) { - ASSERT_EQUALS( expected[ i ], j->lower_.bound_.number() ); - ASSERT( j->lower_.inclusive_ ); - ASSERT( j->lower_ == j->upper_ ); + ASSERT_EQUALS( expected[ i ], j->_lower._bound.number() ); + ASSERT( j->_lower._inclusive ); + ASSERT( j->_lower == j->_upper ); } ASSERT( j == intervals.end() ); } diff --git a/s/chunk.cpp b/s/chunk.cpp index 01433298d1b..60d542261b6 100644 --- a/s/chunk.cpp +++ b/s/chunk.cpp @@ -640,11 +640,11 @@ namespace mongo { { const FieldInterval& fi = *it; assert(fi.valid()); - BSONObj minObj = BSON(field.fieldName() << fi.lower_.bound_); - BSONObj maxObj = BSON(field.fieldName() << fi.upper_.bound_); + BSONObj minObj = BSON(field.fieldName() << fi._lower._bound); + BSONObj maxObj = BSON(field.fieldName() << fi._upper._bound); ChunkRangeMap::const_iterator min, max; - min = (fi.lower_.inclusive_ ? _chunkRanges.upper_bound(minObj) : _chunkRanges.lower_bound(minObj)); - max = (fi.upper_.inclusive_ ? _chunkRanges.upper_bound(maxObj) : _chunkRanges.lower_bound(maxObj)); + min = (fi._lower._inclusive ? _chunkRanges.upper_bound(minObj) : _chunkRanges.lower_bound(minObj)); + max = (fi._upper._inclusive ? _chunkRanges.upper_bound(maxObj) : _chunkRanges.lower_bound(maxObj)); assert(min != _chunkRanges.ranges().end());