private List<MDBPrivilege> listPrincipalAllDBGrant(String principalName, PrincipalType principalType)
      throws Exception {
    final List<MDBPrivilege> mSecurityDBList;

    LOG.debug("Executing listPrincipalAllDBGrant");

    Preconditions.checkState(this.currentTransaction.isActive());

    if (principalName != null && principalType != null) {
      try (Query query = pm.newQuery(MDBPrivilege.class, "principalName == t1 && principalType == t2")) {
        query.declareParameters("java.lang.String t1, java.lang.String t2");
        mSecurityDBList = (List<MDBPrivilege>) query.execute(principalName, principalType.toString());
        pm.retrieveAll(mSecurityDBList);
        LOG.debug("Done retrieving all objects for listPrincipalAllDBGrant: {}", mSecurityDBList);
        return Collections.unmodifiableList(new ArrayList<>(mSecurityDBList));
      }
    } else {
      try (Query query = pm.newQuery(MDBPrivilege.class)) {
        mSecurityDBList = (List<MDBPrivilege>) query.execute();
        pm.retrieveAll(mSecurityDBList);
        LOG.debug("Done retrieving all objects for listPrincipalAllDBGrant: {}", mSecurityDBList);
        return Collections.unmodifiableList(new ArrayList<>(mSecurityDBList));
      }
    }
  }
Add role names of parentRoles and its parents to processedRoles
standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/ObjectStore.java