Bug 1105473

Summary: MongoDB: Offset clause causes MongoDB to crash
Product: [JBoss] JBoss Data Virtualization 6 Reporter: Filip Elias <felias>
Component: TeiidAssignee: Van Halbert <vhalbert>
Status: CLOSED CURRENTRELEASE QA Contact:
Severity: high Docs Contact:
Priority: high    
Version: 6.0.0CC: atangrin, dlesage, vhalbert
Target Milestone: ER1Keywords: QA-Closed
Target Release: 6.1.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
MongoDB would crash when an offset clause was used in an SQL query. This was becuase, during translation from query to API language, objects were defaulting the limit at INT_MAX during the translation. To fix this problem, an explicit check was added to the MongoDB query parser to check for INT_MAX and skip setting the value if it matches. As a result, MongoDB will no longer crash when queries with offset clauses are run.
Story Points: ---
Clone Of: Environment:
DV6 + rollup MongoDB < 2.5.2
Last Closed: 2016-02-10 08:55:40 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Filip Elias 2014-06-06 08:50:14 UTC
MongoDB(version < 2.5.2) will crash when offset clause is used in SQL query.

Althought the bug[1] is in MongoDB (Adding big number into $limit causes Mongodb to shutdown), it is also caused by teiid because it adds max integer into $limit which seems to be unnecessary. 

Sample query: 
SELECT INTKEY FROM bqt1.smalla ORDER BY INTKEY OFFSET 45 ROWS

Generated mongo command:
{ aggregate: "smalla", pipeline: [ { $project: { c_0: "$INTKEY" } }, { $sort: { c_0: 1 } }, { $skip: 45 }, { $limit: 2147483647 } ] }

[1] https://jira.mongodb.org/browse/SERVER-10136

Comment 1 JBoss JIRA Server 2014-06-06 14:30:16 UTC
Ramesh Reddy <rareddy> updated the status of jira TEIID-2992 to Resolved

Comment 2 JBoss JIRA Server 2015-04-07 13:35:10 UTC
Steven Hawkins <shawkins> updated the status of jira TEIID-2992 to Closed