Project

General

Profile

Actions

Task #1806

open

ClearDirtyStateForContractSliceTaskExecutor runs in single transaction when started after Synchronization

Added by Alena Peterová over 5 years ago. Updated over 2 years ago.

Status:
New
Priority:
Normal
Assignee:
-
Category:
Long running task
Target version:
-
Start date:
08/20/2019
Due date:
% Done:

0%

Estimated time:
20.00 h
Owner:

Description

Version 9.7.3

ClearDirtyStateForContractSliceTaskExecutor runs in one single transaction when started after Synchronization. This is problematic when there are many time slices of contracts or many EAV's of contracts. It fails to finish. And when it fails, the processed dirty flags are not deleted from the DB => we are at the beginning.
When ClearDirtyStateForContractSliceTaskExecutor starts as a scheduled task, it processes every dirty flag separately. So when it fails, we can continue where we left.

Please change it so ClearDirtyStateForContractSliceTaskExecutor doesn't run in single transaction. And also please solve #1413, which slows it down very much.

Details:
We have 64919 slices after reconcilation, every contract (slice) has 10 EAVs. The ClearDirtyStateForContractSliceTaskExecutor after synchronization processed 27669 in 6 hours, but no change was commited. No entity event was visible in IdM and no provisioning was done (I don't know if they started or not...).
When I cancelled the task manually, it started to commit the big transaction. After 2 hours, it still wasn't commited. When I restarted IdM, all was lost.
During the 2 hours, the database queries almost always inserted something in idm_audit or selected next value from hibernate_sequence. The hibernate_sequence used cca 20 000 IDs.
Now I run ClearDirtyStateForContractSliceTaskExecutor from scheduled task. It has processed 24230 in 6,5 hours and everything is commited. The hibernate_sequence used cca 300 000 IDs.
There is evidently some problem with the big transaction for all slices - it's much slower than single transactions for every slice.

Some screenshots are attached - how the task was canceled and what happened in PostgreSQL during the commit.


Files

hibernate_sequence_value.png (11.4 KB) hibernate_sequence_value.png Alena Peterová, 08/20/2019 03:21 PM
postgres_transaction.png (56.3 KB) postgres_transaction.png Alena Peterová, 08/20/2019 03:21 PM
cancel_task.png (16.9 KB) cancel_task.png Alena Peterová, 08/20/2019 03:21 PM
dirty_states_DB.png (6.38 KB) dirty_states_DB.png Alena Peterová, 08/20/2019 03:21 PM
scheduled_tasks.png (54.9 KB) scheduled_tasks.png Alena Peterová, 08/20/2019 03:21 PM
lock.xlsx (7.79 KB) lock.xlsx Ondřej Kopr, 05/20/2021 05:20 PM
query.xlsx (6.28 KB) query.xlsx Ondřej Kopr, 05/20/2021 05:20 PM
003.png (66.7 KB) 003.png Ondřej Kopr, 05/20/2021 05:22 PM
002.png (68.8 KB) 002.png Ondřej Kopr, 05/20/2021 05:22 PM
001.png (40.9 KB) 001.png Ondřej Kopr, 05/20/2021 05:22 PM
004.png (128 KB) 004.png Ondřej Kopr, 05/20/2021 05:25 PM
takes.png (74 KB) takes.png Ondřej Kopr, 05/21/2021 05:28 AM
Actions

Also available in: Atom PDF