gristlabs_grist-core/app/gen-server
Paul Fitzpatrick 2feef7f780 (core) avoid typeorm's .save() method for relation with multi-column primary key
Summary:
A recently added stress test ("deletes documents reasonably quickly" in removedAt.ts) is sporadically failing under postgres.  It looks like typeorm's .save() method is in some way unreliable when setting a table with multi-column primary keys, via a ManyToMany relation. This diff replaces the .save() with explicit inserts/deletes.

I modified _repairWorkspaceGuests recently, so thought that change might have been the problem. However under the stress test, failures occur as often in _repairOrgGuests (not changed recently) as in _repairWorkspaceGuests (changed recently).

For reference, see schema diagram at https://grist.quip.com/wWpRAMe058Nl/Home-DB (the table being updated is `group_users`).

Possibly related issue: https://github.com/typeorm/typeorm/issues/4122

Test Plan:
After this change, stress test runs well on postgres locally (no failure 70 iterations); before it would fail on postgres within 3 iterations typically.

Separately: I gave a test that failed a little more time to return, and confirmed it was no slower on average, so I think it was unrelated.

Reviewers: jarek

Reviewed By: jarek

Differential Revision: https://phab.getgrist.com/D2848
2021-06-04 13:58:22 -04:00
..
entity (core) add per-user per-org preferences to database 2020-08-04 15:20:13 -04:00
lib (core) avoid typeorm's .save() method for relation with multi-column primary key 2021-06-04 13:58:22 -04:00
migration (core) add per-user per-org preferences to database 2020-08-04 15:20:13 -04:00
ApiServer.ts (core) Add rules to eslint to better match our coding conventions. 2021-05-24 12:56:18 -04:00
sqlUtils.ts (core) add a test for unnecessary workspaces shown in trash, and fix issue 2020-07-23 11:04:33 -04:00