memtx: reuse read views to prevent read_view_version wrap around
The total number of read views that we can possibly (not necessarily simultaneously) ever create is limited by UINT32_MAX, because we use uint32_t for read view versioning and read view version must never wrap around. If read views were only used for making snapshots or joining replicas, this would be fine, because even if we made a snaphost every second (which is hardly possible), it'd take more than one hundred years for the read view version to wrap around. However, if read views could be created by users (which is our ultimate goal), they could get created as often as every millisecond, which would reduce the wrap around window down to one month, which is unacceptable. Let's fix this issue by reusing the most recent read views in case it was created less than 100 ms ago. The algorithm is described in the comments to the code. Closes #7189 NO_DOC=internal NO_CHANGELOG=internal
Showing
- src/box/memtx_allocator.cc 17 additions, 0 deletionssrc/box/memtx_allocator.cc
- src/box/memtx_allocator.h 71 additions, 2 deletionssrc/box/memtx_allocator.h
- test/unit/memtx_allocator.cc 93 additions, 1 deletiontest/unit/memtx_allocator.cc
- test/unit/memtx_allocator.result 21 additions, 1 deletiontest/unit/memtx_allocator.result
Loading
Please register or sign in to comment