-
Notifications
You must be signed in to change notification settings - Fork 38
Description
Ticket:
https://avni.freshdesk.com/a/tickets/6973
Describe the bug
Metadata zip bundle upload fails entirely but status is marked as Completed.
This happened when shelter tried to upload previous version of the organisation bundle which they had captured as backup.
The issue was that, there were overwrites in displayOrder-fe-feg combination which was causing DB constraint error, which was swallowed and not surfaced to the user.
Also, after the error, transaction was not committed and no other changes were done in the DB as part of the backup version bundle upload.
Status was shown as 129 rows read, 128 rows completed. But none actually got updated, as the DB level constraint failure aborted the entire DB transaction.
Shelter-3.zip
Shelter-1.zip
Shelter-2.zip
To Reproduce
Steps to reproduce the behavior:
- Go to your test org "Admin" => "Upload" section
- Click on 'Metadata Zip', select the "Shelter-1.zip" file and upload to do initial setup. Should complete successfully.
- Click on 'Metadata Zip', select the "Shelter-2.zip" file and upload to get into second situation. Should complete successfully.
- Click on 'Metadata Zip', select the "Shelter-1.zip" file and upload the 1st bundle file to attempt revert of forms and other changes. This would show as completed, but out of 129 rows read, only 128 rows completed.
- Check that none of the revert expected from the old version bundle upload actually happened.
Expected behavior
Upload of previous version of bundle should over-write the forms and revert changes to entities which were present in the first version. But new entities created in second version should not be changed in any way.
Additional context : Workaround done to unblock implementation
- In-order to avoid clash with displayOrder, i had to manually increment all displayOrder values for FEG and FE by 1000 for "Household form".
set role shelter;
select form_id from form_element_group where uuid = '34ab2583-da33-4f47-a47f-f37e1d786b3c';
-- 312
update form_element_group set display_order = display_order+1000 where form_id = 312;
update form_element set display_order = display_order+1000 where form_element_group_id in (select id from form_element_group where form_id = 312);- I also voided all the FE and FEG of the form, in-order to hide the new FEs and FEGs to revert to previous state as per backup bundled version form
update form_element_group set is_voided = true where form_id = 13778;
update form_element set is_voided = true where form_element_group_id in (select id from form_element_group where form_id = 13778);- Post this upload the bundle single file, in-order to restore to earlier version form config Shelter_Old_Household_form.zip
Error Logs
2025-09-15T10:15:50.443Z ERROR 4027427 --- [http-nio-8021-exec-13] org.avni.server.util.BugsnagReporter : Hibernate transaction: Unable to commit against JDBC Connection; ERROR: duplicate key value violates unique constraint "fe_feg_id_display_order_org_id_is_voided_key"
org.springframework.dao.DuplicateKeyException: Hibernate transaction: Unable to commit against JDBC Connection; ERROR: duplicate key value violates unique constraint "fe_feg_id_display_order_org_id_is_voided_key"
Developer Checklist
Developer fixing the bug should fill this checklist.
- Does the fix require extensive regression testing?
- Are you mentioning the required scenarios that could be affected?
Metadata
Metadata
Assignees
Labels
Type
Projects
Status