mchades commented on code in PR #13367:
URL: https://github.com/apache/gravitino/pull/13367#discussion_r4061913327
##########
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 called on {@link #getInstance()}. Some metadata
components read their
+ * dependencies directly from that singleton instead of from the object
being initialized.
+ *
+ * @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().");
+ LOG.info("Initializing Gravitino metadata environment...");
+ initializeConfig(config);
+ this.manageFullComponents = false;
+ initCommonComponents();
+ initMetadataComponents();
Review Comment:
This is the existing one-shot lifecycle shared by all three initialization
profiles. `shutdown()` performs component cleanup but has never reset
`GravitinoEnv` for reuse, and `initializeMetadataComponents` does not introduce
reinitialization support. An embedded process is expected to select this
profile once during startup, just as the server selects the full profile.
The `LockManager` executor lifecycle also predates this refactor and applies
to the full profile as well. I would prefer not to add
metadata-profile-specific wording here. If we document or change the lifecycle
contract, it should be done consistently across all initialization profiles in
a separate change.
--
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]