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

Commit

Permalink
Fix #155: Due to synchronisation issues sometimes time series got lost.
Browse files Browse the repository at this point in the history
  • Loading branch information
Florian Lautenschlager committed Nov 18, 2019
1 parent 979886e commit a357a04
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ public List<SolrDocument> analyze(SolrQueryRequest req, CQLCFResult functions, M
//loop over the types
for (ChronixType type : collectedDocs.keySet()) {

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

//do this in parallel as it contains deserialization
collectedDocs.get(type).entrySet().parallelStream().forEach(docs -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -375,17 +375,16 @@ class ChronixClientTestIT extends Specification {
result.length != 0
}
def "Test all aggregations are executed 50 times (ticket #153)"() {
def "Test all aggregations are executed 50 times (ticket #153,#155)"() {
given:
def query = new SolrQuery("*:*")
query.setParam(ChronixQueryParams.CHRONIX_FUNCTION, "metric{avg;max}")
query.addField("-data")
def test = true
def success = true
def iteration = 50
when:
while (test && iteration > 0) {
while (success && iteration > 0) {
List<MetricTimeSeries> timeSeriesList = chronix.stream(solr, query).collect(Collectors.toList())
iteration = iteration - 1;
Expand All @@ -400,10 +399,14 @@ class ChronixClientTestIT extends Specification {
}
if (max == null || avg == null) {
test = false
success = false
}
}
//ensure we got 26 every time
if (timeSeriesList.size() != 26i) {
success = false
}
}
Expand Down

0 comments on commit a357a04

Please sign in to comment.