walterddr commented on code in PR #12241:
URL: https://github.com/apache/pinot/pull/12241#discussion_r1445499175
##########
pinot-core/src/main/java/org/apache/pinot/core/data/manager/realtime/RealtimeTableDataManager.java:
##########
@@ -562,6 +570,25 @@ private void handleUpsert(ImmutableSegment
immutableSegment) {
}
}
+ // Same as the SegmentLocks, but just for handleUpsert method to synchronize
threads doing segment replacement.
+ private static class UpsertSegmentLocks {
Review Comment:
i was thinking:
```
public class SegmentLocks {
private static final SegmentLocks GENERIC_LOCK = new SegmentLocks();
private static final SegmentLocks UPSERT_LOCK = new SegmentLocks();
private final Lock[] _locks = new Lock[NUM_LOCKS];
private SegmentLocks() {
for (int i = 0; i < NUM_LOCKS; i++) {
_locks[i] = new ReentrantLock();
}
}
private Lock getLock(String tableNameWithType, String segmentName) {
return _locks[Math.abs((31 * tableNameWithType.hashCode() +
segmentName.hashCode()) % NUM_LOCKS)];
}
public static Lock getSegmentLock(String tableNameWithType, String
segmentName) {
return GENERIC_LOCK.getLock(tableNameWithType, segmentName);
}
public static Lock getUpsertLock(String tableNameWithType, String
segmentName) {
return UPSERT_LOCK.getLock(tableNameWithType, segmentName);
}
```
--
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]