Skip to content

Conversation

DaveCTurner
Copy link
Contributor

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.

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.
@DaveCTurner DaveCTurner requested a review from ywangd July 15, 2025 07:43
@DaveCTurner DaveCTurner added >non-issue :Distributed Coordination/Snapshot/Restore Anything directly related to the `_snapshot/*` APIs v9.2.0 labels Jul 15, 2025
@elasticsearchmachine elasticsearchmachine added the Team:Distributed Coordination Meta label for Distributed Coordination team label Jul 15, 2025
@elasticsearchmachine
Copy link
Collaborator

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());
Copy link
Contributor

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?

Copy link
Contributor Author

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".

Copy link
Contributor Author

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:

final DiscoveryNode node = nodes.get(i < nodes.size() ? i : random.nextInt(nodes.size()));

Copy link
Member

@ywangd ywangd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@DaveCTurner DaveCTurner merged commit 01c09cb into elastic:main Jul 16, 2025
33 checks passed
@DaveCTurner DaveCTurner deleted the 2025/07/15/repo-analysis-increment-counter branch July 16, 2025 07:12
szybia added a commit to szybia/elasticsearch that referenced this pull request Jul 16, 2025
…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 ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

:Distributed Coordination/Snapshot/Restore Anything directly related to the `_snapshot/*` APIs >non-issue Team:Distributed Coordination Meta label for Distributed Coordination team v9.2.0

4 participants