Details
-
Bug
-
Resolution: Fixed
-
Critical
-
4.0.0
-
Security Level: Public
-
Untriaged
-
Unknown
Description
In a composite index scenario, GSI index returns one qualified document even when no document qualifies for the specified keys.
Query then retrieves the document, applies the filter and rejects the document.
We should investigate why ONE document key qualifies for this predicate... Thanks.
Repro scenario:
– create and load beer-sample
create index idx_beer_abv_id on `beer-sample`(style, abv, brewery_id);
cbq> select abv, brewery_id from `beer-sample` where style = "Imperial or Double India Pale Ale" and abv = 100 and brewery_id = 49484;
{
"requestID": "e8ff8829-b476-493c-a10b-c601bb4e1e30",
"signature":
,
"results": [
],
"status": "success",
"metrics":
}
-----------
For this query, index should NOT return any qualified document.
But, it does return ONE document key resulting in query fetching the doc from KV and applying the filter on it...
_time=2015-07-14T14:21:19-07:00 _level=DEBUG _msg=Authenticating for keyspace beer-sample
_time=2015-07-14T14:21:19-07:00 _level=DEBUG _msg= Authenticating for bucket beer-sample username beer-sample password
_time=2015-07-14T14:21:19-07:00 _level=DEBUG _msg=Fetched 1 keys
_time=2015-07-14T14:21:19-07:00 _level=TRACE _msg=Phase aggregates _id=9469b431-da74-46c9-996a-1daa3819f670 plan=2.122015ms parse=2.799979ms instantiate=177.92µs authorize=222.103µs scan=187ns fetch=540.306µs run=2.754862ms
----------
cbq> explain select abv, brewery_id from `beer-sample` where style = "Imperial or Double India Pale Ale" and abv = 100 and brewery_id = 49484;
{
"requestID": "48a9c421-2408-488d-b628-e5fa1d4359c1",
"signature": "json",
"results": [
{
"#operator": "Sequence",
"~children": [
{
"#operator": "IndexScan",
"index": "idx_beer_abv_id",
"keyspace": "beer-sample",
"limit": 9.223372036854776e+18,
"namespace": "default",
"spans": [
{
"Range":
,
"Seek": null
}
],
"using": "gsi"
},
{
"#operator": "Parallel",
"~child": {
"#operator": "Sequence",
"~children": [
,
,
{
"#operator": "InitialProject",
"result_terms": [
,
{ "expr": "(`beer-sample`.`brewery_id`)" } ]
},
]
}
}
]
}
],
"status": "success",
"metrics":
}
Attachments
For Gerrit Dashboard: MB-15687 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
53273,4 | MB-15687 index_entry: Fix incorrect key prefix comparison | unstable | indexing | Status: MERGED | +2 | +1 |