Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 9FD01200BCC for ; Tue, 15 Nov 2016 06:49:00 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id 9E76F160B0F; Tue, 15 Nov 2016 05:49:00 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id E6B5D160B0D for ; Tue, 15 Nov 2016 06:48:59 +0100 (CET) Received: (qmail 46613 invoked by uid 500); 15 Nov 2016 05:48:59 -0000 Mailing-List: contact issues-help@hbase.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Delivered-To: mailing list issues@hbase.apache.org Received: (qmail 46253 invoked by uid 99); 15 Nov 2016 05:48:58 -0000 Received: from arcas.apache.org (HELO arcas) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 15 Nov 2016 05:48:58 +0000 Received: from arcas.apache.org (localhost [127.0.0.1]) by arcas (Postfix) with ESMTP id 6B04F2C4C73 for ; Tue, 15 Nov 2016 05:48:58 +0000 (UTC) Date: Tue, 15 Nov 2016 05:48:58 +0000 (UTC) From: "Andrew Purtell (JIRA)" To: issues@hbase.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (HBASE-17096) checkAndMutateApi doesn't work correctly on 0.98.19+ MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Tue, 15 Nov 2016 05:49:00 -0000 [ https://issues.apache.org/jira/browse/HBASE-17096?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15666193#comment-15666193 ] Andrew Purtell commented on HBASE-17096: ---------------------------------------- My first attempt at a reproduction using a new unit in HRegion tests did not reproduce the behavior. {code} @Test public void testCheckAndMutate_HBASE17096() throws IOException { byte[] row = Bytes.toBytes("ROW"); byte[] qualifier = Bytes.toBytes("QUALIFIER"); byte[] oldValue = null; byte[] newValue = Bytes.toBytes("VALUE"); // Setting up region String method = this.getName(); this.region = initHRegion(tableName, method, CONF, fam1); try { Put put = new Put(row); put.add(fam1, qualifier, newValue); assertTrue(region.checkAndMutate(row, fam1, qualifier, CompareOp.EQUAL, new BinaryComparator(oldValue), put, true)); Delete delete = new Delete(row); assertTrue(region.checkAndMutate(row, fam1, qualifier, CompareOp.EQUAL, new BinaryComparator(newValue), delete, true)); assertFalse(region.checkAndMutate(row, fam1, qualifier, CompareOp.EQUAL, new BinaryComparator(newValue), delete, true)); } finally { HRegion.closeHRegion(this.region); this.region = null; } } {code} This bypasses the client side, RPC processing, and does not specify a TTL in the schema. I'll try again now with a closer approximation as a new unit for client side tests. > checkAndMutateApi doesn't work correctly on 0.98.19+ > ---------------------------------------------------- > > Key: HBASE-17096 > URL: https://issues.apache.org/jira/browse/HBASE-17096 > Project: HBase > Issue Type: Bug > Reporter: Samarth Jain > > Below is the test case. It uses some Phoenix APIs for getting hold of admin and HConnection but should be easily adopted for an HBase IT test. The second checkAndMutate should return false but it is returning true. This test fails with HBase-0.98.23 and works fine with HBase-0.98.17 > {code} > @Test > public void testCheckAndMutateApi() throws Exception { > byte[] row = Bytes.toBytes("ROW"); > byte[] tableNameBytes = Bytes.toBytes(generateUniqueName()); > byte[] family = Bytes.toBytes(generateUniqueName()); > byte[] qualifier = Bytes.toBytes("QUALIFIER"); > byte[] oldValue = null; > byte[] newValue = Bytes.toBytes("VALUE"); > Put put = new Put(row); > put.add(family, qualifier, newValue); > try (Connection conn = DriverManager.getConnection(getUrl())) { > PhoenixConnection phxConn = conn.unwrap(PhoenixConnection.class); > try (HBaseAdmin admin = phxConn.getQueryServices().getAdmin()) { > HTableDescriptor tableDesc = new HTableDescriptor( > TableName.valueOf(tableNameBytes)); > HColumnDescriptor columnDesc = new HColumnDescriptor(family); > columnDesc.setTimeToLive(120); > tableDesc.addFamily(columnDesc); > admin.createTable(tableDesc); > HTableInterface tableDescriptor = admin.getConnection().getTable(tableNameBytes); > assertTrue(tableDescriptor.checkAndPut(row, family, qualifier, oldValue, put)); > Delete delete = new Delete(row); > RowMutations mutations = new RowMutations(row); > mutations.add(delete); > assertTrue(tableDescriptor.checkAndMutate(row, family, qualifier, CompareOp.EQUAL, newValue, mutations)); > assertFalse(tableDescriptor.checkAndMutate(row, family, qualifier, CompareOp.EQUAL, newValue, mutations)); > } > } > } > {code} > FYI, [~apurtell], [~jamestaylor], [~lhofhansl]. -- This message was sent by Atlassian JIRA (v6.3.4#6332)