gianm commented on code in PR #19091:
URL: https://github.com/apache/druid/pull/19091#discussion_r2897173162
##########
indexing-service/src/main/java/org/apache/druid/indexing/common/actions/SegmentTransactionalInsertAction.java:
##########
@@ -323,6 +328,19 @@ private static Map<Interval, List<DataSegment>>
groupSegmentsByIntervalAndSort(S
return segmentsMap;
}
+ /**
+ * A failed publish action should be retried only if there is another task
+ * waiting to publish offsets for an overlapping set of partitions.
+ */
+ private boolean shouldNotRetryFailure(SegmentPublishResult result, Task
task, TaskActionToolbox toolbox)
Review Comment:
It would be clearer to call this `shouldFailImmediately`.
##########
indexing-service/src/main/java/org/apache/druid/indexing/seekablestream/supervisor/autoscaler/CostBasedAutoScaler.java:
##########
@@ -452,7 +453,12 @@ static double extractMovingAverage(Map<String, Map<String,
Object>> taskStats)
}
}
- return count > 0 ? sum / count : -1;
+ if (count > 0) {
+ return sum / count;
+ } else {
+ return -1;
+ }
+ // return count > 0 ? sum / count : -1;
Review Comment:
Please don't include commented-out code.
##########
embedded-tests/src/test/java/org/apache/druid/testing/embedded/indexing/KafkaIndexAutoScalingTest.java:
##########
@@ -0,0 +1,160 @@
+/*
+ * 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.druid.testing.embedded.indexing;
+
+import com.fasterxml.jackson.core.type.TypeReference;
+import org.apache.druid.guice.ClusterTestingModule;
+import org.apache.druid.indexer.TaskState;
+import org.apache.druid.indexer.TaskStatusPlus;
+import org.apache.druid.indexing.kafka.simulate.KafkaResource;
+import org.apache.druid.indexing.kafka.supervisor.KafkaSupervisorSpec;
+import org.apache.druid.indexing.overlord.supervisor.SupervisorSpec;
+import
org.apache.druid.indexing.seekablestream.supervisor.autoscaler.CostBasedAutoScalerConfig;
+import org.apache.druid.java.util.common.StringUtils;
+import org.apache.druid.query.DruidMetrics;
+import org.apache.druid.rpc.RequestBuilder;
+import org.apache.druid.testing.cluster.overlord.HttpLagAggregator;
+import org.apache.druid.testing.embedded.EmbeddedClusterApis;
+import org.apache.druid.testing.embedded.EmbeddedDruidCluster;
+import org.apache.druid.testing.embedded.StreamIngestResource;
+import org.hamcrest.Matchers;
+import org.jboss.netty.handler.codec.http.HttpMethod;
+import org.joda.time.Duration;
+import org.joda.time.Period;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Test;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * Work in progress.
Review Comment:
I assume you intend to finish this before merging the PR.
##########
indexing-service/src/main/java/org/apache/druid/indexing/common/actions/SegmentTransactionalInsertAction.java:
##########
@@ -323,6 +328,19 @@ private static Map<Interval, List<DataSegment>>
groupSegmentsByIntervalAndSort(S
return segmentsMap;
}
+ /**
+ * A failed publish action should be retried only if there is another task
+ * waiting to publish offsets for an overlapping set of partitions.
+ */
+ private boolean shouldNotRetryFailure(SegmentPublishResult result, Task
task, TaskActionToolbox toolbox)
+ {
+ if (result.isSuccess() || !result.isRetryable() || startMetadata != null) {
Review Comment:
Was this meant to be `startMetadata == null`?
--
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]