nevzheng commented on code in PR #12133:
URL: https://github.com/apache/gravitino/pull/12133#discussion_r3652019226


##########
core/src/main/java/org/apache/gravitino/GravitinoEnv.java:
##########
@@ -586,58 +613,75 @@ public void start() {
   public void shutdown() {
     LOG.info("Shutting down Gravitino Environment...");
 
-    if (entityStore != null) {
-      try {
-        entityStore.close();
-      } catch (Exception e) {
-        LOG.warn("Failed to close EntityStore.", e);
+    try {

Review Comment:
   Done in `0cd36a9b8`. Restored the existing shutdown flow, close the KMS 
registry once at the end, and removed the test that asserted a stronger 
KMS-only cleanup guarantee. The full core test suite passes.



##########
core/src/main/java/org/apache/gravitino/GravitinoEnv.java:
##########
@@ -207,7 +210,13 @@ public void initializeBaseComponents(Config config) {
     this.config = config;
     FileFetcher.get().initialize(config.get(Configs.BLOCK_UNSAFE_REMOTE_URI));
     this.manageFullComponents = false;
-    initBaseComponents();
+    this.kmsClientRegistry = new KmsClientRegistry(config);
+    try {

Review Comment:
   Done in `0cd36a9b8`. The registry now initializes once in 
`initBaseComponents()`, and the duplicated KMS-specific rollback blocks have 
been removed from both public initialization paths.



##########
core/src/main/java/org/apache/gravitino/encryption/kms/KmsConfig.java:
##########
@@ -0,0 +1,152 @@
+/*
+ * 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.gravitino.encryption.kms;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.LinkedHashMap;
+import java.util.LinkedHashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+import org.apache.gravitino.Config;
+
+final class KmsConfig {
+
+  static final String KMS_CONFIG_PREFIX = "gravitino.kms.";
+  static final String KMS_SOURCES = KMS_CONFIG_PREFIX + "sources";
+
+  private static final String SOURCES = "sources";
+  private static final String SOURCE_PREFIX = "source.";
+  private static final String API = "api";
+  private static final Pattern SOURCE_NAME_PATTERN = 
Pattern.compile("[A-Za-z0-9][A-Za-z0-9_-]*");
+  private static final Pattern SOURCE_PROPERTY_PATTERN =

Review Comment:
   Done in `0cd36a9b8`. Removed the structural regex and separate validation 
pass. Configuration keys are now parsed in one pass with `startsWith`, 
`indexOf`, and `substring`, with added malformed-key coverage.



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