[
https://issues.apache.org/jira/browse/HBASE-17096?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15666289#comment-15666289
]
Andrew Purtell commented on HBASE-17096:
----------------------------------------
A bisect between rel/0.98.17 to rel/0.98.19 leads to
{noformat}
95dca64665a4b6999841f728b68143861d06bb93 is the first bad commit
commit 95dca64665a4b6999841f728b68143861d06bb93
Author: chenheng <[email protected]>
Date: Wed Apr 13 12:15:47 2016 +0800
HBASE-15629 Backport HBASE-14703 to 0.98+
Signed-off-by: Andrew Purtell <[email protected]>
:040000 040000 37ba7a5175c025115bc9ff961714730601646afa
12b1bb3fb3be12a87406367498a7b5bdf78fa8b5 M hbase-client
:040000 040000 d09c25c5cbeefd59117b5093bfa169df61f61162
2a3e3e82ffc9c6cd25b13c22b3e3ae8f6d5b6de1 M hbase-protocol
:040000 040000 839dddf858f565ccd9b528e118a6819717ee216d
709f68babc8d02369f9d4abd3b8bb5a89ac7ba74 M hbase-server
{noformat}
> 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)