leventov commented on a change in pull request #7938: locking in Theta sketch
buffer aggregator
URL: https://github.com/apache/incubator-druid/pull/7938#discussion_r317998273
##########
File path:
extensions-core/datasketches/src/main/java/org/apache/druid/query/aggregation/datasketches/tuple/ArrayOfDoublesSketchBuildBufferAggregator.java
##########
@@ -94,7 +93,7 @@ public void aggregate(final ByteBuffer buf, final int
position)
// might might be considered, but it would increase complexity including
relocate() support.
final WritableMemory mem = WritableMemory.wrap(buf,
ByteOrder.LITTLE_ENDIAN);
final WritableMemory region = mem.writableRegion(position,
maxIntermediateSize);
- final Lock lock = stripedLock.getAt(lockIndex(position)).writeLock();
+ final Lock lock =
stripedLock.getAt(StripedLockHelper.lockIndex(position)).writeLock();
lock.lock();
try {
final ArrayOfDoublesUpdatableSketch sketch =
ArrayOfDoublesSketches.wrapUpdatableSketch(region);
Review comment:
If this statement can update the memory, please add a comment like //
ArrayOfDoublesSketches.wrapUpdatableSketch() can update the memory, therefore
it must be inside the critical section.`. Otherwise, please move the statement
outside of the critical section and add a comment like `//
ArrayOfDoublesSketches.wrapUpdatableSketch() cannot update the memory,
therefore it can be outside the critical section.`.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]