[SERVER-12723] Mixing $geoWithin queries can causes an error Created: 14/Feb/14  Updated: 11/Jul/16  Resolved: 19/Feb/14

Status: Closed
Project: Core Server
Component/s: Geo
Affects Version/s: 2.5.5
Fix Version/s: 2.6.0-rc0

Type: Bug Priority: Major - P3
Reporter: Ross Lawley Assignee: Benety Goh
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Attachments: File server12723.js    
Issue Links:
Related
is related to SERVER-12766 extend plan cache key to include geo ... Closed
Backwards Compatibility: Fully Compatible
Operating System: ALL
Steps To Reproduce:

db.geo.drop()
db.geo.insert( { type: "house", loc : { type : "Point", coordinates : [ 71.0603, 42.3583 ] } })
db.geo.insert( { type: "flat",  loc : { type : "Point", coordinates : [ 87.6500, 41.8500 ] } })
 
db.geo.ensureIndex({loc: "2dsphere", type: 1});
 
// Query using $box
db.geo.find({loc: {
    $geoWithin: {
        $box: [[-180, -90], [180, 90]]
    }
}, type: "house"}).explain()
 
 
// Query using $geomerty
db.geo.find( { loc :
  { $geoWithin :
    { $geometry :
      { type : "Polygon" ,
        coordinates : [[ [-180, -90], [180, -90], [180, 90],
                        [-180, -90] ] ]
  } } },
  type: "house" } ).explain()
 
// Trying the initial query and BOOM
// Query using $box
db.geo.find({loc: {
    $geoWithin: {
        $box: [[-180, -90], [180, 90]]
    }
}, type: "house"}).explain()

Participants:

 Description   

Mixing a $box and a $geometry query can cause an error:

Shell:

2014-02-14T11:31:04.187+0000 error: { "$err" : "assertion src/mongo/db/geo/geoquery.cpp:904" } at src/mongo/shell/query.js:131

Logs:

2014-02-14T11:39:37.144+0000 [conn1] test.geo Assertion failure NULL != _polygon src/mongo/db/geo/geoquery.cpp 904
2014-02-14T11:39:37.154+0000 [conn1] test.geo 0x115c4d1 0x10ff4b9 0x10e358e 0xb12f8b 0xcf420b 0xd2a0ef 0xd2ac6a 0xd2c644 0xd2cc0f 0xd3b949 0xd3c0e5 0xce23b7 0xce4b66 0xd0cc2c 0xb63ba2 0xb65212 0x75fd37 0x111331b 0x7fd6e6a77e9a 0x7fd6e5d8accd
 /usr/bin/mongod(_ZN5mongo15printStackTraceERSo+0x21) [0x115c4d1]
 /usr/bin/mongod(_ZN5mongo10logContextEPKc+0x159) [0x10ff4b9]
 /usr/bin/mongod(_ZN5mongo12verifyFailedEPKcS1_j+0x17e) [0x10e358e]
 /usr/bin/mongod() [0xb12f8b]
 /usr/bin/mongod(_ZN5mongo18IndexBoundsBuilder9translateEPKNS_15MatchExpressionERKNS_11BSONElementERKNS_10IndexEntryEPNS_19OrderedIntervalListEPNS0_15BoundsTightnessE+0x1fdb) [0xcf420b]
 /usr/bin/mongod(_ZN5mongo18QueryPlannerAccess12makeLeafNodeERKNS_14CanonicalQueryERKNS_10IndexEntryEmPNS_15MatchExpressionEPNS_18IndexBoundsBuilder15BoundsTightnessE+0x28f) [0xd2a0ef]
 /usr/bin/mongod(_ZN5mongo18QueryPlannerAccess17processIndexScansERKNS_14CanonicalQueryEPNS_15MatchExpressionEbRKSt6vectorINS_10IndexEntryESaIS7_EEPS6_IPNS_17QuerySolutionNodeESaISD_EE+0x27a) [0xd2ac6a]
 /usr/bin/mongod(_ZN5mongo18QueryPlannerAccess15buildIndexedAndERKNS_14CanonicalQueryEPNS_15MatchExpressionEbRKSt6vectorINS_10IndexEntryESaIS7_EE+0x54) [0xd2c644]
 /usr/bin/mongod(_ZN5mongo18QueryPlannerAccess22buildIndexedDataAccessERKNS_14CanonicalQueryEPNS_15MatchExpressionEbRKSt6vectorINS_10IndexEntryESaIS7_EE+0x19f) [0xd2cc0f]
 /usr/bin/mongod(_ZN5mongo12QueryPlanner13planFromCacheERKNS_14CanonicalQueryERKNS_18QueryPlannerParamsERKNS_17SolutionCacheDataEPPNS_13QuerySolutionE+0x679) [0xd3b949]
 /usr/bin/mongod(_ZN5mongo12QueryPlanner13planFromCacheERKNS_14CanonicalQueryERKNS_18QueryPlannerParamsERKNS_14CachedSolutionEPPNS_13QuerySolutionESC_+0x85) [0xd3c0e5]
 /usr/bin/mongod(_ZN5mongo9getRunnerEPNS_10CollectionEPNS_14CanonicalQueryEPPNS_6RunnerEm+0xff7) [0xce23b7]
 /usr/bin/mongod(_ZN5mongo9getRunnerEPNS_14CanonicalQueryEPPNS_6RunnerEm+0x96) [0xce4b66]
 /usr/bin/mongod(_ZN5mongo11newRunQueryERNS_7MessageERNS_12QueryMessageERNS_5Cur



 Comments   
Comment by Githook User [ 19/Feb/14 ]

Author:

{u'username': u'benety', u'name': u'Benety Goh', u'email': u'benety@mongodb.com'}

Message: SERVER-12723 geo queries should not be cacheable.
Branch: master
https://github.com/mongodb/mongo/commit/85b43895e9f54277d1b9696951fc3e7550477e74

Comment by Daniel Pasette (Inactive) [ 18/Feb/14 ]

Fix for rc0 is to make geo queries non-cacheable. Will have an impact on geo query throughput tests. Fix for rc1 is to change the cache policy for geo queries.

Generated at Thu Feb 08 03:29:25 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.