dimas-b commented on code in PR #3281:
URL: https://github.com/apache/polaris/pull/3281#discussion_r2653326792


##########
persistence/relational-jdbc/src/main/java/org/apache/polaris/persistence/relational/jdbc/JdbcMetaStoreManagerFactory.java:
##########
@@ -196,15 +196,20 @@ public Map<String, BaseResult> 
purgeRealms(Iterable<String> realms) {
 
     for (String realm : realms) {
       RealmContext realmContext = () -> realm;
-      PolarisMetaStoreManager metaStoreManager = 
getOrCreateMetaStoreManager(realmContext);
-      BasePersistence session = getOrCreateSession(realmContext);
-
-      PolarisCallContext callContext = new PolarisCallContext(realmContext, 
session);
-      BaseResult result = metaStoreManager.purge(callContext);
-      results.put(realm, result);
-
-      sessionSupplierMap.remove(realm);
-      metaStoreManagerMap.remove(realm);
+      try {
+        PolarisMetaStoreManager metaStoreManager = 
getOrCreateMetaStoreManager(realmContext);
+        BasePersistence session = getOrCreateSession(realmContext);
+
+        PolarisCallContext callContext = new PolarisCallContext(realmContext, 
session);
+        BaseResult result = metaStoreManager.purge(callContext);
+        results.put(realm, result);
+
+        sessionSupplierMap.remove(realm);
+        metaStoreManagerMap.remove(realm);
+      } catch (IllegalStateException e) {
+        // Realm is not bootstrapped, return a failed result
+        results.put(realm, new 
BaseResult(BaseResult.ReturnStatus.ENTITY_NOT_FOUND, e.getMessage()));

Review Comment:
   Re: eliminating the `admin` module, I personally do not think it's going to 
net beneficial. The main purpose of that module is to hold the admin CLI, which 
is a different application type from `runtime/server`, so it cannot be produced 
by the Quarkus build action.
   
   That said, I'm open to discussing ways to simplify the project layout and 
build... but that conversation is probably way beyond the scope of this PR :)



##########
persistence/relational-jdbc/src/main/java/org/apache/polaris/persistence/relational/jdbc/JdbcMetaStoreManagerFactory.java:
##########
@@ -196,15 +196,20 @@ public Map<String, BaseResult> 
purgeRealms(Iterable<String> realms) {
 
     for (String realm : realms) {
       RealmContext realmContext = () -> realm;
-      PolarisMetaStoreManager metaStoreManager = 
getOrCreateMetaStoreManager(realmContext);
-      BasePersistence session = getOrCreateSession(realmContext);
-
-      PolarisCallContext callContext = new PolarisCallContext(realmContext, 
session);
-      BaseResult result = metaStoreManager.purge(callContext);
-      results.put(realm, result);
-
-      sessionSupplierMap.remove(realm);
-      metaStoreManagerMap.remove(realm);
+      try {
+        PolarisMetaStoreManager metaStoreManager = 
getOrCreateMetaStoreManager(realmContext);
+        BasePersistence session = getOrCreateSession(realmContext);
+
+        PolarisCallContext callContext = new PolarisCallContext(realmContext, 
session);
+        BaseResult result = metaStoreManager.purge(callContext);
+        results.put(realm, result);
+
+        sessionSupplierMap.remove(realm);
+        metaStoreManagerMap.remove(realm);
+      } catch (IllegalStateException e) {
+        // Realm is not bootstrapped, return a failed result
+        results.put(realm, new 
BaseResult(BaseResult.ReturnStatus.ENTITY_NOT_FOUND, e.getMessage()));

Review Comment:
   Re: eliminating the `admin` module, I personally do not think it's going to 
be net beneficial. The main purpose of that module is to hold the admin CLI, 
which is a different application type from `runtime/server`, so it cannot be 
produced by the Quarkus build action.
   
   That said, I'm open to discussing ways to simplify the project layout and 
build... but that conversation is probably way beyond the scope of this PR :)



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