Skip to content

Commit 3383244

Browse files
parkertimminssaikatsarkar056
authored andcommitted
ReindexDataStreamIndex bug in assertion caused by reference equality (elastic#121325)
Assertion was using reference equality on two boxed longs. So assertion could produce false positives. Change to Objects.equals to check value and avoid null check.
1 parent 0de82df commit 3383244

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

docs/changelog/121325.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
pr: 121325
2+
summary: '`ReindexDataStreamIndex` bug in assertion caused by reference equality'
3+
area: Data streams
4+
type: bug
5+
issues: []

x-pack/plugin/migrate/src/main/java/org/elasticsearch/xpack/migrate/action/ReindexDataStreamIndexTransportAction.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@
5454

5555
import java.util.Locale;
5656
import java.util.Map;
57+
import java.util.Objects;
5758

5859
import static org.elasticsearch.cluster.metadata.IndexMetadata.APIBlock.WRITE;
5960

@@ -372,7 +373,7 @@ private void sanityCheck(
372373
listener.delegateFailureAndWrap((delegate, ignored) -> {
373374
getIndexDocCount(sourceIndexName, parentTaskId, delegate.delegateFailureAndWrap((delegate1, sourceCount) -> {
374375
getIndexDocCount(destIndexName, parentTaskId, delegate1.delegateFailureAndWrap((delegate2, destCount) -> {
375-
assert sourceCount == destCount
376+
assert Objects.equals(sourceCount, destCount)
376377
: String.format(
377378
Locale.ROOT,
378379
"source index [%s] has %d docs and dest [%s] has %d docs",

0 commit comments

Comments
 (0)