[SERVER-71048] Remove one extra binary search iteration during QE query rewrite Created: 03/Nov/22 Updated: 27/Oct/23 Resolved: 08/Nov/22 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Queryable Encryption |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Erwin Pe | Assignee: | Erwin Pe |
| Resolution: | Works as Designed | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Operating System: | ALL |
| Sprint: | Security 2022-11-14 |
| Participants: |
| Description |
|
If the contention max, M, for a QE encrypted field is greater than 0, the query rewrite currently performs M + 1 binary search iterations, whereas it should only be running M iterations. See https://github.com/10gen/mongo/blob/082a22c0addd26f8065693ba81d3507b26e02311/src/mongo/crypto/fle_tags.cpp#L215. For a field with contention max M, the valid contention factor values are 0 through M-1, inclusive. The extra binary search iteration will lookup ESC entries for contention value M, but will always end up with 0 entries. |
| Comments |
| Comment by Erwin Pe [ 08/Nov/22 ] |
|
Closing this as working as designed because (although misleading) with a max contention of N, we actually do indeed partition the field value into N+1 buckets, so the extra emuBinary search iteration is necessary. |