Skip to content
Snippets Groups Projects
Commit fe102ff7 authored by Vladimir Davydov's avatar Vladimir Davydov Committed by Vladimir Davydov
Browse files

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
parent d146adfe
No related branches found
No related tags found
No related merge requests found
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment