XiaoMi / themis

Themis provides cross-row/cross-table transaction on HBase based on google's percolator.
Apache License 2.0
225 stars 67 forks source link

Not atomic in case we kill the transaction in the middle #4

Open ehudl opened 9 years ago

ehudl commented 9 years ago

Hi, I am testing your code. And in order to understand it, I ran the Example.java code https://github.com/XiaoMi/themis/blob/master/themis-client/src/main/java/org/apache/hadoop/hbase/themis/example/Example.java

I changed the write part to the code below, I ran it in debug mode and killed it exactly after Transaction. commitPrimary();

Then when I try to read (with Themis api) the primary line I get the value, but when I am trying to read the secondaries, I get TransactionExpiredException or LockConflictException

Please let me know what I am doing wrong ?

Some disclaimers:

  1. I compiled the code with 2.0.0-cdh4.4.0</hadoop.version> 0.94.6-cdh4.4.0 cause of that I had to change some code, but it was pretty straightforward.
  2. I am not using LocalTimestampOracle.

//Code : { // write two rows Transaction transaction = new Transaction(conf, connection); ThemisPut put = new ThemisPut("another row".getBytes()).add(FAMILY, QUALIFIER, VALUE); transaction.put(TABLENAME, put); for (int i = 0 ; i < 10 ; i++ ){ put = new ThemisPut(("another row"+ i).getBytes()).add(FAMILY, QUALIFIER, ("This is another value !!" + i ).getBytes()); transaction.put(TABLENAME, put); }

  transaction.commit();
  System.out.println("init, using themisPut, set valueA=10, valueB=10");
}