@Override
  public void postDeleteTable(ObserverContext<MasterCoprocessorEnvironment> ctx,
    TableName tableName) throws IOException {
    // Do nothing if quotas aren't enabled
    if (!quotasEnabled) {
      return;
    }
    final Connection conn = ctx.getEnvironment().getConnection();
    Quotas tableQuotas = QuotaUtil.getTableQuota(conn, tableName);
    Quotas namespaceQuotas = QuotaUtil.getNamespaceQuota(conn, tableName.getNamespaceAsString());
    if (tableQuotas != null || namespaceQuotas != null) {
      // Remove regions of table from space quota map.
      this.masterServices.getMasterQuotaManager().removeRegionSizesForTable(tableName);
      if (tableQuotas != null) {
        if (tableQuotas.hasSpace()) {
          QuotaSettings settings = QuotaSettingsFactory.removeTableSpaceLimit(tableName);
          try (Admin admin = conn.getAdmin()) {
            admin.setQuota(settings);
          }
        }
        if (tableQuotas.hasThrottle()) {
          QuotaSettings settings = QuotaSettingsFactory.unthrottleTable(tableName);
          try (Admin admin = conn.getAdmin()) {
            admin.setQuota(settings);
          }
        }
      }
    }
  }
An observer to automatically delete quotas when a table/namespace is deleted.
hbase-server/src/main/java/org/apache/hadoop/hbase/quotas/MasterQuotasObserver.java