Apache9 commented on a change in pull request #2094: URL: https://github.com/apache/hbase/pull/2094#discussion_r463444498
########## File path: hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java ########## @@ -4272,43 +4275,96 @@ protected Durability getEffectiveDurability(Durability d) { } @Override + @Deprecated public boolean checkAndMutate(byte[] row, byte[] family, byte[] qualifier, CompareOperator op, ByteArrayComparable comparator, TimeRange timeRange, Mutation mutation) throws IOException { - return doCheckAndRowMutate(row, family, qualifier, op, comparator, null, timeRange, null, - mutation); + CheckAndMutate.Builder builder = CheckAndMutate.newBuilder(row) + .ifMatches(family, qualifier, op, comparator.getValue()).timeRange(timeRange); + try { + if (mutation instanceof Put) { + return checkAndMutate(builder.build((Put) mutation)).isSuccess(); + } else if (mutation instanceof Delete) { + return checkAndMutate(builder.build((Delete) mutation)).isSuccess(); + } else { + throw new DoNotRetryIOException( + "Unsupported mutate type: " + mutation.getClass().getSimpleName().toUpperCase()); + } + } catch (IllegalArgumentException e) { Review comment: Then we'd better let the try catch for IllegalArgumentException only wrap the builder.build? And then we call checkAndMutate, without catching the IllegalArgumentException. I think this will be better to let others know why we may hit IllegalArgumentException. ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org