adarshsanjeev commented on code in PR #17863:
URL: https://github.com/apache/druid/pull/17863#discussion_r2030547857


##########
server/src/test/java/org/apache/druid/server/coordinator/simulate/HistoricalCloningTest.java:
##########
@@ -0,0 +1,292 @@
+/*
+ * 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.server.coordinator.simulate;
+
+import org.apache.druid.client.DruidServer;
+import org.apache.druid.segment.TestDataSource;
+import org.apache.druid.server.coordinator.CoordinatorDynamicConfig;
+import org.apache.druid.server.coordinator.stats.Stats;
+import org.junit.Assert;
+import org.junit.Test;
+
+import java.util.Map;
+import java.util.Set;
+
+public class HistoricalCloningTest extends CoordinatorSimulationBaseTest
+{
+  private static final long SIZE_1TB = 1_000_000;
+
+  private DruidServer historicalT11;
+  private DruidServer historicalT12;
+  private DruidServer historicalT13;
+
+  private final String datasource = TestDataSource.WIKI;
+
+  @Override
+  public void setUp()
+  {
+    // Setup historicals for 2 tiers, size 10 GB each
+    historicalT11 = createHistorical(1, Tier.T1, SIZE_1TB);
+    historicalT12 = createHistorical(2, Tier.T1, SIZE_1TB);
+    historicalT13 = createHistorical(3, Tier.T1, SIZE_1TB);
+  }
+
+  @Test
+  public void testSimpleCloning()
+  {
+    final CoordinatorSimulation sim =
+        CoordinatorSimulation.builder()
+                             .withSegments(Segments.WIKI_10X1D)
+                             .withServers(historicalT11, historicalT12)
+                             .withRules(datasource, Load.on(Tier.T1, 
1).forever())
+                             .withDynamicConfig(
+                                 CoordinatorDynamicConfig.builder()
+                                                         
.withCloneServers(Map.of(historicalT11.getHost(), historicalT12.getHost()))
+                                                         
.withUnmanagedNodes(Set.of(historicalT12.getHost()))
+                                                         
.withSmartSegmentLoading(false)
+                                                         .build()
+                             )
+                             .withImmediateSegmentLoading(true)
+                             .build();
+
+    startSimulation(sim);
+    runCoordinatorCycle();
+
+    verifyValue(Metric.ASSIGNED_COUNT, 10L);

Review Comment:
   From going through the code at 
`org.apache.druid.server.coordinator.stats.CoordinatorRunStats#addToSegmentStat`,
 I see that assigned count is emitted with datasource and tier, but not server. 
Is it possible to do this assertion?
   
   Assigning to the clone does not emit assigned count as well, it emits 
`ASSIGNED_TO_CLONE` instead, so is this required?



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