public CheckResult checkMetastore(String catName, String dbName, String tableName,
                             byte[] filterExp, Table table)
      throws MetastoreException, IOException {
    CheckResult result = new CheckResult();
    if (dbName == null || "".equalsIgnoreCase(dbName)) {
      dbName = Warehouse.DEFAULT_DATABASE_NAME;
    }

    try {
      if (tableName == null || "".equals(tableName)) {
        // TODO: I do not think this is used by anything other than tests
        // no table specified, check all tables and all partitions.
        List<String> tables = new ArrayList<>();
        try{
          tables = getMsc().getTables(catName, dbName, ".*");
        }catch(UnknownDBException ex){
          //ignore database exception.
        }
        for (String currentTableName : tables) {
          checkTable(catName, dbName, currentTableName, null, null, result);
        }

        findUnknownTables(catName, dbName, tables, result);
      } else if (filterExp != null) {
        // check for specified partitions which matches filter expression
        checkTable(catName, dbName, tableName, filterExp, table, result);
      } else {
        // only one table, let's check all partitions
        checkTable(catName, dbName, tableName, null, table, result);
      }

      LOG.info("Number of partitionsNotInMs=" + result.getPartitionsNotInMs()
              + ", partitionsNotOnFs=" + result.getPartitionsNotOnFs()
              + ", tablesNotInMs=" + result.getTablesNotInMs()
              + ", tablesNotOnFs=" + result.getTablesNotOnFs()
              + ", expiredPartitions=" + result.getExpiredPartitions());
    } catch (TException e) {
      throw new MetastoreException(e);
    }
    return result;
  }
Check the metastore for inconsistencies, data missing in either the
metastore or on the dfs.

@param catName
         name of the catalog, if not specified default catalog will be used.
@param dbName
         name of the database, if not specified the default will be used.
@param tableName
         Table we want to run the check for. If null we'll check all the
         tables in the database.
@param filterExp
         Filter expression which is used to prune th partition from the
         metastore and FileSystem.
@param table
@return Results of the check
@throws MetastoreException
          Failed to get required information from the metastore.
@throws IOException
          Most likely filesystem related
standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/HiveMetaStoreChecker.java