Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rabbit_peer_discovery: Cache computed node start time #13128

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

dumbbell
Copy link
Member

Why

The computation of a node's system-time-based start time is based on its monotonic-time-based start time plus the current time offset.

However, since Erlang/OTP 26, that time offset is volatile by default. Therefore the computed system-time-based start time can change too. It happens in CI and this affects the seed node selection in the peer discovery code: because the sorting is unstable when the start time is the criteria, different instances of the peen discovery code could select a different node.

How

The same code is used to compute the start time. However, the computed value is cached in a persistent_term for future queries. This way we ensure that the value is computed once and thus all queries will return the same result.

[Why]
The computation of a node's system-time-based start time is based on its
monotonic-time-based start time plus the current time offset.

However, since Erlang/OTP 26, that time offset is volatile by default.
Therefore the computed system-time-based start time can change too. It
happens in CI and this affects the seed node selection in the peer
discovery code: because the sorting is unstable when the start time is
the criteria, different instances of the peen discovery code could
select a different node.

[How]
The same code is used to compute the start time. However, the computed
value is cached in a persistent_term for future queries. This way we
ensure that the value is computed once and thus all queries will return
the same result.
@dumbbell dumbbell force-pushed the fix-peer-disc-node-sorting-with-erlang26 branch from 0d89189 to 3dd8a24 Compare January 23, 2025 17:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant