[ 
https://issues.apache.org/jira/browse/HBASE-15433?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15193177#comment-15193177
 ] 

Ashish Singhi commented on HBASE-15433:
---------------------------------------

I was not saying about concurrent restoreSnapshot requests, any other operation 
on the namespace also can update the quota of the namespace.

bq. checkAndUpdateNamespaceRegionQuota after restoreSnapshot will be executed 
only when tableRegionCount > snapshotRegionCount satisfied
OK. That means we have reserved enough quota before hand.

bq. if there are concurrent restoreSnapshot requests for the same table, it 
will cause problem, and we may need lock to make sure the quota information is 
updated correctly, or we can move the quota check and update logic in the 
RestoreSnapshotHandler after table lock is held?
Not required I think, because we are having enough quota for this table in the 
cache before restoring the snapshot and after restoring snapshot we are only 
decrementing it, so it will work.

{code}
 } catch (QuotaExceededException e) {
        LOG.error("Exception occurred while restoring the snapshot " + 
snapshot.getName()
          + " as table " + tableName.getNameAsString(), e);
        // If QEE is thrown before restoreSnapshot, quota information is not 
updated, and we
        // should throw the exception directly. If QEE is thrown after 
restoreSnapshot, there
        // must be unexpected reasons, we also throw the exception directly
        throw e;
{code}
We can also include quota has exceeded in the error message.

Thanks.

> SnapshotManager#restoreSnapshot not update table and region count quota 
> correctly when encountering exception
> -------------------------------------------------------------------------------------------------------------
>
>                 Key: HBASE-15433
>                 URL: https://issues.apache.org/jira/browse/HBASE-15433
>             Project: HBase
>          Issue Type: Bug
>          Components: snapshots
>    Affects Versions: 2.0.0
>            Reporter: Jianwei Cui
>         Attachments: HBASE-15433-trunk-v1.patch, HBASE-15433-trunk-v2.patch, 
> HBASE-15433-trunk.patch
>
>
> In SnapshotManager#restoreSnapshot, the table and region quota will be 
> checked and updated as:
> {code}
>       try {
>         // Table already exist. Check and update the region quota for this 
> table namespace
>         checkAndUpdateNamespaceRegionQuota(manifest, tableName);
>         restoreSnapshot(snapshot, snapshotTableDesc);
>       } catch (IOException e) {
>         
> this.master.getMasterQuotaManager().removeTableFromNamespaceQuota(tableName);
>         LOG.error("Exception occurred while restoring the snapshot " + 
> snapshot.getName()
>             + " as table " + tableName.getNameAsString(), e);
>         throw e;
>       }
> {code}
> The 'checkAndUpdateNamespaceRegionQuota' will fail if regions in the snapshot 
> make the region count quota exceeded, then, the table will be removed in the 
> 'catch' block. This will make the current table count and region count 
> decrease, following table creation or region split will succeed even if the 
> actual quota is exceeded.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to