Skip to content

[BUG FIX] Add reference count control in NRTReplicationEngine#acquireLastIndexCommit#19214

Merged
kkewwei merged 6 commits intoopensearch-project:mainfrom
guojialiang92:dev/NRTReplicationEngine-acquireLastIndexCommit-add-ref-count-control
Sep 9, 2025
Merged

[BUG FIX] Add reference count control in NRTReplicationEngine#acquireLastIndexCommit#19214
kkewwei merged 6 commits intoopensearch-project:mainfrom
guojialiang92:dev/NRTReplicationEngine-acquireLastIndexCommit-add-ref-count-control

Conversation

@guojialiang92
Copy link
Copy Markdown
Contributor

Description

The purpose of this PR is to address the issues #19213.

When obtaining GatedCloseable<IndexCommit> in NRTReplicationEngine#acquireLastIndexCommit, the reference count of the files it contains is incremented by 1. When performing the close operation, the reference count is decremented by 1.

I introduced tests which could reproduce the issue stably before this fix:

  • SegmentReplicationIT#testAcquireLastIndexCommit
  • NRTReplicationEngineTests#testAcquireLastIndexCommit

Related Issues

Resolves #[19213]

Check List

  • Functionality includes testing.
  • API changes companion pull request created, if applicable.
  • Public documentation issue/PR created, if applicable.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Sep 2, 2025

❌ Gradle check result for ff2a581: FAILURE

Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change?

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Sep 2, 2025

❌ Gradle check result for b069d27: FAILURE

Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change?

Signed-off-by: guojialiang <guojialiang.2012@bytedance.com>
@guojialiang92 guojialiang92 force-pushed the dev/NRTReplicationEngine-acquireLastIndexCommit-add-ref-count-control branch from b069d27 to abe8112 Compare September 3, 2025 00:47
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Sep 3, 2025

❌ Gradle check result for abe8112: FAILURE

Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change?

@guojialiang92 guojialiang92 marked this pull request as draft September 3, 2025 05:32
Signed-off-by: guojialiang <guojialiang.2012@bytedance.com>
@guojialiang92 guojialiang92 marked this pull request as ready for review September 3, 2025 07:53
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Sep 8, 2025

❌ Gradle check result for e469570: FAILURE

Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change?

…managed by lock.

Signed-off-by: guojialiang <guojialiang.2012@bytedance.com>
@guojialiang92 guojialiang92 force-pushed the dev/NRTReplicationEngine-acquireLastIndexCommit-add-ref-count-control branch from e469570 to e622f98 Compare September 8, 2025 09:26
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Sep 8, 2025

❕ Gradle check result for e622f98: UNSTABLE

Please review all flaky tests that succeeded after retry and create an issue if one does not already exist to track the flaky failure.

@kkewwei
Copy link
Copy Markdown
Contributor

kkewwei commented Sep 8, 2025

@guojialiang92 Can you add the CHANGELOG.txt?

Signed-off-by: guojialiang <guojialiang.2012@bytedance.com>
Signed-off-by: guojialiang <guojialiang.2012@bytedance.com>
…ine-acquireLastIndexCommit-add-ref-count-control
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Sep 8, 2025

❕ Gradle check result for 92a555c: UNSTABLE

Please review all flaky tests that succeeded after retry and create an issue if one does not already exist to track the flaky failure.

@guojialiang92
Copy link
Copy Markdown
Contributor Author

@guojialiang92 Can you add the CHANGELOG.txt?

@kkewwei
Yeah, I have already modified the CHANGELOG.txt.
Could you please help review it again?

Copy link
Copy Markdown
Contributor

@kkewwei kkewwei left a comment

Choose a reason for hiding this comment

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

LGTM

