@Override
    public OperationStatus[] batchMutate(Mutation[] mutations, boolean atomic, long nonceGroup,
      long nonce) throws IOException {
      if (
        MasterRegionFactory.TABLE_NAME.equals(getTableDescriptor().getTableName())
          && ERROR_OUT.get()
      ) {
        // First time errors are recovered with enough retries
        if (FIRST_TIME_ERROR.get() && ERROR_COUNTER.getAndIncrement() == 5) {
          ERROR_OUT.set(false);
          ERROR_COUNTER.set(0);
          FIRST_TIME_ERROR.set(false);
          return super.batchMutate(mutations, atomic, nonceGroup, nonce);
        }
        // Second time errors are not recovered with enough retries, leading to master abort
        if (!FIRST_TIME_ERROR.get() && ERROR_COUNTER.getAndIncrement() == 8) {
          ERROR_OUT.set(false);
          ERROR_COUNTER.set(0);
        }
        throw new RegionTooBusyException("test error...");
      }
      return super.batchMutate(mutations, atomic, nonceGroup, nonce);
    }
MasterRegion related test that ensures the operations continue even when Procedure state update
encounters retriable IO errors.
hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestMasterRegionMutation1.java