leventov commented on a change in pull request #7838: Improve IncrementalIndex 
concurrency scalability
URL: https://github.com/apache/incubator-druid/pull/7838#discussion_r295934812
 
 

 ##########
 File path: 
processing/src/main/java/org/apache/druid/segment/incremental/IncrementalIndex.java
 ##########
 @@ -624,46 +626,67 @@ IncrementalIndexRowResult toIncrementalIndexRow(InputRow 
row)
     if (row.getTimestampFromEpoch() < minTimestamp) {
       throw new IAE("Cannot add row[%s] because it is below the 
minTimestamp[%s]", row, DateTimes.utc(minTimestamp));
     }
-    final List<String> rowDimensions = row.getDimensions();
+    DimensionData prevDimensionData = this.dimensions.get();
+    RowDimsKeyComponents dimsKeyComponents = getRowDimsKeyComponents(row, 
prevDimensionData);
+    DimensionData dimensionData = dimsKeyComponents.getUpdatedDimensionData();
+    while (dimensionData != null && 
!dimensions.compareAndSet(prevDimensionData, dimensionData)) {
+      prevDimensionData = dimensions.get();
+      dimsKeyComponents = getRowDimsKeyComponents(row, prevDimensionData);
 
 Review comment:
   As far as I understand, this line is the key for preventing a race 
condition. Please add a comment emphasizing this fact and explaining what race 
condition would be possible otherwise.

----------------------------------------------------------------
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]

Reply via email to