Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The expiration job should use locking #1809

Open
zcgandcomp opened this issue Dec 15, 2024 · 2 comments
Open

The expiration job should use locking #1809

zcgandcomp opened this issue Dec 15, 2024 · 2 comments

Comments

@zcgandcomp
Copy link
Member

TBD: Use optimistic locking in the expiration job, i.e., update only records with PENDING status on the DB level.

Test:
Initiate operation approval (can be simulated with update of the status in the DB)
Run the job expiration job.
The sessions should get locked depending on the commit setting. But approved operation cannot be marked as Expired.

@banterCZ
Copy link
Member

Mind that in case of optimistic locking, most probably we should set spring.jpa.properties.hibernate.batch_versioned_data=true for batch processing. For testing, we may use spring.jpa.properties.hibernate.generate_statistics=true.

@zcgandcomp
Copy link
Member Author

I'm leaving it open on purpose. But the optimistic locking like:
update pa_operation set status = 3 where status = 1 and id in (...) is fine, and ensure that the approved operation is not expired by any racing conditions.

I would rather avoid the versioning column in the table. This would be more complicated and cannot bring better results than previously mentioned update.

@zcgandcomp zcgandcomp transferred this issue from wultra/powerauth-push-server Dec 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants