mchades commented on code in PR #13367:
URL: https://github.com/apache/gravitino/pull/13367#discussion_r4060255154


##########
core/src/main/java/org/apache/gravitino/GravitinoEnv.java:
##########
@@ -229,24 +231,43 @@ public static GravitinoEnv getInstance() {
    */
   public void initializeBaseComponents(Config config) {
     LOG.info("Initializing Gravitino base environment...");
-    this.config = config;
-    FileFetcher.get().initialize(config.get(Configs.BLOCK_UNSAFE_REMOTE_URI));
-    SecretPropertyUtils.configureSensitiveKeyKeywords(config);
+    initializeConfig(config);
     this.manageFullComponents = false;
     initBaseComponents();
     LOG.info("Gravitino base environment is initialized.");
   }
 
+  /**
+   * Initializes components required for normalized metadata operations.
+   *
+   * <p>This initialization profile does not initialize event listeners, audit 
logging, metadata
+   * hooks, auxiliary services, or job management.
+   *
+   * <p>This method must be invoked on the singleton returned by {@link 
#getInstance()}, because
+   * metadata components use environment-scoped dependencies.
+   *
+   * @param config The configuration object to initialize the environment.
+   */
+  public void initializeMetadataComponents(Config config) {
+    Preconditions.checkState(
+        this == getInstance(),
+        "Metadata components must be initialized on 
GravitinoEnv.getInstance().");

Review Comment:
   This is existing lifecycle behavior shared by `initializeBaseComponents` and 
`initializeFullComponents`. Each process selects one initialization profile for 
the process-wide `GravitinoEnv` singleton during startup; 
`initializeMetadataComponents` is an alternative startup profile, not an 
upgrade or reconfiguration path for an already initialized environment.
   
   Adding a guard only to this new method would make the three initialization 
entry points inconsistent, while enforcing it across all profiles would be a 
broader lifecycle behavior change outside this refactor. I would prefer to keep 
the existing initialization semantics unchanged and address explicit 
reinitialization or profile switching separately if that becomes a supported 
use case.



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