gristlabs_grist-core/app/gen-server/lib
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
..
DocApiForwarder.ts (core) Configure more comprehensive eslint rules for Typescript 2021-04-26 18:54:55 -04:00
DocWorkerMap.ts (core) Add rules to eslint to better match our coding conventions. 2021-05-24 12:56:18 -04:00
HomeDBManager.ts (core) avoid typeorm's .save() method for relation with multi-column primary key 2021-06-04 13:58:22 -04:00
Housekeeper.ts (core) Configure more comprehensive eslint rules for Typescript 2021-04-26 18:54:55 -04:00
Permissions.ts (core) move home server into core 2020-07-21 20:39:10 -04:00
scrubUserFromOrg.ts (core) move home server into core 2020-07-21 20:39:10 -04:00
TypeORMPatches.ts (core) revamp snapshot inventory 2020-10-30 13:52:46 -04:00
Usage.ts (core) discount indirect changes for access control purposes 2021-05-12 11:26:21 -04:00
values.ts (core) move home server into core 2020-07-21 20:39:10 -04:00