diff options
author | Richard Kreuter <richard@10gen.com> | 2010-07-12 16:29:32 -0400 |
---|---|---|
committer | Richard Kreuter <richard@10gen.com> | 2010-07-12 16:29:32 -0400 |
commit | 13a2ba57e5f49194e1367e07d24e16c7dffa741b (patch) | |
tree | e397d49ea127c01f17820af93d2375bc796bfd24 | |
parent | f793409815265d1c8d663af490ad2b670e67a26c (diff) | |
download | mongo-13a2ba57e5f49194e1367e07d24e16c7dffa741b.tar.gz |
Backport 27e684c to 1.4.x. SERVER-1283, SUPPORT-50.
-rw-r--r-- | db/index_geo2d.cpp | 2 | ||||
-rw-r--r-- | jstests/geoe.js | 32 |
2 files changed, 33 insertions, 1 deletions
diff --git a/db/index_geo2d.cpp b/db/index_geo2d.cpp index 5ebf65a5574..e80cc7a90a2 100644 --- a/db/index_geo2d.cpp +++ b/db/index_geo2d.cpp @@ -988,7 +988,7 @@ namespace mongo { min.checkCur( found , hopper ); max = min; - if ( min.bucket.isNull() ){ + if ( min.bucket.isNull() || ( ! (hopper->found()) )){ min.bucket = id.head.btree()->locate( id , id.head , start.wrap() , spec->_order , min.pos , min.found , minDiskLoc , -1 ); min.checkCur( found , hopper ); diff --git a/jstests/geoe.js b/jstests/geoe.js new file mode 100644 index 00000000000..22feb83ab1e --- /dev/null +++ b/jstests/geoe.js @@ -0,0 +1,32 @@ +// Was reported as SERVER-1283. +// The problem seems to be that sometimes the index btrees are such that +// the first search for a matching point in the geo code could run to +// the end of the btree and not reverse direction (leaving the rest of +// the search always looking at some random non-matching point). + +t=db.geo_box; +t.drop(); + +t.insert({"_id": 1, "geo" : [ 33, -11.1 ] }); +t.insert({"_id": 2, "geo" : [ -122, 33.3 ] }); +t.insert({"_id": 3, "geo" : [ -122, 33.4 ] }); +t.insert({"_id": 4, "geo" : [ -122.28, 37.67 ] }); +t.insert({"_id": 5, "geo" : [ -122.29, 37.68 ] }); +t.insert({"_id": 6, "geo" : [ -122.29, 37.67 ] }); +t.insert({"_id": 7, "geo" : [ -122.29, 37.67 ] }); +t.insert({"_id": 8, "geo" : [ -122.29, 37.68 ] }); +t.insert({"_id": 9, "geo" : [ -122.29, 37.68 ] }); +t.insert({"_id": 10, "geo" : [ -122.3, 37.67 ] }); +t.insert({"_id": 11, "geo" : [ -122.31, 37.67 ] }); +t.insert({"_id": 12, "geo" : [ -122.3, 37.66 ] }); +t.insert({"_id": 13, "geo" : [ -122.2435, 37.637072 ] }); +t.insert({"_id": 14, "geo" : [ -122.289505, 37.695774 ] }); + + +t.ensureIndex({ geo : "2d" }); + +c=t.find({geo: {"$within": {"$box": [[-125.078461,36.494473], [-120.320648,38.905199]]} } }); +assert.eq(11, c.count(), "A1"); + +c=t.find({geo: {"$within": {"$box": [[-124.078461,36.494473], [-120.320648,38.905199]]} } }); +assert.eq(11, c.count(), "B1"); |