public void dropDb(String dbName, boolean force) throws MetaNotFoundException {
        Database database;
        try {
            database = getDb(dbName);
        } catch (Exception e) {
            LOG.error("Failed to access database {}", dbName, e);
            throw new MetaNotFoundException("Failed to access database " + dbName);
        }

        if (database == null) {
            throw new MetaNotFoundException("Not found database " + dbName);
        }

        String dbLocation = database.getLocation();
        if (Strings.isNullOrEmpty(dbLocation)) {
            throw new MetaNotFoundException("Database location is empty");
        }
        boolean deleteData = false;
        try {
            deleteData = !FileSystem.get(URI.create(dbLocation), hadoopConf)
                    .listLocatedStatus(new Path(dbLocation)).hasNext();
        } catch (Exception e) {
            LOG.error("Failed to check database directory", e);
        }

        metastore.dropDb(dbName, deleteData);
    }
@Test
    public void testDropDb() throws MetaNotFoundException {
        class MockedTestMetaClient extends HiveMetastoreTest.MockedHiveMetaClient {
            public org.apache.hadoop.hive.metastore.api.Database getDb(String dbName) throws RuntimeException {
                if (dbName.equals("not_exist_db")) {
                    throw new RuntimeException("db not_exist_db not found");
                }
                return null;
            }
        }

        HiveMetaClient client = new MockedTestMetaClient();
        HiveMetastore metastore = new HiveMetastore(client, "hive_catalog", null);
        ExecutorService executor = Executors.newFixedThreadPool(5);
        CachingHiveMetastore cachingHiveMetastore = new CachingHiveMetastore(
                metastore, executor, expireAfterWriteSec, refreshAfterWriteSec, 1000, false);
        HiveMetastoreOperations hmsOps = new HiveMetastoreOperations(cachingHiveMetastore, true,
                new Configuration(), MetastoreType.HMS, "hive_catalog");

        HiveMetastoreOperations finalHmsOps = hmsOps;
        ExceptionChecker.expectThrowsWithMsg(MetaNotFoundException.class,
                "Failed to access database not_exist_db",
                () -> finalHmsOps.dropDb("not_exist_db", true));

        ExceptionChecker.expectThrowsWithMsg(MetaNotFoundException.class,
                "Database location is empty",
                () -> this.hmsOps.dropDb("db1", true));

        class MockedTestMetaClient1 extends HiveMetastoreTest.MockedHiveMetaClient {

            public org.apache.hadoop.hive.metastore.api.Database getDb(String dbName) throws RuntimeException {
                if (dbName.equals("db1")) {
                    org.apache.hadoop.hive.metastore.api.Database database = new org.apache.hadoop.hive.metastore.api.Database();
                    database.setName("db1");
                    database.setLocationUri("locationXXX");
                    return database;
                }
                return null;
            }
        }

        metastore = new HiveMetastore(new MockedTestMetaClient1(), "hive_catalog", MetastoreType.HMS);
        executor = Executors.newFixedThreadPool(5);
        cachingHiveMetastore = new CachingHiveMetastore(
                metastore, executor, expireAfterWriteSec, refreshAfterWriteSec, 1000, false);
        hmsOps = new HiveMetastoreOperations(cachingHiveMetastore, true, new Configuration(), MetastoreType.HMS, "hive_catalog");

        hmsOps.dropDb("db1", false);
    }