Program: 166577
Project: 166577
Buggy source:
@Test public void testRowDelete() throws Exception {
  HTable hTable=createTable(Bytes.toBytes("String_Node_Str"),new byte[][]{TestBytes.family,TestBytes.family2});
  TransactionAwareHTable txTable=new TransactionAwareHTable(hTable,TxConstants.ConflictDetection.ROW);
  try {
    TransactionContext txContext=new TransactionContext(new InMemoryTxSystemClient(txManager),txTable);
    txContext.start();
    txTable.put(new Put(TestBytes.row).add(TestBytes.family,TestBytes.qualifier,TestBytes.value).add(TestBytes.family,TestBytes.qualifier2,TestBytes.value2).add(TestBytes.family2,TestBytes.qualifier,TestBytes.value).add(TestBytes.family2,TestBytes.qualifier2,TestBytes.value2));
    txContext.finish();
    txContext.start();
    Get get=new Get(TestBytes.row);
    Result result=txTable.get(get);
    assertFalse(result.isEmpty());
    assertArrayEquals(TestBytes.value,result.getValue(TestBytes.family,TestBytes.qualifier));
    assertArrayEquals(TestBytes.value2,result.getValue(TestBytes.family,TestBytes.qualifier2));
    assertArrayEquals(TestBytes.value,result.getValue(TestBytes.family2,TestBytes.qualifier));
    assertArrayEquals(TestBytes.value2,result.getValue(TestBytes.family2,TestBytes.qualifier2));
    txContext.finish();
    txContext.start();
    txTable.delete(new Delete(TestBytes.row));
    txContext.finish();
    txContext.start();
    result=txTable.get(new Get(TestBytes.row));
    assertTrue(result.isEmpty());
    result=txTable.get(new Get(TestBytes.row).addColumn(TestBytes.family,TestBytes.qualifier).addFamily(TestBytes.family2));
    assertTrue(result.isEmpty());
    ResultScanner scanner=txTable.getScanner(new Scan(TestBytes.row));
    assertNull(scanner.next());
    scanner.close();
    scanner=txTable.getScanner(new Scan(TestBytes.row).addColumn(TestBytes.family2,TestBytes.qualifier2));
    assertNull(scanner.next());
    scanner.close();
    txContext.finish();
    txContext.start();
    txTable.put(new Put(TestBytes.row).add(TestBytes.family,TestBytes.qualifier,TestBytes.value2).add(TestBytes.family2,TestBytes.qualifier2,TestBytes.value));
    txContext.finish();
    txContext.start();
    result=txTable.get(new Get(TestBytes.row));
    assertFalse(result.isEmpty());
    assertEquals(2,result.size());
    assertArrayEquals(TestBytes.value2,result.getValue(TestBytes.family,TestBytes.qualifier));
    assertArrayEquals(TestBytes.value,result.getValue(TestBytes.family2,TestBytes.qualifier2));
    scanner=txTable.getScanner(new Scan(TestBytes.row));
    Result result1=scanner.next();
    assertNotNull(result1);
    assertFalse(result1.isEmpty());
    assertEquals(2,result1.size());
    assertArrayEquals(TestBytes.value2,result.getValue(TestBytes.family,TestBytes.qualifier));
    assertArrayEquals(TestBytes.value,result.getValue(TestBytes.family2,TestBytes.qualifier2));
    scanner.close();
    txContext.finish();
    txContext.start();
    txTable.put(new Put(TestBytes.row2).add(TestBytes.family,TestBytes.qualifier,TestBytes.value).add(TestBytes.family,TestBytes.qualifier2,TestBytes.value2).add(TestBytes.family2,TestBytes.qualifier,TestBytes.value).add(TestBytes.family2,TestBytes.qualifier2,TestBytes.value2));
    txContext.finish();
    txContext.start();
    txTable.delete(new Delete(TestBytes.row2).deleteFamily(TestBytes.family));
    txContext.finish();
    txContext.start();
    Result fam1Result=txTable.get(new Get(TestBytes.row2));
    assertFalse(fam1Result.isEmpty());
    assertEquals(2,fam1Result.size());
    assertArrayEquals(TestBytes.value,fam1Result.getValue(TestBytes.family2,TestBytes.qualifier));
    assertArrayEquals(TestBytes.value2,fam1Result.getValue(TestBytes.family2,TestBytes.qualifier2));
    txContext.finish();
    txContext.start();
    txTable.put(new Put(TestBytes.row3).add(TestBytes.family,TestBytes.qualifier,TestBytes.value).add(TestBytes.family,TestBytes.qualifier2,TestBytes.value2).add(TestBytes.family2,TestBytes.qualifier,TestBytes.value).add(TestBytes.family2,TestBytes.qualifier2,TestBytes.value2));
    txContext.finish();
    txContext.start();
    txTable.delete(new Delete(TestBytes.row3).deleteFamily(TestBytes.family2));
    txContext.finish();
    txContext.start();
    Result fam2Result=txTable.get(new Get(TestBytes.row3));
    assertFalse(fam2Result.isEmpty());
    assertEquals(2,fam2Result.size());
    assertArrayEquals(TestBytes.value,fam2Result.getValue(TestBytes.family,TestBytes.qualifier));
    assertArrayEquals(TestBytes.value2,fam2Result.getValue(TestBytes.family,TestBytes.qualifier2));
    txContext.finish();
    txContext.start();
    for (int i=0; i < 10; i++) {
      txTable.put(new Put(Bytes.toBytes("String_Node_Str" + i)).add(TestBytes.family,TestBytes.qualifier,Bytes.toBytes(i)).add(TestBytes.family2,TestBytes.qualifier2,Bytes.toBytes(i)));
    }
    txContext.finish();
    txContext.start();
    for (int i=1; i < 10; i+=2) {
      txTable.delete(new Delete(Bytes.toBytes("String_Node_Str" + i)));
    }
    txContext.finish();
    txContext.start();
    int cnt=0;
    ResultScanner zScanner=txTable.getScanner(new Scan(Bytes.toBytes("String_Node_Str")));
    Result res;
    while ((res=zScanner.next()) != null) {
      assertFalse(res.isEmpty());
      assertArrayEquals(Bytes.toBytes("String_Node_Str" + cnt),res.getRow());
      assertArrayEquals(Bytes.toBytes(cnt),res.getValue(TestBytes.family,TestBytes.qualifier));
      assertArrayEquals(Bytes.toBytes(cnt),res.getValue(TestBytes.family2,TestBytes.qualifier2));
      cnt+=2;
    }
  }
  finally {
    txTable.close();
  }
}

