FangYongs commented on code in PR #23063:
URL: https://github.com/apache/flink/pull/23063#discussion_r1283906615
##########
flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/catalog/FileCatalogStore.java:
##########
@@ -132,31 +153,23 @@ public void storeCatalog(String catalogName,
CatalogDescriptor catalog)
public void removeCatalog(String catalogName, boolean ignoreIfNotExists)
throws CatalogException {
checkOpenState();
-
- Path path = getCatalogPath(catalogName);
+ Path catalogPath = getCatalogPath(catalogName);
try {
- File file = path.toFile();
- if (file.exists()) {
- if (!file.isFile()) {
- throw new CatalogException(
- String.format(
- "Catalog %s's store file %s is not a
regular file",
- catalogName, path.getFileName()));
- }
- Files.deleteIfExists(path);
- } else {
- if (!ignoreIfNotExists) {
- throw new CatalogException(
- String.format(
- "Catalog %s's store file %s is not exist",
catalogName, path));
- }
+ FileSystem fs = catalogPath.getFileSystem();
+
+ if (fs.exists(catalogPath)) {
+ fs.delete(catalogPath, false);
+ } else if (!ignoreIfNotExists) {
+ throw new CatalogException(
+ String.format(
+ "Catalog %s's store file %s does not exist.",
+ catalogName, catalogPath));
}
- } catch (Throwable e) {
+ } catch (CatalogException e) {
+ throw e;
Review Comment:
The same as above
--
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]