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


##########
pinot-core/src/main/java/org/apache/pinot/core/data/manager/realtime/RealtimeTableDataManager.java:
##########
@@ -203,6 +207,36 @@ protected void doInit() {
       Preconditions.checkState(schema != null, "Failed to find schema for 
table: %s", _tableNameWithType);
       _tableUpsertMetadataManager = 
TableUpsertMetadataManagerFactory.create(tableConfig, schema, this, 
_serverMetrics);
     }
+
+    // For dedup and partial-upsert, need to wait for all segments loaded 
before starting consuming data
+    if (isDedupEnabled() || isPartialUpsertEnabled()) {
+      _isTableReadyToConsumeData = new BooleanSupplier() {
+        volatile boolean _allSegmentsLoaded = false;
+        long _lastCheckTimeNs = Long.MIN_VALUE;
+
+        @Override
+        public boolean getAsBoolean() {
+          if (_allSegmentsLoaded) {
+            return true;
+          } else {
+            synchronized (this) {
+              if (_allSegmentsLoaded) {

Review Comment:
   Correct. We want to avoid lock when all segments are already loaded



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