Skip to content

Commit 44fd8e3

Browse files
committed
Adjust TestQueryForUpdate for Yugabyte - use markAsDirty on repeatable read test
1 parent 6910016 commit 44fd8e3

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

ebean-test/src/test/java/org/tests/basic/TestQueryForUpdate.java

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -57,19 +57,23 @@ void concurrentForUpdate() throws InterruptedException {
5757
@Override
5858
public void run() {
5959
try (final Transaction transaction = db.createTransaction(TxIsolation.REPEATABLE_READ)) {
60-
log.info("(Y)Thread: before find");
61-
DB.find(Customer.class)
60+
log.info("(REPEATABLE_READ)Thread: before find");
61+
List<Customer> list = DB.find(Customer.class)
6262
.usingTransaction(transaction)
6363
.forUpdate()
6464
.findList();
6565

66-
log.info("(Y)Thread: after find");
66+
Customer first = list.get(0);
67+
db.markAsDirty(first);
68+
db.save(first, transaction);
69+
70+
log.info("(REPEATABLE_READ)Thread: after find");
6771
try {
6872
Thread.sleep(3000);
6973
} catch (InterruptedException e) {
7074
throw new RuntimeException(e);
7175
}
72-
log.info("(Y)Thread: done");
76+
log.info("(REPEATABLE_READ)Thread: done");
7377
}
7478
}
7579
};
@@ -79,13 +83,13 @@ public void run() {
7983

8084
long start = System.currentTimeMillis();
8185
try (final Transaction transaction = db.createTransaction(TxIsolation.REPEATABLE_READ)) {
82-
log.info("(Y)Main: before find");
86+
log.info("(REPEATABLE_READ)Main: before find");
8387
DB.find(Customer.class)
8488
.usingTransaction(transaction)
8589
.forUpdate()
8690
.findList();
8791

88-
log.info("(Y)Main: after find");
92+
log.info("(REPEATABLE_READ)Main: after find");
8993
}
9094

9195
long exeMillis = System.currentTimeMillis() - start;

0 commit comments

Comments
 (0)