@kkewwei kkewwei merged commit ceb27a2 into opensearch-project:main Sep 9, 2025
31 checks passed
jainankitk pushed a commit to jainankitk/OpenSearch that referenced this pull request Sep 22, 2025
…LastIndexCommit (opensearch-project#19214)

* NRTReplicationEngine#acquireLastIndexCommit add ref count control

Signed-off-by: guojialiang <guojialiang.2012@bytedance.com>

* fix test

Signed-off-by: guojialiang <guojialiang.2012@bytedance.com>

* the incRef in NRTReplicationEngine#commitSegmentInfos should also be managed by lock.

Signed-off-by: guojialiang <guojialiang.2012@bytedance.com>

* update test

Signed-off-by: guojialiang <guojialiang.2012@bytedance.com>

* add change log

Signed-off-by: guojialiang <guojialiang.2012@bytedance.com>

---------

Signed-off-by: guojialiang <guojialiang.2012@bytedance.com>
jainankitk pushed a commit to jainankitk/OpenSearch that referenced this pull request Sep 22, 2025
…LastIndexCommit (opensearch-project#19214)

* NRTReplicationEngine#acquireLastIndexCommit add ref count control

Signed-off-by: guojialiang <guojialiang.2012@bytedance.com>

* fix test

Signed-off-by: guojialiang <guojialiang.2012@bytedance.com>

* the incRef in NRTReplicationEngine#commitSegmentInfos should also be managed by lock.

Signed-off-by: guojialiang <guojialiang.2012@bytedance.com>

* update test

Signed-off-by: guojialiang <guojialiang.2012@bytedance.com>

* add change log

Signed-off-by: guojialiang <guojialiang.2012@bytedance.com>

---------

Signed-off-by: guojialiang <guojialiang.2012@bytedance.com>
Signed-off-by: Ankit Jain <jainankitk@apache.org>
jainankitk pushed a commit to jainankitk/OpenSearch that referenced this pull request Sep 22, 2025
…LastIndexCommit (opensearch-project#19214)

* NRTReplicationEngine#acquireLastIndexCommit add ref count control

Signed-off-by: guojialiang <guojialiang.2012@bytedance.com>

* fix test

Signed-off-by: guojialiang <guojialiang.2012@bytedance.com>

* the incRef in NRTReplicationEngine#commitSegmentInfos should also be managed by lock.

Signed-off-by: guojialiang <guojialiang.2012@bytedance.com>

* update test

Signed-off-by: guojialiang <guojialiang.2012@bytedance.com>

* add change log

Signed-off-by: guojialiang <guojialiang.2012@bytedance.com>

---------

Signed-off-by: guojialiang <guojialiang.2012@bytedance.com>
Signed-off-by: Ankit Jain <jainankitk@apache.org>
asimmahmood1 pushed a commit to jainankitk/OpenSearch that referenced this pull request Sep 23, 2025
…LastIndexCommit (opensearch-project#19214)

* NRTReplicationEngine#acquireLastIndexCommit add ref count control

Signed-off-by: guojialiang <guojialiang.2012@bytedance.com>

* fix test

Signed-off-by: guojialiang <guojialiang.2012@bytedance.com>

* the incRef in NRTReplicationEngine#commitSegmentInfos should also be managed by lock.

Signed-off-by: guojialiang <guojialiang.2012@bytedance.com>

* update test

Signed-off-by: guojialiang <guojialiang.2012@bytedance.com>

* add change log

Signed-off-by: guojialiang <guojialiang.2012@bytedance.com>

---------

Signed-off-by: guojialiang <guojialiang.2012@bytedance.com>
pranikum pushed a commit to pranikum/OpenSearch that referenced this pull request Sep 23, 2025
…LastIndexCommit (opensearch-project#19214)

* NRTReplicationEngine#acquireLastIndexCommit add ref count control

Signed-off-by: guojialiang <guojialiang.2012@bytedance.com>

* fix test

Signed-off-by: guojialiang <guojialiang.2012@bytedance.com>

* the incRef in NRTReplicationEngine#commitSegmentInfos should also be managed by lock.

Signed-off-by: guojialiang <guojialiang.2012@bytedance.com>

* update test

Signed-off-by: guojialiang <guojialiang.2012@bytedance.com>

* add change log

Signed-off-by: guojialiang <guojialiang.2012@bytedance.com>

---------

Signed-off-by: guojialiang <guojialiang.2012@bytedance.com>
vinaykpud pushed a commit to vinaykpud/OpenSearch that referenced this pull request Sep 26, 2025
…LastIndexCommit (opensearch-project#19214)

* NRTReplicationEngine#acquireLastIndexCommit add ref count control

Signed-off-by: guojialiang <guojialiang.2012@bytedance.com>

* fix test

Signed-off-by: guojialiang <guojialiang.2012@bytedance.com>

* the incRef in NRTReplicationEngine#commitSegmentInfos should also be managed by lock.

Signed-off-by: guojialiang <guojialiang.2012@bytedance.com>

* update test

Signed-off-by: guojialiang <guojialiang.2012@bytedance.com>

* add change log

Signed-off-by: guojialiang <guojialiang.2012@bytedance.com>

---------

Signed-off-by: guojialiang <guojialiang.2012@bytedance.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants