JanssenProject / JanssenProject/jans

feat(jans-core): add Application-level transactions support

Open
#10,287 1 comment 1 reaction 1 assignee Claimed by @yurem View on GitHub
comp-jans-core kind-feature priority-3 triaged
Dominant language
Java
Stars
648
Forks
174
Avg merge
1d 18h
Merged PRs (30d)
110

Description

Few server nodes can update entries like statistic/cache/MAU simultaneously. As result this might led to data unsync.

There are few approach to grantee that node updated entry correctly. Transactions helps to resolve this issue but this will led to performance decreases and can led to deadlocks, etc.

**Optimistic Locking**
We have an additional version column. The version column is incremented every time an UPDATE or DELETE is executed, and it is also used in the WHERE clause of the UPDATE and DELETE statements. For this to work, we need to issue the SELECT and read the current version prior to executing the UPDATE or DELETE, as otherwise, we would not know what version value to pass to the WHERE clause or to increment.

![Image](https://github.com/user-attachments/assets/98af9432-8179-461b-9fd8-ea1f6748d1a7)

Another approach is to do this with **Application-level transactions**
![Image](https://github.com/user-attachments/assets/e25f23bb-19a7-4287-9512-2c420b7b2fe6)

ORM should support application level transactions:
1) Add mew property @Version to specify which column will be used
2) Add new method updateWithVersion

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.