Jackie-Jiang commented on code in PR #11811:
URL: https://github.com/apache/pinot/pull/11811#discussion_r1361283531


##########
pinot-segment-local/src/main/java/org/apache/pinot/segment/local/indexsegment/mutable/MutableSegmentImpl.java:
##########
@@ -489,12 +489,16 @@ public boolean index(GenericRow row, @Nullable 
RowMetadata rowMetadata)
     if (isUpsertEnabled()) {
       RecordInfo recordInfo = getRecordInfo(row, numDocsIndexed);
       GenericRow updatedRow = 
_partitionUpsertMetadataManager.updateRecord(row, recordInfo);
-      updateDictionary(updatedRow);
-      addNewRow(numDocsIndexed, updatedRow);
-      // Update number of documents indexed before handling the upsert 
metadata so that the record becomes queryable
-      // once validated
-      canTakeMore = numDocsIndexed++ < _capacity;
-      _partitionUpsertMetadataManager.addRecord(this, recordInfo);
+      // if record doesn't need to be dropped, then persist in segment and 
update metadata hashmap
+      if (!_partitionUpsertMetadataManager.shouldDropRecord(recordInfo)) {

Review Comment:
   This check is already performed in `doAddRecord()`. Suggest modifying 
`addRecord()` to return `boolean` which indicates whether the record should be 
kept. Then we may modify this part into
   ```suggestion
         if (_partitionUpsertMetadataManager.addRecord(this, recordInfo)) {
   ```



##########
pinot-segment-local/src/main/java/org/apache/pinot/segment/local/upsert/ConcurrentMapPartitionUpsertMetadataManager.java:
##########
@@ -56,9 +56,9 @@ public class ConcurrentMapPartitionUpsertMetadataManager 
extends BasePartitionUp
   public ConcurrentMapPartitionUpsertMetadataManager(String tableNameWithType, 
int partitionId,
       List<String> primaryKeyColumns, List<String> comparisonColumns, 
@Nullable String deleteRecordColumn,
       HashFunction hashFunction, @Nullable PartialUpsertHandler 
partialUpsertHandler, boolean enableSnapshot,
-      double metadataTTL, File tableIndexDir, ServerMetrics serverMetrics) {
+      double metadataTTL, File tableIndexDir, ServerMetrics serverMetrics, 
boolean dropOutOfOrderRecord) {

Review Comment:
   (minor) Suggest moving it after `enableSnapshot`



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to