Skip to content
This repository was archived by the owner on May 6, 2022. It is now read-only.

Commit a357a04

Browse files
author
Florian Lautenschlager
committed
Fix #155: Due to synchronisation issues sometimes time series got lost.
1 parent 979886e commit a357a04

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

chronix-server-query-handler/src/main/java/de/qaware/chronix/solr/query/analysis/AnalysisHandler.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@ public List<SolrDocument> analyze(SolrQueryRequest req, CQLCFResult functions, M
270270
//loop over the types
271271
for (ChronixType type : collectedDocs.keySet()) {
272272

273-
List<ChronixTimeSeries> timeSeriesList = new ArrayList<>(collectedDocs.get(type).size());
273+
List<ChronixTimeSeries> timeSeriesList = Collections.synchronizedList(new ArrayList<>(collectedDocs.get(type).size()));
274274

275275
//do this in parallel as it contains deserialization
276276
collectedDocs.get(type).entrySet().parallelStream().forEach(docs -> {

chronix-server-test-integration/src/intTest/groovy/de/qaware/chronix/solr/ChronixClientTestIT.groovy

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -375,17 +375,16 @@ class ChronixClientTestIT extends Specification {
375375
result.length != 0
376376
}
377377
378-
def "Test all aggregations are executed 50 times (ticket #153)"() {
378+
def "Test all aggregations are executed 50 times (ticket #153,#155)"() {
379379
given:
380380
def query = new SolrQuery("*:*")
381381
query.setParam(ChronixQueryParams.CHRONIX_FUNCTION, "metric{avg;max}")
382382
query.addField("-data")
383383
384-
def test = true
385384
def success = true
386385
def iteration = 50
387386
when:
388-
while (test && iteration > 0) {
387+
while (success && iteration > 0) {
389388
List<MetricTimeSeries> timeSeriesList = chronix.stream(solr, query).collect(Collectors.toList())
390389
iteration = iteration - 1;
391390
@@ -400,10 +399,14 @@ class ChronixClientTestIT extends Specification {
400399
}
401400
402401
if (max == null || avg == null) {
403-
test = false
404402
success = false
405403
}
406404
}
405+
406+
//ensure we got 26 every time
407+
if (timeSeriesList.size() != 26i) {
408+
success = false
409+
}
407410
}
408411
409412

0 commit comments

Comments
 (0)