SteNicholas commented on code in PR #3781:
URL: https://github.com/apache/celeborn/pull/3781#discussion_r3810657753


##########
master/src/main/java/org/apache/celeborn/service/deploy/master/slotsalloc/SlotsAssignStrategyManager.java:
##########
@@ -0,0 +1,164 @@
+/*
+ * 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.celeborn.service.deploy.master.slotsalloc;
+
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.LinkedHashMap;
+import java.util.Locale;
+import java.util.Map;
+import java.util.Objects;
+import java.util.ServiceLoader;
+import java.util.TreeSet;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import org.apache.celeborn.common.CelebornConf;
+import org.apache.celeborn.server.common.service.config.ConfigService;
+import org.apache.celeborn.server.common.service.config.SystemConfig;
+
+/**
+ * Discovers slot assignment strategy providers and atomically switches the 
active strategy after
+ * dynamic configuration updates.
+ */
+public final class SlotsAssignStrategyManager {
+
+  private static final Logger LOG = 
LoggerFactory.getLogger(SlotsAssignStrategyManager.class);
+
+  private final CelebornConf staticConf;
+  private final ConfigService configService;
+  private final Map<String, SlotsAssignStrategyProvider> providersByName;
+
+  private volatile ConfiguredStrategy configuredStrategy;
+  private Map<String, String> lastAttemptedDynamicConfigs;
+
+  public SlotsAssignStrategyManager(CelebornConf staticConf, ConfigService 
configService) {
+    this.staticConf = staticConf.clone();
+    this.configService = configService;
+    this.providersByName =
+        Collections.unmodifiableMap(
+            
loadProviders(ServiceLoader.load(SlotsAssignStrategyProvider.class)));
+
+    this.lastAttemptedDynamicConfigs = currentDynamicConfigs();
+    this.configuredStrategy = createStrategy(lastAttemptedDynamicConfigs);

Review Comment:
   [P1] Prevent rejected dynamic config from blocking restarts
   
   The initial dynamic snapshot is applied before any valid strategy exists and 
outside the guarded reload path. A bad SYSTEM update is safely rejected at 
runtime but remains persisted; after a Master restart, the same invalid 
provider or parameter throws here and aborts startup. Please attempt the 
initial snapshot with recovery to the static configuration, and add a 
cold-start invalid-config test.



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

Reply via email to