richardstartin commented on a change in pull request #7450: URL: https://github.com/apache/pinot/pull/7450#discussion_r711524176
########## File path: pinot-core/src/main/java/org/apache/pinot/core/operator/combine/GroupByOrderByCombineOperator.java ########## @@ -125,43 +123,44 @@ public String getOperatorName() { */ @Override protected void processSegments(int threadIndex) { - try { - IntermediateResultsBlock intermediateResultsBlock = - (IntermediateResultsBlock) _operators.get(threadIndex).nextBlock(); - - _initLock.lock(); - try { - if (_dataSchema == null) { - _dataSchema = intermediateResultsBlock.getDataSchema(); - // NOTE: Use trimSize as resultSize on server size. - if (_trimThreshold >= MAX_TRIM_THRESHOLD) { - // special case of trim threshold where it is set to max value. - // there won't be any trimming during upsert in this case. - // thus we can avoid the overhead of read-lock and write-lock - // in the upsert method. - _indexedTable = new UnboundedConcurrentIndexedTable(_dataSchema, _queryContext, _trimSize); - } else { - _indexedTable = - new ConcurrentIndexedTable(_dataSchema, _queryContext, _trimSize, _trimSize, _trimThreshold); + for (int operatorIndex = threadIndex; operatorIndex < _numOperators; operatorIndex += _numThreads) { + IntermediateResultsBlock resultsBlock = (IntermediateResultsBlock) _operators.get(operatorIndex).nextBlock(); + + if (_indexedTable == null) { + _initLock.lock(); + try { + if (_indexedTable == null) { Review comment: Because `_indexedTable` isn't volatile, double checked locking doesn't work. The JMM allows reordering of the checks and lock. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@pinot.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@pinot.apache.org For additional commands, e-mail: commits-h...@pinot.apache.org