[MDEV-17441] InnoDB transition to C++11 atomics Created: 2018-10-13 Updated: 2022-05-25 Resolved: 2019-07-12 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Storage Engine - InnoDB |
| Fix Version/s: | 10.4.7 |
| Type: | Task | Priority: | Major |
| Reporter: | Sergey Vojtovich | Assignee: | Eugene Kosov (Inactive) |
| Resolution: | Fixed | Votes: | 1 |
| Labels: | None | ||
| Issue Links: |
|
||||||||||||||||||||||||||||
| Description |
|
Atomic operations using my_atomic produce pretty convoluted and error prone code. In 10.4 we have C++11 enabled and it provides much cleaner atomic operations API. |
| Comments |
| Comment by Sergey Vojtovich [ 2018-10-13 ] |
|
marko, please review 10 top patches at https://github.com/MariaDB/server/commits/bb-10.4-MDEV-17441 Please also pay special attention to buf_tmp_buffer_t::reserved patch. |
| Comment by Marko Mäkelä [ 2018-10-23 ] |
|
Looks generally OK. I posted a few comments to some of the commits. I still see a few references to my_atomic in InnoDB after the commits that I reviewed. Could all of them be replaced? I’d also like to have a few member functions in rw_lock_t, to reduce some typing. Ideally, the memory ordering would not be repeated on each operation, but it should be part of the object declaration. Could we somehow the memory ordering a template parameter, or otherwise make relaxed memory ordering the default, to reduce typing? |
| Comment by Sergey Vojtovich [ 2018-10-24 ] |
|
Original head with 17 patches just for reference: https://github.com/MariaDB/server/commits/bf64d634b831052e8f603fb6cc43296051ae24a3 |
| Comment by Sergey Vojtovich [ 2018-10-24 ] |
|
We should eventually eliminate them all. Unfortunately trying to eliminate them at once may lead to project failure, since it is not that trivial. I don't like idea of making relaxed default memory ordering for two reasons: But I agree we could reduce some typing by having proper methods in rw_lock_t or alike. |
| Comment by Sergey Vojtovich [ 2018-10-24 ] |
|
marko, I implemented most of your suggestions and pushed to https://github.com/MariaDB/server/commits/bb-10.4-MDEV-17441 Would you like to have another look? |
| Comment by Marko Mäkelä [ 2018-10-29 ] |
|
Looks OK. I sent a few comments, requesting minor improvement for code clarity. |
| Comment by Marko Mäkelä [ 2019-02-03 ] |
|
I see that os0once.h and srv0mon.h still have not been converted to use C++11 atomics. Shall we leave those for a later version? |
| Comment by Sergey Vojtovich [ 2019-02-03 ] |
|
I have WiP patches for os0once.h, which I'm planning to complete soon hopefully. |
| Comment by Marko Mäkelä [ 2019-02-04 ] |
|
The srv0mon.h would be refactored or removed by MDEV-15706 in a later release. |
| Comment by Sergey Vojtovich [ 2019-06-13 ] |
|
kevg, could you complete this effort? Specifically get rid of os0once. I pushed 2 WiP patches to bb-10.4-svoj- |
| Comment by Marko Mäkelä [ 2019-06-25 ] |
|
Looks good. I only had a minor request to replace a comment with a debug assertion. |