[MDEV-22028] Use ptr_arg in Field::store_*/Field::val_* Created: 2020-03-24 Updated: 2022-04-25 |
|
| Status: | Stalled |
| Project: | MariaDB Server |
| Component/s: | None |
| Fix Version/s: | N/A |
| Type: | Task | Priority: | Major |
| Reporter: | Nikita Malyavin | Assignee: | Nikita Malyavin |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | beginner-friendly | ||
| Description |
|
This task could be splitted by two: one for store_* and one for val_* We currently have following problem with Field class:
The task is:
|
| Comments |
| Comment by Nikita Malyavin [ 2020-11-20 ] | ||||
|
nayuta-yanagisawa will work on this task | ||||
| Comment by Nayuta Yanagisawa (Inactive) [ 2020-11-23 ] | ||||
|
Before writing code, I did a brief survey on the code base. The following pattern frequently appears in the storage engine codes:
The pattern looks awful and could be easily misused, especially in an error-handling case. I agree that we should remove the pattern. On the other hand, I also found some use cases, of move_field_offset(), which are not fit the above pattern and seem to be difficult to eliminate just by adding store_/val_ functions accepting *ptr_arg. For example see index_next_same() in handler.cc. By the above observation, I'm considering to limit the scope of the issue to adding store_/val_ functions accepting *ptr_arg and removing move_field_offset() which can be simply replaced with the new functions. Is the scope in line with your idea? @nikitamalyavin | ||||
| Comment by Nayuta Yanagisawa (Inactive) [ 2020-11-23 ] | ||||
|
I don't know why I cannot mention other users but it is possibly an authority issue. | ||||
| Comment by Nikita Malyavin [ 2020-11-23 ] | ||||
|
You are right, nayuta-yanagisawa. I was thinking a lot on the last days about it.
| ||||
| Comment by Nikita Malyavin [ 2020-11-23 ] | ||||
|
So let's agree on leaving move_field_offset usages as is, at least not focus on them on this task. Though I'd like to see a separate patch with several removals as a usage hint for other developers. We'll set up a trend with that, at least move_field_offset is used a lot for a key buffer initializations (not our scope though) and for default/virtual value calculations. Check out write_record, fix_fields functions. >I don't know why I cannot mention other users but it is possibly an authority issue.
| ||||
| Comment by Nayuta Yanagisawa (Inactive) [ 2020-11-23 ] | ||||
|
> So let's agree on leaving move_field_offset usages as is, at least not focus on them on this task. OK, I will work along with the above way. > try to use this syntax: | ||||
| Comment by Nayuta Yanagisawa (Inactive) [ 2020-12-12 ] | ||||
|
I'm working on it little by little. I will create a pull request on mariadb/server repository once I've replaced all val_** stuff. You can track my progress by the pull request, which is created just for sharing purposes, on my personal repository. https://github.com/nayuta-yanagisawa/server/pull/3/files |