- Notifications
You must be signed in to change notification settings - Fork 25.6k
Simplify expectedFinalRegisterValue
computation #131274
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
Simplify expectedFinalRegisterValue
computation #131274
Conversation
In repository analysis we keep an `AtomicLong` counting the number of successfully-completed increments on the contended register, but we only check this value if all the increments succeed. We know how many increments we enqueue up-front so there's no need to count them as they complete. This commit removes the unnecessary counter.
Pinging @elastic/es-distributed-coordination (Team:Distributed Coordination) |
if (minClusterTransportVersion.onOrAfter(TransportVersions.V_8_8_0)) { | ||
final String contendedRegisterName = CONTENDED_REGISTER_NAME_PREFIX + UUIDs.randomBase64UUID(random); | ||
final AtomicBoolean contendedRegisterAnalysisComplete = new AtomicBoolean(); | ||
final int registerOperations = Math.max(nodes.size(), request.getRegisterOperationCount()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When would this value need to be nodes.size()
? Ie, if we have 5 nodes but there have been nothing registered so far, does it make sense to be passing 5 as a parameter here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you're reading "register" as a verb, but it's a noun here. The variable name registerOperations
means "number of operations on the register".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
... and we want to do at least one such operation from every node, maybe more if requested:
Line 506 in a2b4a6f
final DiscoveryNode node = nodes.get(i < nodes.size() ? i : random.nextInt(nodes.size())); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
…king * upstream/main: (91 commits) Mute org.elasticsearch.packaging.test.DockerTests test130JavaHasCorrectOwnership elastic#131369 Add exception logging when interrupted (elastic#131153) Mute org.elasticsearch.packaging.test.DockerTests test140CgroupOsStatsAreAvailable elastic#131372 Mute org.elasticsearch.packaging.test.DockerTests test070BindMountCustomPathConfAndJvmOptions elastic#131366 Mute org.elasticsearch.xpack.test.rest.XPackRestIT test {p0=ml/delete_expired_data/Test delete expired data with body parameters} elastic#131364 Mute org.elasticsearch.xpack.esql.vector.VectorSimilarityFunctionsIT testSimilarityBetweenConstantVectorAndField {functionName=v_cosine similarityFunction=COSINE} elastic#131363 Mute org.elasticsearch.xpack.esql.vector.VectorSimilarityFunctionsIT testDifferentDimensions {functionName=v_cosine similarityFunction=COSINE} elastic#131362 Mute org.elasticsearch.xpack.esql.vector.VectorSimilarityFunctionsIT testSimilarityBetweenConstantVectors {functionName=v_cosine similarityFunction=COSINE} elastic#131361 Check SCORE_FUNCTION capability in VerifierTests (elastic#131352) Replace deprecated routingTable table call in tests (elastic#131005) [DOCS] Remove misused applies_to tag (elastic#131349) Adj ivf postings list building (elastic#130843) [Transform] Read metadata from Project State (elastic#131205) Add note on o11y to architecture guide (elastic#131291) Upgrade AWS Java SDK to 2.31.78 (elastic#131050) Support Fields API in conditional ingest processors (elastic#121914) ESQL - KNN function uses prefilters when pushed down to Lucene (elastic#131004) Add docs for ES|QL query logs (elastic#131287) Simplify `expectedFinalRegisterValue` computation (elastic#131274) Mute org.elasticsearch.test.rest.yaml.RcsCcsCommonYamlTestSuiteIT test {p0=search/110_field_collapsing/field collapsing, inner_hits and maxConcurrentGroupRequests} elastic#131348 ...
In repository analysis we keep an
AtomicLong
counting the number ofsuccessfully-completed increments on the contended register, but we only
check this value if all the increments succeed. We know how many
increments we enqueue up-front so there's no need to count them as they
complete. This commit removes the unnecessary counter.