Ejemplo n.º 1
0
    @Override
    public ReturnState existPartitionMethod(
        RpcController controller, TableIdentifierProto request) {
      String dbName = request.getDatabaseName();
      String tableName = request.getTableName();

      try {
        // linked meta data do not support partition.
        // So, the request that wants to get partitions in this db will be failed.
        if (linkedMetadataManager.existsDatabase(dbName)) {
          return errUndefinedPartitionMethod(tableName);
        }
      } catch (Throwable t) {
        printStackTraceIfError(LOG, t);
        return returnError(t);
      }

      if (metaDictionary.isSystemDatabase(dbName)) {
        ReturnStateUtil.errFeatureNotSupported("partition feature in virtual tables");
      }

      rlock.lock();
      try {
        if (store.existPartitionMethod(dbName, tableName)) {
          return OK;
        } else {
          return errUndefinedPartitionMethod(tableName);
        }

      } catch (Throwable t) {
        printStackTraceIfError(LOG, t);
        return returnError(t);

      } finally {
        rlock.unlock();
      }
    }