Skip to content

Commit

Permalink
Update model-server/src/main/kotlin/org/modelix/model/server/store/Ig…
Browse files Browse the repository at this point in the history
…niteStoreClient.kt

Co-authored-by: Oleksandr Dzhychko <[email protected]>
  • Loading branch information
slisson and odzhychko authored Dec 12, 2024
1 parent 8047bc4 commit 09c1af7
Showing 1 changed file with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,12 @@ class IgniteStoreClient(jdbcProperties: Properties? = null, private val inmemory
globalReadTransactions.acquireAndRun(maxReadTransactions) {
val transactions = ignite.transactions()
check(transactions.tx() == null) { "Already inside a transaction" }
// `OPTIMISTIC` and `READ_COMMITTED`
// are used instead of the default `PESSIMISTIC` and `REPEATABLE_READ`
// because they do not acquire fewer locks when writing.
// It is ok to acquire fewer locks,
// because the `globalReadTransactions`
// semaphore ensures no writes can happen in parallel.
transactions.txStart(TransactionConcurrency.OPTIMISTIC, TransactionIsolation.READ_COMMITTED).use { tx ->
pendingChangeMessages.runAndFlush {
val result = body()
Expand Down

0 comments on commit 09c1af7

Please sign in to comment.