Javers log initializer - do not iterate over all items
While made some improvements to the initialization of Javers tables, we should still consider making further improvements to make our startup time better.
Currently the log initializer retrieves all objects (for example requisitions) and iterates over them, initializing the audit log for the entries that do not have it (in a paginated manner):
We should avoid iterating over hundreds of thousands of items during startup. There a few ways we can do this:
figure out a way to fetch only the items that do not have audit history. From my understanding it's not trivial, that's why it was not implemented - but please make sure you try to figure out a way, this is the cleanest solution possible.
consider using spring profiles to enable/disable this process
a date based mechanism, that uses timestamps to figure out the newly added items
In any case, the acceptance criteria is:
Services do not iterate over all records for auditable tables at startup
Auditable records inserted by demo data or directly into the database will still have their audit logs initialized properly upon startup
Before starting implementation, suggest a solution on the mailing list
Looked into all changed services and it seems it works fine. Moving to Done.
Moving to Demo data epic as that epic comes with an increase in scale of demo-data for which this must be addressed. Also bumping priority.
Note: The javers jv_global_id table constains in the local_id column id of object so for example to connect this table with requisitions we have to execute the following SQL statement: