diff --git a/table/server/common/src/main/java/alluxio/master/table/DatabaseInfo.java b/table/server/common/src/main/java/alluxio/master/table/DatabaseInfo.java index 981760ad0fc1..35910c496f73 100644 --- a/table/server/common/src/main/java/alluxio/master/table/DatabaseInfo.java +++ b/table/server/common/src/main/java/alluxio/master/table/DatabaseInfo.java @@ -16,6 +16,8 @@ import com.google.common.base.MoreObjects; import javax.annotation.Nullable; + +import java.util.Collections; import java.util.Map; import java.util.Objects; @@ -47,7 +49,11 @@ public DatabaseInfo(String location, String ownerName, PrincipalType ownerType, mOwnerName = ownerName; mOwnerType = ownerType; mComment = comment; - mParameters = params; + if (params == null) { + mParameters = Collections.emptyMap(); + } else { + mParameters = params; + } } /** diff --git a/table/server/master/src/main/java/alluxio/master/table/AlluxioCatalog.java b/table/server/master/src/main/java/alluxio/master/table/AlluxioCatalog.java index 12501a194ad2..3e5ee407f048 100644 --- a/table/server/master/src/main/java/alluxio/master/table/AlluxioCatalog.java +++ b/table/server/master/src/main/java/alluxio/master/table/AlluxioCatalog.java @@ -129,6 +129,8 @@ public SyncStatus attachDatabase(JournalContext journalContext, String udbType, } catch (Exception e) { // Failed to connect to and sync the udb. syncError = true; + // log the error and stack + LOG.error(String.format("Sync (during attach) failed for db '%s'.", dbName), e); throw new IOException(String .format("Failed to connect underDb for Alluxio db '%s': %s", dbName, e.getMessage()), e); @@ -153,6 +155,11 @@ public SyncStatus syncDatabase(JournalContext journalContext, String dbName) thr try (LockResource l = getDbLock(dbName)) { Database db = getDatabaseByName(dbName); return db.sync(journalContext); + } catch (Exception e) { + // log the error and stack + LOG.error(String.format("Sync failed for db '%s'.", dbName), e); + throw new IOException( + String.format("Sync failed for db '%s'. error: %s", dbName, e.getMessage()), e); } } @@ -209,7 +216,7 @@ public List getAllDatabases() throws IOException { * @param dbName database name * @return a database object */ - public alluxio.grpc.table.Database getDatabase(String dbName) throws IOException { + public alluxio.grpc.table.Database getDatabase(String dbName) throws IOException { Database db = getDatabaseByName(dbName); DatabaseInfo dbInfo = db.getDatabaseInfo();