MerginMaps / db-sync

A tool for two-way synchronization between Mergin Maps and a PostGIS database
https://merginmaps.com
MIT License
45 stars 20 forks source link

GEODIFF: Error: Conflicts encountered while applying changes #50

Closed HugoP27 closed 3 years ago

HugoP27 commented 3 years ago

Hi Lutra Team

For some reason I've started getting the error below when I delete records in a table on Postgres in the main schema. See 2 examples below.

The setup is as follows:

  1. mergin-db-sync v1.0.5 keeping the DB in sync with the main mergin project (running in docker).
  2. mergin work packages syncing back to main mergin project using the mergin-wp tool.

Everything sync's and works fine except when I try to delete features from postgres and have it sync back to mergin. When I then restore the deleted row, the sync tool runs as normal. Any idea why this would happen please?

2021-07-20 09:27:17.111166 Trying to pull No changes on Mergin. Trying to push Changes: fruit_monitor 0 0 2 Writing DB changes to working dir... Warn: CONFLICT: delete_nothing: { "table": "fruit_monitor", "type": "delete", "changes": [ { "column": 0, "old": 284 }, { "column": 1, "old": "R1AAAeYQAAABAQAAANPKNcpI4DJAfGZLGc35QMA=" }, { "column": 2, "old": "{af58e6bd-eb99-4f03-9cb4-f06c7cfb16f2}" }, { "column": 3, "old": "C86" }, { "column": 4, "old": "F203" }, { "column": 5, "old": "B6223" }, { "column": 6, "old": null }, { "column": 7, "old": "{a86e3af0-1f56-476a-8bf4-17a335456015}" }, { "column": 8, "old": "Branch" }, { "column": 9, "old": 13 }, { "column": 10, "old": 8 }, { "column": 11, "old": 8 }, { "column": 12, "old": 5 }, { "column": 13, "old": 6 }, { "column": 14, "old": 6 }, { "column": 15, "old": 6 }, { "column": 16, "old": 11 }, { "column": 17, "old": 6 }, { "column": 18, "old": 6 }, { "column": 19, "old": 7 }, { "column": 20, "old": 5 }, { "column": 21, "old": 6 }, { "column": 22, "old": 7 }, { "column": 23, "old": 7 }, { "column": 24, "old": 6 }, { "column": 25, "old": 7 }, { "column": 26, "old": 7 }, { "column": 27, "old": 7 }, { "column": 28, "old": 7 }, { "column": 29, "old": 8 }, { "column": 30, "old": 8 }, { "column": 31, "old": 7 }, { "column": 32, "old": 7 }, { "column": 33, "old": 7 }, { "column": 34, "old": 11 }, { "column": 35, "old": 13 }, { "column": 36, "old": 14 }, { "column": 37, "old": 12 }, { "column": 38, "old": 7 }, { "column": 39, "old": 7 }, { "column": 40, "old": "JPEG_20210716_160349_7910095317185585251.jpg" }, { "column": 41, "old": "Comment" }, { "column": 42, "old": 7.6299999999999999 }, { "column": 43, "old": "2021-07-16T16:18:16Z" } ] } Warn: CONFLICT: delete_nothing: { "table": "fruit_monitor", "type": "delete", "changes": [ { "column": 0, "old": 285 }, { "column": 1, "old": "R1AAAeYQAAABAQAAAM3oqWU03zJA0UvvAZP5QMA=" }, { "column": 2, "old": "{4c592fa2-67b7-4cd7-9c26-9ca51621e7bd}" }, { "column": 3, "old": "C86" }, { "column": 4, "old": "F202" }, { "column": 5, "old": "B6217" }, { "column": 6, "old": null }, { "column": 7, "old": "{8d908bf5-3527-4c1b-8234-5cabfcfa9a6d}" }, { "column": 8, "old": "Tree" }, { "column": 9, "old": 4 }, { "column": 10, "old": 10 }, { "column": 11, "old": 9 }, { "column": 12, "old": 9 }, { "column": 13, "old": 9 }, { "column": 14, "old": 9 }, { "column": 15, "old": 11 }, { "column": 16, "old": 8 }, { "column": 17, "old": 8 }, { "column": 18, "old": 11 }, { "column": 19, "old": 10 }, { "column": 20, "old": null }, { "column": 21, "old": null }, { "column": 22, "old": null }, { "column": 23, "old": null }, { "column": 24, "old": null }, { "column": 25, "old": null }, { "column": 26, "old": null }, { "column": 27, "old": null }, { "column": 28, "old": null }, { "column": 29, "old": null }, { "column": 30, "old": null }, { "column": 31, "old": null }, { "column": 32, "old": null }, { "column": 33, "old": null }, { "column": 34, "old": null }, { "column": 35, "old": null }, { "column": 36, "old": null }, { "column": 37, "old": null }, { "column": 38, "old": null }, { "column": 39, "old": null }, { "column": 40, "old": "JPEG_20210719_081756_6679607430012651497.jpg" }, { "column": 41, "old": "Comment" }, { "column": 42, "old": 9.4000000000000004 }, { "column": 43, "old": "2021-07-19T08:17:52Z" } ] } Error: apply changeset failed! GEODIFF: Error: Conflicts encountered while applying changes! Total 2

