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

Jianwei Cui commented on HBASE-15433:
-------------------------------------

Reasonable for this case IMO. It seems there are other issues when concurrently 
restoring snapshots for the same table. We need to keep the 
{{checkAndUpdateNamespaceRegionQuota}} the same order before and after 
{{restoreSnapshot}} among concurrent restore requests. For example, beofre 
{{restoreSnapshot}}, if clientA invoked {{checkAndUpdateNamespaceRegionQuota}} 
ahead of clientB, then after {{restoreSnapshot}}, we need to make sure clientA 
also invoked {{checkAndUpdateNamespaceRegionQuota}} ahead of clientB?
In the document of 
[HBASE-12439|https://issues.apache.org/jira/browse/HBASE-12439], it seems the 
CloneSnapshotHandler/RestoreSnapshotHandler will be rewritten by procedure v2? 
After that, we can keep the quota updating sync with 
CloneSnapshot/RestoreSnapshot steps and rollbacks. Currently, without steps and 
rollbacks, RestoreSnapshotHandler may not update the quota information 
correctly. Therefore, I think we can still keep the quota updating in 
{{SnapshotManager}} before procedure v2 rewritten? For concurrent request 
issues, we can add some comments in the code to explain the problem?

> 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