|
63 | 63 | import java.util.function.Supplier; |
64 | 64 | import java.util.stream.IntStream; |
65 | 65 |
|
| 66 | +import static org.elasticsearch.index.codec.tsdb.es819.ES819TSDBDocValuesFormat.MIN_BLOCK_SIZE_BYTES; |
66 | 67 | import static org.elasticsearch.test.ESTestCase.randomAlphaOfLengthBetween; |
67 | 68 | import static org.elasticsearch.test.ESTestCase.randomBoolean; |
| 69 | +import static org.elasticsearch.test.ESTestCase.randomFloat; |
68 | 70 | import static org.elasticsearch.test.ESTestCase.randomFrom; |
69 | 71 | import static org.elasticsearch.test.ESTestCase.randomIntBetween; |
70 | 72 | import static org.hamcrest.Matchers.equalTo; |
@@ -98,18 +100,21 @@ public void testBlockWiseBinarySparse() throws Exception { |
98 | 100 | String hostnameField = "host.name"; |
99 | 101 | long baseTimestamp = 1704067200000L; |
100 | 102 | String binaryField = "binary_field"; |
| 103 | + boolean testVeryLargeValues = randomFloat() < 0.1; |
101 | 104 |
|
102 | 105 | var config = getTimeSeriesIndexWriterConfig(hostnameField, timestampField); |
103 | 106 | try (var dir = newDirectory(); var iw = new IndexWriter(dir, config)) { |
104 | 107 |
|
105 | 108 | int maxBlocks = 4; |
106 | | - int binaryDataSize = randomIntBetween(0, ES819TSDBDocValuesFormat.MIN_BLOCK_SIZE_BYTES * maxBlocks); |
| 109 | + int binaryDataSize = randomIntBetween(0, MIN_BLOCK_SIZE_BYTES * maxBlocks); |
107 | 110 |
|
108 | 111 | List<String> binaryValues = new ArrayList<>(); |
109 | 112 | int totalSize = 0; |
110 | 113 | while (totalSize < binaryDataSize) { |
111 | 114 | if (randomBoolean()) { |
112 | | - String value = randomAlphaOfLengthBetween(0, 100); |
| 115 | + final String value = testVeryLargeValues |
| 116 | + ? randomAlphaOfLengthBetween(MIN_BLOCK_SIZE_BYTES / 2, 2 * MIN_BLOCK_SIZE_BYTES) |
| 117 | + : randomAlphaOfLengthBetween(0, 50); |
113 | 118 | binaryValues.add(value); |
114 | 119 | totalSize += value.length(); |
115 | 120 | } else { |
@@ -162,17 +167,21 @@ public void testBlockWiseBinaryDense() throws Exception { |
162 | 167 | String hostnameField = "host.name"; |
163 | 168 | long baseTimestamp = 1704067200000L; |
164 | 169 | String binaryField = "binary_field"; |
| 170 | + boolean testVeryLargeValues = randomFloat() < 0.1; |
165 | 171 |
|
166 | 172 | var config = getTimeSeriesIndexWriterConfig(hostnameField, timestampField); |
167 | 173 | try (var dir = newDirectory(); var iw = new IndexWriter(dir, config)) { |
168 | 174 |
|
169 | 175 | int maxBlocks = 4; |
170 | | - int binaryDataSize = randomIntBetween(0, ES819TSDBDocValuesFormat.MIN_BLOCK_SIZE_BYTES * maxBlocks); |
| 176 | + int binaryDataSize = randomIntBetween(0, MIN_BLOCK_SIZE_BYTES * maxBlocks); |
171 | 177 |
|
172 | 178 | List<String> binaryValues = new ArrayList<>(); |
173 | 179 | int totalSize = 0; |
174 | 180 | while (totalSize < binaryDataSize) { |
175 | | - String value = randomAlphaOfLengthBetween(0, 100); |
| 181 | + final String value = testVeryLargeValues |
| 182 | + ? randomAlphaOfLengthBetween(MIN_BLOCK_SIZE_BYTES / 2, 2 * MIN_BLOCK_SIZE_BYTES) |
| 183 | + : randomAlphaOfLengthBetween(0, 50); |
| 184 | + |
176 | 185 | binaryValues.add(value); |
177 | 186 | totalSize += value.length(); |
178 | 187 | } |
|
0 commit comments