Skip to content

Commit 0183bb6

Browse files
dnhatnJeremyDahlgren
authored andcommitted
Fix testOptionalColumnAtATimeReaderWithSparseDocs (elastic#133781)
We should increment the timestamp for all documents; otherwise, the last two documents may share the same timestamp, resulting in an undefined order between them. Closes elastic#133766
1 parent 60f5707 commit 0183bb6

File tree

2 files changed

+2
-7
lines changed

2 files changed

+2
-7
lines changed

muted-tests.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -615,9 +615,6 @@ tests:
615615
- class: org.elasticsearch.xpack.esql.qa.single_node.GenerativeIT
616616
method: test
617617
issue: https://github.com/elastic/elasticsearch/issues/133077
618-
- class: org.elasticsearch.index.codec.tsdb.es819.ES819TSDBDocValuesFormatTests
619-
method: testOptionalColumnAtATimeReaderWithSparseDocs
620-
issue: https://github.com/elastic/elasticsearch/issues/133766
621618

622619
# Examples:
623620
#

server/src/test/java/org/elasticsearch/index/codec/tsdb/es819/ES819TSDBDocValuesFormatTests.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -939,13 +939,12 @@ public void testOptionalColumnAtATimeReaderWithSparseDocs() throws Exception {
939939
int numDocsPerQValue = 120;
940940
int numDocs = numDocsPerQValue * (1 + random().nextInt(40));
941941
Long[] temperatureValues = new Long[numDocs];
942-
943942
long q = 1;
944943
for (int i = 1; i <= numDocs; i++) {
945944
var d = new Document();
946-
long timestamp = currentTimestamp;
947945
// Index sorting doesn't work with NumericDocValuesField:
948-
d.add(SortedNumericDocValuesField.indexedField(timestampField, timestamp));
946+
d.add(SortedNumericDocValuesField.indexedField(timestampField, currentTimestamp));
947+
currentTimestamp += 1000L;
949948
d.add(new SortedNumericDocValuesField(counterField, currentCounter));
950949
d.add(new SortedDocValuesField(counterAsStringField, new BytesRef(Long.toString(currentCounter))));
951950
d.add(new SortedNumericDocValuesField(queryField, q));
@@ -962,7 +961,6 @@ public void testOptionalColumnAtATimeReaderWithSparseDocs() throws Exception {
962961
iw.commit();
963962
}
964963
if (i < numDocs - 1) {
965-
currentTimestamp += 1000L;
966964
currentCounter++;
967965
}
968966
}

0 commit comments

Comments
 (0)