Error: geodiff failed! ['/geodiff/build/geodiff', 'apply', '--driver', 'sqlite', '', '/tmp/dbsync/client_field_apps_db.gpkg', '/tmp/dbsync-push-base2our'] Going to sleep

And on another table

Trying to push Changes: water_flowmeter_monitor 0 0 1 Writing DB changes to working dir... Warn: CONFLICT: delete_nothing: { "table": "water_flowmeter_monitor", "type": "delete", "changes": [ { "column": 0, "old": 87 }, { "column": 1, "old": "R1AAAeYQAAABAQAAACkRQqBK3zJAvrf49aj5QMA=" }, { "column": 2, "old": "{a310059b-1cde-4324-9ac5-c008b2bb1658}" }, { "column": 3, "old": "C86" }, { "column": 4, "old": "F203" }, { "column": 5, "old": "Test flowmeter" }, { "column": 6, "old": "2021-07-19T10:20:21Z" }, { "column": 7, "old": 63838282 }, { "column": 8, "old": "JPEG_20210719_102027_8074284550380744558.jpg" }, { "column": 9, "old": "Note" }, { "column": 10, "old": null }, { "column": 11, "old": null }, { "column": 12, "old": "2021-07-19T10:20:21Z" } ] } Error: apply changeset failed! GEODIFF: Error: Conflicts encountered while applying changes! Total 1

Error: geodiff failed! ['/geodiff/build/geodiff', 'apply', '--driver', 'sqlite', '', '/tmp/dbsync/client_field_apps_db.gpkg', '/tmp/dbsync-push-base2our'] Going to sleep 2021-07-20 12:25:00.543165 Trying to pull No changes on Mergin. Trying to push Changes: water_flowmeter_monitor 0 0 1 Writing DB changes to working dir... Warn: CONFLICT: delete_nothing: { "table": "water_flowmeter_monitor", "type": "delete", "changes": [ { "column": 0, "old": 87 }, { "column": 1, "old": "R1AAAeYQAAABAQAAACkRQqBK3zJAvrf49aj5QMA=" }, { "column": 2, "old": "{a310059b-1cde-4324-9ac5-c008b2bb1658}" }, { "column": 3, "old": "C86" }, { "column": 4, "old": "F203" }, { "column": 5, "old": "Test flowmeter" }, { "column": 6, "old": "2021-07-19T10:20:21Z" }, { "column": 7, "old": 63838282 }, { "column": 8, "old": "JPEG_20210719_102027_8074284550380744558.jpg" }, { "column": 9, "old": "Note" }, { "column": 10, "old": null }, { "column": 11, "old": null }, { "column": 12, "old": "2021-07-19T10:20:21Z" } ] } Error: apply changeset failed! GEODIFF: Error: Conflicts encountered while applying changes! Total 1

Error: geodiff failed! ['/geodiff/build/geodiff', 'apply', '--driver', 'sqlite', '', '/tmp/dbsync/client_field_apps_db.gpkg', '/tmp/dbsync-push-base2our'] Going to sleep

wonder-sk commented 3 years ago

Fixed by upgrade to geodiff 1.0.4