[MDEV-25449] Add MY_COLLATION_HANDLER::strnncollsp_nchars() Created: 2021-04-19 Updated: 2022-01-21 Resolved: 2022-01-21 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Character Sets |
| Affects Version/s: | 10.2.2, 10.3.0, 10.4.0, 10.5.0, 10.6.0 |
| Fix Version/s: | N/A |
| Type: | Bug | Priority: | Major |
| Reporter: | Alexander Barkov | Assignee: | Alexander Barkov |
| Resolution: | Duplicate | Votes: | 0 |
| Labels: | corruption, regression-10.2, tech_debt | ||
| Issue Links: |
|
||||||||||||||||||||||||||||||||
| Description |
2022-01-21 UpdateThis problem was solved under terms of Old descriptionField_string::cmp() seems to do unnecessary work trimming trailing spaces:
In absolute majority cases, the difference between strings is found in the very beginning of the compared strings. So doing charpos() on the two arguments, before passing them to the actual comparison function, looks like an inefficient waste of CPU. A better approach would be to implement a new comparison function with this tentative API:
Internally, the exact virtial implementations of strnncollsp_nchars() would do the same with what strnncollsp() do in the same collation, but with an extra limit on "nchars". This new function should also help to fix a bug in the similar code in InnoDB: see |
| Comments |
| Comment by Marko Mäkelä [ 2021-04-23 ] |
|
This refactoring is needed for fixing the InnoDB index corruption bug |
| Comment by Alexander Barkov [ 2021-04-27 ] |
|
Please find the patch here: https://github.com/MariaDB/server/commit/9b0df8eee7b8298fead770da083ab9916e0267ec |