ankitsultana commented on code in PR #10815:
URL: https://github.com/apache/pinot/pull/10815#discussion_r1258504948


##########
pinot-controller/src/main/java/org/apache/pinot/controller/helix/core/realtime/PinotLLCRealtimeSegmentManager.java:
##########
@@ -492,15 +498,17 @@ public void commitSegmentFile(String realtimeTableName, 
CommittingSegmentDescrip
     // We only clean up tmp segment files in table level dir, so there's no 
need to list recursively.
     // See LLCSegmentCompletionHandlers.uploadSegment().
     // TODO: move tmp file logic into SegmentCompletionUtils.

Review Comment:
   I think we can remove this TODO now.



##########
pinot-common/src/main/java/org/apache/pinot/common/metrics/ValidationMetrics.java:
##########
@@ -239,6 +239,14 @@ public void cleanupSegmentCountGauge(final String 
resource) {
     removeGauge(resource, ValidationMetricName.SEGMENT_COUNT);
   }
 
+  public void updateTmpSegCountGauge(final String resource, final long 
tmpSegmentCount) {

Review Comment:
   Would recommend to reword `Seg` to `Segment` to be consistent with the 
current code.



##########
pinot-common/src/main/java/org/apache/pinot/common/metrics/ValidationMetrics.java:
##########
@@ -239,6 +239,14 @@ public void cleanupSegmentCountGauge(final String 
resource) {
     removeGauge(resource, ValidationMetricName.SEGMENT_COUNT);
   }
 
+  public void updateTmpSegCountGauge(final String resource, final long 
tmpSegmentCount) {
+    makeGauge(resource, ValidationMetricName.DELETED_TMP_SEGMENT_COUNT, 
_storedValueGaugeFactory, tmpSegmentCount);
+  }
+
+  public void cleanupTmpSegCountGauge(final String resource) {
+    removeGauge(resource, ValidationMetricName.SEGMENT_COUNT);

Review Comment:
   This should be `ValidationMetricName.DELETED_TMP_SEGMENT_COUNT`?



##########
pinot-controller/src/main/java/org/apache/pinot/controller/ControllerConf.java:
##########
@@ -215,9 +219,14 @@ public static class ControllerPeriodicTasksConf {
         "controller.realtime.segment.deepStoreUploadRetryEnabled";
     public static final String DEEP_STORE_RETRY_UPLOAD_TIMEOUT_MS =
         "controller.realtime.segment.deepStoreUploadRetry.timeoutMs";
+    public static final String ENABLE_TMP_SEGMENT_ASYNC_DELETION =
+        "controller.realtime.split.commit.segment.tmp.cleanup.async.enable";

Review Comment:
   Based on this config we should either run or skip the 
`RealtimeTempSegmentCleaner`. I think that's not wired right now.



##########
pinot-controller/src/main/java/org/apache/pinot/controller/ControllerConf.java:
##########
@@ -921,10 +953,19 @@ public boolean isDeepStoreRetryUploadLLCSegmentEnabled() {
     return 
getProperty(ControllerPeriodicTasksConf.ENABLE_DEEP_STORE_RETRY_UPLOAD_LLC_SEGMENT,
 false);
   }
 
+  public boolean isTmpSegmentAsyncDeletionEnabled() {
+    return 
getProperty(ControllerPeriodicTasksConf.ENABLE_TMP_SEGMENT_ASYNC_DELETION, 
false);
+  }
+
   public int getDeepStoreRetryUploadTimeoutMs() {
     return 
getProperty(ControllerPeriodicTasksConf.DEEP_STORE_RETRY_UPLOAD_TIMEOUT_MS, -1);
   }
 
+  public int getTmpSegmentRetentionInSeconds() {
+    return 
getProperty(ControllerPeriodicTasksConf.SPLIT_COMMIT_TMP_SEGMENT_LIFETIME_SECOND,

Review Comment:
   Is this config needed? Looks like it's getting used in realtime segment 
commit flow for split-commit tables only. The number of configs are already 
quite high so unless it's absolutely needed I'd recommend skipping it.



##########
pinot-controller/src/main/java/org/apache/pinot/controller/validation/RealtimeTempSegmentCleaner.java:
##########
@@ -0,0 +1,70 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.pinot.controller.validation;
+
+import java.util.List;
+import org.apache.pinot.common.metrics.ControllerMetrics;
+import org.apache.pinot.common.metrics.ValidationMetrics;
+import org.apache.pinot.controller.ControllerConf;
+import org.apache.pinot.controller.LeadControllerManager;
+import org.apache.pinot.controller.helix.core.PinotHelixResourceManager;
+import 
org.apache.pinot.controller.helix.core.periodictask.ControllerPeriodicTask;
+import 
org.apache.pinot.controller.helix.core.realtime.PinotLLCRealtimeSegmentManager;
+import org.apache.pinot.spi.utils.builder.TableNameBuilder;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+
+public class RealtimeTempSegmentCleaner extends ControllerPeriodicTask<Void> {

Review Comment:
   Let's call it tmp everywhere for consistency



##########
pinot-controller/src/main/java/org/apache/pinot/controller/BaseControllerStarter.java:
##########
@@ -706,6 +710,8 @@ protected List<PeriodicTask> setupControllerPeriodicTasks() 
{
         new TaskMetricsEmitter(_helixResourceManager, 
_helixTaskResourceManager, _leadControllerManager, _config,
             _controllerMetrics);
     periodicTasks.add(_taskMetricsEmitter);
+    _realtimeTempSegmentCleaner = new RealtimeTempSegmentCleaner(_config, 
_helixResourceManager, _leadControllerManager,
+        _pinotLLCRealtimeSegmentManager, _validationMetrics, 
_controllerMetrics);

Review Comment:
   This is not added to `periodicTasks`?



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