brumi1024 commented on code in PR #8801:
URL: https://github.com/apache/hadoop/pull/8801#discussion_r4243506421
##########
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/capacity/CapacitySchedulerConfiguration.java:
##########
@@ -1213,13 +1216,27 @@ public ConfigurationProperties
getConfigurationProperties() {
}
/**
- * Reinitializes the cached {@code ConfigurationProperties} object.
+ * Get the snapshot of this configuration. It is taken on first use and not
+ * refreshed by later writes into this object (for example template entries
+ * written for dynamic queues), until
+ * {@link #reinitializeConfigurationProperties()} is called.
+ * @return the cached configuration snapshot
+ */
+ public ConfigSnapshot getConfigSnapshot() {
+ if (configSnapshot == null) {
+ reinitializeConfigurationProperties();
+ }
+
+ return configSnapshot;
+ }
+
+ /**
+ * Reinitializes the cached {@code ConfigSnapshot} and the
+ * {@code ConfigurationProperties} view of it.
*/
- @SuppressWarnings({"unchecked", "rawtypes"})
public void reinitializeConfigurationProperties() {
- // Props are always Strings, therefore this cast is safe
- Map<String, String> props = (Map) getProps();
- configurationProperties = new ConfigurationProperties(props);
+ configSnapshot = ConfigSnapshot.of(this);
+ configurationProperties = new ConfigurationProperties(configSnapshot);
}
Review Comment:
Done.
##########
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/capacity/CapacitySchedulerConfiguration.java:
##########
@@ -435,6 +436,7 @@ public class CapacitySchedulerConfiguration extends
ReservationSchedulerConfigur
private static final String LEGACY_QUEUE_MODE_ENABLED = PREFIX +
"legacy-queue-mode.enabled";
public static final boolean DEFAULT_LEGACY_QUEUE_MODE = true;
+ private ConfigSnapshot configSnapshot;
Review Comment:
Fixed by the above, the snapshot is now the only cached field.
--
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]