-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
[Segment Replication] Update getLatestReplicationCheckpoint for closed indices #4532
[Segment Replication] Update getLatestReplicationCheckpoint for closed indices #4532
Conversation
…ndices Signed-off-by: Suraj Singh <surajrider@gmail.com>
Signed-off-by: Suraj Singh <surajrider@gmail.com>
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
@@ -1405,7 +1405,8 @@ public ReplicationCheckpoint getLatestReplicationCheckpoint() { | |||
if (indexSettings.isSegRepEnabled() == false) { | |||
return null; | |||
} | |||
if (getEngineOrNull() == null) { | |||
final IndexMetadata indexMetadata = indexSettings.getIndexMetadata(); | |||
if (getEngineOrNull() == null || (indexMetadata != null && indexMetadata.getState() == IndexMetadata.State.CLOSE)) { | |||
return ReplicationCheckpoint.empty(shardId); |
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'm not sure we have a use case for actually using these checkpoints when the shard is closed, but even so I think we may want to change this logic to actually read and return the current checkpoint instead of returning empty. A shard could be closed but have a local commit. We can check for the presence of a segments_n and compute the checkpoint from the store with store.readLastCommittedSegmentsInfo
. Where the processed seqNo can be read from user data.
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.
Thanks @mch2 for the review and calling this out. Updating.
server/src/main/java/org/opensearch/index/shard/IndexShard.java
Outdated
Show resolved
Hide resolved
9ab5caf
to
2759e47
Compare
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
Signed-off-by: Suraj Singh <surajrider@gmail.com>
2759e47
to
703427f
Compare
This comment was marked as outdated.
This comment was marked as outdated.
Gradle Check (Jenkins) Run Completed with:
|
Codecov Report
@@ Coverage Diff @@
## main #4532 +/- ##
============================================
+ Coverage 70.62% 70.74% +0.12%
- Complexity 57263 57368 +105
============================================
Files 4617 4617
Lines 275499 275509 +10
Branches 40331 40332 +1
============================================
+ Hits 194562 194909 +347
+ Misses 64528 64259 -269
+ Partials 16409 16341 -68
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
@mch2 : Addressed the review comments, can you please have a look ? |
Gradle Check (Jenkins) Run Completed with:
|
Flaky test tracked in #4162
|
Gradle Check (Jenkins) Run Completed with:
|
// If index is closed, read replication checkpoint from last committed segments info on local store | ||
if (indexSettings.getIndexMetadata().getState() == IndexMetadata.State.CLOSE) { | ||
try { | ||
final SegmentInfos segmentInfos = store.readLastCommittedSegmentsInfo(); |
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.
How will this behave if the engine is not yet open? I think we need to check for the existence of a commit first. This method will throw if one is not present.
@dreamer-89 Is this still required? it's pending for review for a while |
@anasalkouz : Yes, this is needed and appears while running ClosedIndices* integration tests. This was initially needed for CCR (as mentioned in description) but now appears to be a valid use case related to closed indices. I will work on this PR. |
Closing this stale PR, tracking fix in #6828 |
Signed-off-by: Suraj Singh surajrider@gmail.com
Description
This change updates the IndexShard.getLatestReplicationCheckpoint to return empty checkpoint for closed indices. This change is needed as when indices are closed, shard info is still shared among nodes via transport actions as mentioned in #3823 (comment)
Issues Related
#3823
Check List
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.