Hey everyone,
Just wanted to add that I think re-focusing on better code review practices is important for us.
I am about to revert some changes that were made from a Malawi pull request (
https://github.com/OpenLMIS/openlmis-referencedata/pull/22), which had annotated that
the RightAssignmentRepository was being audited by Javers. This should not have happened, as right assignments are not part of the domain and do not have business logic, but is a data structure used for performance. Therefore, it does not make sense to be
auditing it and having an audit trail for it.
I suspect that enabling auditing for the RightAssignmentRepository is what is causing startup times to have taken an hour plus, as the AuditLogInitializer (which runs at the startup of Reference Data Service) is creating an initial snapshot for
each row in the right_assignments table. For Malawi, this is about 130,000 records. I created a similar scenario on my local machine, adding about 200,000 records into the right_assignments table, and then letting the AuditLogInitializer run. It was running
for a while, average about 2.5-3 minutes for each 10,000 snapshots (1 snapshot per 1 row in right_assignments). Extrapolated, creating all snapshots for right-assignments would take about 45-60 minutes. When I removed the code that enabled auditing of right
assignments, startup took 8 minutes total, half of which was the AuditLogInitializer.
Even though this pull request was reviewed, it had:
- about 100 files changed
- over 2000 lines changed
This pull request was just too large for any person to review in-depth, which is probably why this issue was missed.
Shalom,
Chongsun
--
There are 10 kinds of people in this world; those who understand binary, and those who don’t.
Software Development Engineer
2900 Eastlake Ave. E, Suite 230, Seattle, WA 98102, USA
SKYPE: chongsun.ahn.vr