[SERVER-33303] Modifying indexes impacts application of index filters Created: 13/Feb/18 Updated: 29/Oct/23 Resolved: 07/Nov/18 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Querying |
| Affects Version/s: | None |
| Fix Version/s: | 4.1.5 |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Chris Harris | Assignee: | Ian Boros |
| Resolution: | Fixed | Votes: | 5 |
| Labels: | QFB, storch | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Backwards Compatibility: | Fully Compatible | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Operating System: | ALL | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Backport Requested: |
v4.0, v3.6
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Steps To Reproduce: |
Output of running those commands:
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Sprint: | Query 2018-10-22, Query 2018-11-05, Query 2018-11-19 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Participants: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Case: | (copied to CRM) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Linked BF Score: | 13 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Description |
|
According to the documentation:
While a given index filter does persist across index creation and drops, its application towards queries does seem to be influenced by such actions. |
| Comments |
| Comment by David Storch [ 07/Nov/18 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
ian.boros, did you mean to once again close this ticket as fixed? | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Githook User [ 06/Nov/18 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Author: {'name': 'Ian Boros', 'email': 'ian.boros@10gen.com'}Message: | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Githook User [ 06/Nov/18 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Author: {'name': 'Ian Boros', 'email': 'ian.boros@10gen.com'}Message: Revert " This reverts commit 36d4668e854d8bd17e8b684dbbf42b3b0903bbe7. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Githook User [ 06/Nov/18 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Author: {'name': 'Ian Boros', 'email': 'ian.boros@10gen.com'}Message: | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Ian Boros [ 08/Oct/18 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Looks like this is caused by the fact that index filters use a query's "plan cache key" as a key in the mapping from query shape -> allowed indices. The plan cache key encodes information about which indexes the query can use, and is therefore catalog dependent. This means that the query {x: 3} will have a different cache key after an index is dropped or created, and therefore, map to a different (non-existent) index filter. This explains why index filters may not get applied after a catalog change, as well as why it's possible to see "duplicate" entries. I think to solve this we'll need some kind of "catalog agnostic" key for a query, but I'm going to talk to some other people on the team before I take that approach. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Chris Harris [ 26/Feb/18 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
As asya mentioned, this is a correctness issue with respect to the filters not being applied although they are present. In addition to the applyiing -> not applying behavior in the previous comment, the reproduction steps also show not applying -> applying again as well (see the "But now after creating a new index it is being applied again" section). I went ahead and confirmed that the behavior of the reproduction steps is the same in the log file (eg not specific to explain) on 3.4.3:
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Asya Kamsky [ 23/Feb/18 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
The issue is that of correctness. The index filters are not applied correctly until they are re-created, so it's either that they are somehow getting invalidated when they shouldn't or something else is wrong.
Creating the index filter again added it so that now three identical looking filters showed up and now the indexFilterSet was shown as true and correct index was used. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Ian Whalen (Inactive) [ 23/Feb/18 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
christopher.harris the index filters and index catalog are intentionally independent and key pattern/index name-based. |