Skip to content

Commit

Permalink
FIX: Transaction was not really created
Browse files Browse the repository at this point in the history
  • Loading branch information
rPraml committed Dec 8, 2023
1 parent ecdf8bd commit e45e87f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -587,6 +587,7 @@ private TxScope initTxScope(TxScope txScope) {
private boolean isCreateNewTransaction(SpiTransaction current, TxType type) {
switch (type) {
case REQUIRED:
return current == null || !current.isActive();
case SUPPORTS:
return current == null;
case REQUIRES_NEW:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -243,11 +243,15 @@ public void test_txn_with_not_supported() {
try (Transaction txn1 = DB.beginTransaction()) {
assertThat(getInScopeTransaction()).isNotNull();
getInScopeTransaction().putUserObject("foo", "bar");
assertThat(Transaction.current()).isNotNull();

try (Transaction txn2 = DB.beginTransaction(TxScope.notSupported())) {
// pause txn1
assertThat(Transaction.current()).isNull();

try (Transaction txn3 = DB.beginTransaction()) {
// create a new Txn scope
assertThat(Transaction.current()).isNotNull();
txn3.commit();
}
txn2.commit();
Expand Down

0 comments on commit e45e87f

Please sign in to comment.