You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@phoenix.apache.org by Curtis Howard <cu...@gmail.com> on 2018/12/11 20:20:18 UTC

Tephra transaction - SELECT after INSERT shows missing data

Hi,

We have an application that issues two sequential inserts within the same
transaction using Spring (JTA, currently passing 'read_committed' and
propagation.REQUIRED options).  The app verifies the first insert's data is
available before proceeding to the second insert, similar to the following
code:

@transactional
void insertOuter(Object obj1, Object obj2) throws SomeException {
// Spring call to insert obj1 into Phoenix transactional table1
insertInner(obj2)
}

@Transactional
void insertInner(Object obj) throws SomeException {
checkToEnsureObj1WasInserted() // ** THIS FAILED
... // code to insert object 2
}

We encountered a single intermittent failure last week, where
checkToEnsureObj1WasInserted() could not find the first insert's data
(otherwise, the check has always succeeded in the past).

Spring's Propagation.REQUIRED option ensures insertInner() is part of the
same same transaction initiated by insertOuter():
https://docs.spring.io/spring-framework/docs/current/javadoc-api/org/springframework/transaction/annotation/Propagation.html#REQUIRED
And as we understand it, the first insert's data should be available within
the same transaction context given snapshot isolation and the Phoenix
documentation:  https://phoenix.apache.org/transactions.html

Is there particular logging that we can look for (or enable, if needed) to
confirm:
1) our transactions are in-fact using Tephra snapshot isolation
2) any lower level Tephra transaction details which may help us
troubleshoot this issue, if and when it occurs again?

Thanks very much
Curtis