themis icon indicating copy to clipboard operation
themis copied to clipboard

Not atomic in case we kill the transaction in the middle

Open ehudl opened this issue 10 years ago • 0 comments

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 <hadoop.version>2.0.0-cdh4.4.0</hadoop.version> <hbase.version>0.94.6-cdh4.4.0</hbase.version> 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");
}

ehudl avatar Jan 06 '15 11:01 ehudl