Search before asking
Description
Summary
Currently, MetadataManager.dropDatabase() does not check whether the database being dropped is the default database (fluss). This allows users to accidentally delete the default database, which causes Flink Catalog to fail to open with:
The configured default-database 'fluss' does not exist in the Fluss cluster.
Furthermore, restarting CoordinatorServer will not recreate the default database, because createDefaultDatabase() only creates it when
databases.isEmpty() returns true — if other databases exist, the default database is never recreated.
Steps to Reproduce
- Create a Fluss cluster (default database fluss is auto-created)
- Create another database (e.g., my_db)
- Drop the default database: DROP DATABASE fluss
- Try to open Flink Catalog with 'default-database' = 'fluss' → fails
- Restart CoordinatorServer → default database is not recreated (because my_db still exists)
Expected Behavior
dropDatabase() should reject attempts to delete the default database with a clear error message, e.g.:
Caused by: org.apache.flink.table.catalog.exceptions.CatalogException: The configured default-database 'fluss' does not exist in the Fluss cluster.
at org.apache.fluss.flink.catalog.FlinkCatalog.open(FlinkCatalog.java:151)
Proposed Fix
Add a check in MetadataManager.dropDatabase() before proceeding with deletion:
public void dropDatabase(String name, boolean ignoreIfNotExists, boolean cascade)
throws DatabaseNotExistException, DatabaseNotEmptyException {
if (CoordinatorServer.DEFAULT_DATABASE.equals(name)) {
throw new UnsupportedOperationException(
"Cannot drop the default database '" + name
+ "'. The default database is required for cluster operation.");
}
// ... existing logic
}
Willingness to contribute
Search before asking
Description
Summary
Currently, MetadataManager.dropDatabase() does not check whether the database being dropped is the default database (fluss). This allows users to accidentally delete the default database, which causes Flink Catalog to fail to open with:
The configured default-database 'fluss' does not exist in the Fluss cluster.
Furthermore, restarting CoordinatorServer will not recreate the default database, because createDefaultDatabase() only creates it when
databases.isEmpty() returns true — if other databases exist, the default database is never recreated.
Steps to Reproduce
Expected Behavior
dropDatabase() should reject attempts to delete the default database with a clear error message, e.g.:
Proposed Fix
Add a check in MetadataManager.dropDatabase() before proceeding with deletion:
Willingness to contribute