You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@iceberg.apache.org by "rdblue (via GitHub)" <gi...@apache.org> on 2023/06/20 15:02:45 UTC

[GitHub] [iceberg] rdblue commented on a diff in pull request #7795: Flink: Ignore the Forbidden when creating a database

rdblue commented on code in PR #7795:
URL: https://github.com/apache/iceberg/pull/7795#discussion_r1235406357


##########
flink/v1.15/flink/src/main/java/org/apache/iceberg/flink/FlinkCatalog.java:
##########
@@ -126,10 +126,13 @@ public FlinkCatalog(
   @Override
   public void open() throws CatalogException {
     // Create the default database if it does not exist.
-    try {
-      createDatabase(getDefaultDatabase(), ImmutableMap.of(), true);
-    } catch (DatabaseAlreadyExistException e) {
-      // Ignore the exception if it's already exist.
+    String defaultDatabase = getDefaultDatabase();
+    if (!databaseExists(defaultDatabase)) {
+      try {
+        createDatabase(getDefaultDatabase(), ImmutableMap.of(), true);
+      } catch (DatabaseAlreadyExistException e) {

Review Comment:
   I'd be okay with removing the check, although I think as long as attempting to create it doesn't cause a failure it is probably slightly better to create it.



-- 
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: issues-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org