Jackie-Jiang commented on code in PR #17324:
URL: https://github.com/apache/pinot/pull/17324#discussion_r2677813101
##########
pinot-segment-local/src/main/java/org/apache/pinot/segment/local/upsert/ConcurrentMapPartitionUpsertMetadataManager.java:
##########
@@ -139,14 +148,19 @@ protected void doAddOrReplaceSegment(ImmutableSegmentImpl
segment, ThreadSafeMut
currentSegmentName, getAuthoritativeCreationTime(segment),
getAuthoritativeCreationTime(currentSegment)))) {
replaceDocId(segment, validDocIds, queryableDocIds,
currentSegment, currentDocId, newDocId, recordInfo);
+ if (currentSegment != segment) {
+ _previousKeyToRecordLocationMap.put(primaryKey,
currentRecordLocation);
Review Comment:
I don't follow this. Shouldn't we check if the key exist in this map?
##########
pinot-segment-local/src/main/java/org/apache/pinot/segment/local/upsert/ConcurrentMapPartitionUpsertMetadataManager.java:
##########
@@ -139,14 +148,19 @@ protected void doAddOrReplaceSegment(ImmutableSegmentImpl
segment, ThreadSafeMut
currentSegmentName, getAuthoritativeCreationTime(segment),
getAuthoritativeCreationTime(currentSegment)))) {
replaceDocId(segment, validDocIds, queryableDocIds,
currentSegment, currentDocId, newDocId, recordInfo);
+ if (currentSegment != segment) {
Review Comment:
This if condition is always true.
##########
pinot-segment-local/src/main/java/org/apache/pinot/segment/local/upsert/ConcurrentMapPartitionUpsertMetadataManager.java:
##########
@@ -89,7 +93,12 @@ protected void doAddOrReplaceSegment(ImmutableSegmentImpl
segment, ThreadSafeMut
if (currentSegment == segment) {
if (comparisonResult >= 0) {
replaceDocId(segment, validDocIds, queryableDocIds,
currentDocId, newDocId, recordInfo);
- return new RecordLocation(segment, newDocId,
newComparisonValue);
+ RecordLocation newRecordLocation = new
RecordLocation(segment, newDocId, newComparisonValue);
+ // Track the record location of the newly added keys
+ if (_newlyAddedKeys.containsKey(primaryKey)) {
Review Comment:
Is this possible? The current location points to the segment itself. Why
would it be newly added?
##########
pinot-segment-local/src/main/java/org/apache/pinot/segment/local/upsert/ConcurrentMapPartitionUpsertMetadataManager.java:
##########
@@ -139,14 +148,19 @@ protected void doAddOrReplaceSegment(ImmutableSegmentImpl
segment, ThreadSafeMut
currentSegmentName, getAuthoritativeCreationTime(segment),
getAuthoritativeCreationTime(currentSegment)))) {
replaceDocId(segment, validDocIds, queryableDocIds,
currentSegment, currentDocId, newDocId, recordInfo);
+ if (currentSegment != segment) {
+ _previousKeyToRecordLocationMap.put(primaryKey,
currentRecordLocation);
+ }
return new RecordLocation(segment, newDocId,
newComparisonValue);
} else {
return currentRecordLocation;
}
} else {
// New primary key
addDocId(segment, validDocIds, queryableDocIds, newDocId,
recordInfo);
- return new RecordLocation(segment, newDocId, newComparisonValue);
+ RecordLocation newRecordLocation = new RecordLocation(segment,
newDocId, newComparisonValue);
+ _newlyAddedKeys.put(primaryKey, newRecordLocation);
Review Comment:
Why do we add it here?
--
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]