Fixed version (ground truth):
@Test public void testRowDelete() throws Exception {
  HTable hTable=createTable(Bytes.toBytes("String_Node_Str"),new byte[][]{TestBytes.family,TestBytes.family2});
  TransactionAwareHTable txTable=new TransactionAwareHTable(hTable,TxConstants.ConflictDetection.ROW);
  try {
    TransactionContext txContext=new TransactionContext(new InMemoryTxSystemClient(txManager),txTable);
    txContext.start();
    txTable.put(new Put(TestBytes.row).add(TestBytes.family,TestBytes.qualifier,TestBytes.value).add(TestBytes.family,TestBytes.qualifier2,TestBytes.value2).add(TestBytes.family2,TestBytes.qualifier,TestBytes.value).add(TestBytes.family2,TestBytes.qualifier2,TestBytes.value2));
    txContext.finish();
    txContext.start();
    Get get=new Get(TestBytes.row);
    Result result=txTable.get(get);
    assertFalse(result.isEmpty());
    assertArrayEquals(TestBytes.value,result.getValue(TestBytes.family,TestBytes.qualifier));
    assertArrayEquals(TestBytes.value2,result.getValue(TestBytes.family,TestBytes.qualifier2));
    assertArrayEquals(TestBytes.value,result.getValue(TestBytes.family2,TestBytes.qualifier));
    assertArrayEquals(TestBytes.value2,result.getValue(TestBytes.family2,TestBytes.qualifier2));
    txContext.finish();
    txContext.start();
    txTable.delete(new Delete(TestBytes.row));
    txContext.finish();
    txContext.start();
    result=txTable.get(new Get(TestBytes.row));
    assertTrue(result.isEmpty());
    result=txTable.get(new Get(TestBytes.row).addColumn(TestBytes.family,TestBytes.qualifier).addFamily(TestBytes.family2));
    assertTrue(result.isEmpty());
    ResultScanner scanner=txTable.getScanner(new Scan(TestBytes.row));
    assertNull(scanner.next());
    scanner.close();
    scanner=txTable.getScanner(new Scan(TestBytes.row).addColumn(TestBytes.family2,TestBytes.qualifier2));
    assertNull(scanner.next());
    scanner.close();
    txContext.finish();
    txContext.start();
    txTable.put(new Put(TestBytes.row).add(TestBytes.family,TestBytes.qualifier,TestBytes.value2).add(TestBytes.family2,TestBytes.qualifier2,TestBytes.value));
    txContext.finish();
    txContext.start();
    result=txTable.get(new Get(TestBytes.row));
    assertFalse(result.isEmpty());
    assertEquals(2,result.size());
    assertArrayEquals(TestBytes.value2,result.getValue(TestBytes.family,TestBytes.qualifier));
    assertArrayEquals(TestBytes.value,result.getValue(TestBytes.family2,TestBytes.qualifier2));
    scanner=txTable.getScanner(new Scan(TestBytes.row));
    Result result1=scanner.next();
    assertNotNull(result1);
    assertFalse(result1.isEmpty());
    assertEquals(2,result1.size());
    assertArrayEquals(TestBytes.value2,result.getValue(TestBytes.family,TestBytes.qualifier));
    assertArrayEquals(TestBytes.value,result.getValue(TestBytes.family2,TestBytes.qualifier2));
    scanner.close();
    txContext.finish();
    txContext.start();
    txTable.put(new Put(TestBytes.row2).add(TestBytes.family,TestBytes.qualifier,TestBytes.value).add(TestBytes.family,TestBytes.qualifier2,TestBytes.value2).add(TestBytes.family2,TestBytes.qualifier,TestBytes.value).add(TestBytes.family2,TestBytes.qualifier2,TestBytes.value2));
    txContext.finish();
    txContext.start();
    txTable.delete(new Delete(TestBytes.row2).deleteFamily(TestBytes.family));
    txContext.finish();
    txContext.start();
    Result fam1Result=txTable.get(new Get(TestBytes.row2));
    assertFalse(fam1Result.isEmpty());
    assertEquals(2,fam1Result.size());
    assertArrayEquals(TestBytes.value,fam1Result.getValue(TestBytes.family2,TestBytes.qualifier));
    assertArrayEquals(TestBytes.value2,fam1Result.getValue(TestBytes.family2,TestBytes.qualifier2));
    txContext.finish();
    txContext.start();
    txTable.put(new Put(TestBytes.row3).add(TestBytes.family,TestBytes.qualifier,TestBytes.value).add(TestBytes.family,TestBytes.qualifier2,TestBytes.value2).add(TestBytes.family2,TestBytes.qualifier,TestBytes.value).add(TestBytes.family2,TestBytes.qualifier2,TestBytes.value2));
    txContext.finish();
    txContext.start();
    txTable.delete(new Delete(TestBytes.row3).deleteFamily(TestBytes.family2));
    txContext.finish();
    txContext.start();
    Result fam2Result=txTable.get(new Get(TestBytes.row3));
    assertFalse(fam2Result.isEmpty());
    assertEquals(2,fam2Result.size());
    assertArrayEquals(TestBytes.value,fam2Result.getValue(TestBytes.family,TestBytes.qualifier));
    assertArrayEquals(TestBytes.value2,fam2Result.getValue(TestBytes.family,TestBytes.qualifier2));
    txContext.finish();
    txContext.start();
    for (int i=0; i < 10; i++) {
      txTable.put(new Put(Bytes.toBytes("String_Node_Str" + i)).add(TestBytes.family,TestBytes.qualifier,Bytes.toBytes(i)).add(TestBytes.family2,TestBytes.qualifier2,Bytes.toBytes(i)));
    }
    txContext.finish();
    txContext.start();
    for (int i=1; i < 10; i+=2) {
      txTable.delete(new Delete(Bytes.toBytes("String_Node_Str" + i)));
    }
    txContext.finish();
    txContext.start();
    int cnt=0;
    ResultScanner zScanner=txTable.getScanner(new Scan(Bytes.toBytes("String_Node_Str")));
    Result res;
    while ((res=zScanner.next()) != null) {
      assertFalse(res.isEmpty());
      assertArrayEquals(Bytes.toBytes("String_Node_Str" + cnt),res.getRow());
      assertArrayEquals(Bytes.toBytes(cnt),res.getValue(TestBytes.family,TestBytes.qualifier));
      assertArrayEquals(Bytes.toBytes(cnt),res.getValue(TestBytes.family2,TestBytes.qualifier2));
      cnt+=2;
    }
    txContext.start();
    txTable.put(new Put(TestBytes.row4).add(TestBytes.family,TestBytes.qualifier,TestBytes.value).add(TestBytes.family2,TestBytes.qualifier2,TestBytes.value2));
    txTable.delete(new Delete(TestBytes.row4));
    txContext.finish();
    txContext.start();
    Result row4Result=txTable.get(new Get(TestBytes.row4));
    assertTrue(row4Result.isEmpty());
    txContext.finish();
  }
  finally {
    txTable.close();
  }
}