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

Duo Zhang edited comment on HBASE-21936 at 2/20/19 12:30 AM:
-------------------------------------------------------------

IIRC I have already prepared a patch, that in the preCheck for split and merge, 
if we find out that there is a snapshot operation on-going for this table, we 
will fail immediately. Not enough?

{code:title=MergeTableRegionsProcedure.java}
    // Fail if we are taking snapshot for the given table
    if (env.getMasterServices().getSnapshotManager()
      .isTakingSnapshot(regionsToMerge[0].getTable())) {
      throw new MergeRegionException(
        "Skip merging regions " + RegionInfo.getShortNameToLog(regionsToMerge) +
          ", because we are taking snapshot for the table " + 
regionsToMerge[0].getTable());
    }
{code}

{code:title=SplitTableRegionProcedure.java}
    // Fail if we are taking snapshot for the given table
    if (env.getMasterServices().getSnapshotManager()
      .isTakingSnapshot(getParentRegion().getTable())) {
      setFailure(new IOException("Skip splitting region " + 
getParentRegion().getShortNameToLog() +
        ", because we are taking snapshot for the table " + 
getParentRegion().getTable()));
      return false;
    }
{code}

Thanks.


was (Author: apache9):
IIRC I have already prepared a patch, that in the preCheck for split and merge, 
if we find out that there is a snapshot operation on-going for this table, we 
will fail immediately. Not enough?

{code}
    // Fail if we are taking snapshot for the given table
    if (env.getMasterServices().getSnapshotManager()
      .isTakingSnapshot(regionsToMerge[0].getTable())) {
      throw new MergeRegionException(
        "Skip merging regions " + RegionInfo.getShortNameToLog(regionsToMerge) +
          ", because we are taking snapshot for the table " + 
regionsToMerge[0].getTable());
    }
{code}

{code}
    // Fail if we are taking snapshot for the given table
    if (env.getMasterServices().getSnapshotManager()
      .isTakingSnapshot(getParentRegion().getTable())) {
      setFailure(new IOException("Skip splitting region " + 
getParentRegion().getShortNameToLog() +
        ", because we are taking snapshot for the table " + 
getParentRegion().getTable()));
      return false;
    }
{code}

Thanks.

> Disable split/merge of a table during snapshot
> ----------------------------------------------
>
>                 Key: HBASE-21936
>                 URL: https://issues.apache.org/jira/browse/HBASE-21936
>             Project: HBase
>          Issue Type: Bug
>            Reporter: Vladimir Rodionov
>            Assignee: Vladimir Rodionov
>            Priority: Major
>             Fix For: 3.0.0, 2.2.0, 2.3.0
>
>         Attachments: HBASE-21936-master-v1.patch
>
>
> https://issues.apache.org/jira/browse/HBASE-17942 has introduced per table 
> split/merge enablement. This new feature should be used during table's 
> snapshot to avoid failure due to concurrent splits/merges.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to