-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
[Backport 5.4] mv gossip: check errno instead of value returned by strtoull #18697
Open
mergify
wants to merge
1
commit into
branch-5.4
Choose a base branch
from
mergify/copy/branch-5.4/pr-18560
base: branch-5.4
Could not load branches
Branch not found: {{ refName }}
Could not load tags
Nothing to show
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Currently, when a view update backlog is changed and sent using gossip, we check whether the strtoll/strtoull function used for reading the backlog returned LLONG_MAX/ULLONG_MAX, signaling an error of a value exceeding the type's limit, and if so, we do not store it as the new value for the node. However, the ULLONG_MAX value can also be used as the max backlog size when sending empty backlogs that were never updated. In theory, we could avoid sending the default backlog because each node has its real backlog (based on the node's memory, different than the ULLONG_MAX used in the default backlog). In practice, if the node's backlog changed to 0, the backlog sent by it will be likely the default backlog, because when selecting the biggest backlog across node's shards, we use the operator<=>(), which treats the default backlog as equal to an empty backlog and we may get the default backlog during comparison if the backlog of some shard was never changed (also it's the initial max value we compare shard's backlogs against). This patch removes the (U)LLONG_MAX check and replaces it with the errno check, which is also set to ERANGE during the strtoll error, and which won't prevent empty backlogs from being read Fixes: #18462 (cherry picked from commit 64d133f)
🟢 CI State: SUCCESS✅ - Build Build Details:
|
denesb
pushed a commit
that referenced
this pull request
Jun 5, 2024
Currently, when a view update backlog is changed and sent using gossip, we check whether the strtoll/strtoull function used for reading the backlog returned LLONG_MAX/ULLONG_MAX, signaling an error of a value exceeding the type's limit, and if so, we do not store it as the new value for the node. However, the ULLONG_MAX value can also be used as the max backlog size when sending empty backlogs that were never updated. In theory, we could avoid sending the default backlog because each node has its real backlog (based on the node's memory, different than the ULLONG_MAX used in the default backlog). In practice, if the node's backlog changed to 0, the backlog sent by it will be likely the default backlog, because when selecting the biggest backlog across node's shards, we use the operator<=>(), which treats the default backlog as equal to an empty backlog and we may get the default backlog during comparison if the backlog of some shard was never changed (also it's the initial max value we compare shard's backlogs against). This patch removes the (U)LLONG_MAX check and replaces it with the errno check, which is also set to ERANGE during the strtoll error, and which won't prevent empty backlogs from being read Fixes: #18462 (cherry picked from commit 64d133f) Closes #18697
Q'd. |
denesb
pushed a commit
that referenced
this pull request
Jun 5, 2024
Currently, when a view update backlog is changed and sent using gossip, we check whether the strtoll/strtoull function used for reading the backlog returned LLONG_MAX/ULLONG_MAX, signaling an error of a value exceeding the type's limit, and if so, we do not store it as the new value for the node. However, the ULLONG_MAX value can also be used as the max backlog size when sending empty backlogs that were never updated. In theory, we could avoid sending the default backlog because each node has its real backlog (based on the node's memory, different than the ULLONG_MAX used in the default backlog). In practice, if the node's backlog changed to 0, the backlog sent by it will be likely the default backlog, because when selecting the biggest backlog across node's shards, we use the operator<=>(), which treats the default backlog as equal to an empty backlog and we may get the default backlog during comparison if the backlog of some shard was never changed (also it's the initial max value we compare shard's backlogs against). This patch removes the (U)LLONG_MAX check and replaces it with the errno check, which is also set to ERANGE during the strtoll error, and which won't prevent empty backlogs from being read Fixes: #18462 (cherry picked from commit 5154429) Closes #18697
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Currently, when a view update backlog is changed and sent
using gossip, we check whether the strtoll/strtoull
function used for reading the backlog returned
LLONG_MAX/ULLONG_MAX, signaling an error of a value
exceeding the type's limit, and if so, we do not store
it as the new value for the node.
However, the ULLONG_MAX value can also be used as the max
backlog size when sending empty backlogs that were never
updated. In theory, we could avoid sending the default
backlog because each node has its real backlog (based on
the node's memory, different than the ULLONG_MAX used in
the default backlog). In practice, if the node's
backlog changed to 0, the backlog sent by it will be
likely the default backlog, because when selecting
the biggest backlog across node's shards, we use the
operator<=>(), which treats the default backlog as
equal to an empty backlog and we may get the default
backlog during comparison if the backlog of some shard
was never changed (also it's the initial max value
we compare shard's backlogs against).
This patch removes the (U)LLONG_MAX check and replaces
it with the errno check, which is also set to ERANGE during
the strtoll error, and which won't prevent empty backlogs
from being read
Fixes: #18462
This patch should be backported to both 5.2 and 5.4 as it increases correctness and there should be no conflicts
(cherry picked from commit 64d133f)
Refs #18560