[
https://issues.apache.org/jira/browse/HBASE-21455?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16803098#comment-16803098
]
Josh Elser commented on HBASE-21455:
------------------------------------
{code:java}
+ //Set a space quota on non-exist namespace
+
admin.setQuota(QuotaSettingsFactory.limitNamespaceSpace(testName.getMethodName(),
+ SpaceQuotaHelperForTests.ONE_GIGABYTE,
SpaceViolationPolicy.NO_INSERTS));
{code}
Open-ended question: are we sure we want to allow configuring quotas on
entities that don't exist? A quick glacne doesn't indicate that we require the
entity we're setting a quota on (ns, user, or table) to exist prior to
configuring this quota. I wonder if this issue exists beyond just the
namespace. You look into that at all [~wenbang]?
{code:java}
+ public static TableName[] listTableNamesByNamespace(Connection conn, String
namespace)
+ throws IOException {
+ TableName[] tablesInNS = null;
+ try {
+ tablesInNS = conn.getAdmin().listTableNamesByNamespace(namespace);
+ } catch (NamespaceNotFoundException e) {
+ LOG.warn("NameSpace " + namespace + " doesn't exist,skip it");
+ }
+ return tablesInNS;
+ }
{code}
Could we change this method to return {{Optional<TableName[]>}} instead of
relying on this null-check? I think that would clean up the current patch and
help prevent future bugs around this.
> Update filesystem-space quota fail if there is a space quota for non-existing
> namespace
> ---------------------------------------------------------------------------------------
>
> Key: HBASE-21455
> URL: https://issues.apache.org/jira/browse/HBASE-21455
> Project: HBase
> Issue Type: Bug
> Affects Versions: 2.0.2
> Reporter: wenbang
> Assignee: wenbang
> Priority: Major
> Fix For: 3.0.0
>
> Attachments: HBASE-21455.master.001.patch,
> HBASE-21455.master.002.patch, HBASE-21455.master.003.patch,
> HBASE-21455.master.004.patch
>
>
> QuotaObserverChore#fetchAllTablesWithQuotasDefined may fail and throw a
> NamespaceNotFoundException because of namespace does not exist
> {code:java}
> // Collect all of the tables in the namespace
> TableName[] tablesInNS =
> conn.getAdmin().listTableNamesByNamespace(namespace);
> {code}
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)