Ghost/core/server/models/base/plugins
Fabien 'egg' O'Carroll 022c8c8e69
Added support for 'FOR UPDATE' lock (#14433)
refs https://github.com/TryGhost/Team/issues/1248

This is the underlying cause of the problems we've seen whilst handling
Stripe webhooks. A transaction ensures that the operations are atomic,
but not that they can run concurrently.

If you have some code which does this, concurrently:
1. Starts a transaction
2. Reads a value
3. Changes the values
4. Ends the transaction

Without applying the `FOR UPDATE` lock - you will have both sequenes
read the same value at step 2.

With the `FOR UPDATE` lock - one of the sequences will hang at step 2,
waiting for the other transaction to end, at which point it will resume
and read the _changed_ value.

Because the `edit` method explicitly does a read followed by a write, we
have also add the `FOR UPDATE` lock to this by default, to avoid any race
conditions. This does however require that `edit` is called within a
transaction. An issue here https://github.com/TryGhost/Team/issues/1503
considers running in a transaction by default.
2022-04-08 12:52:33 +01:00
..
actions.js Moved Bookshelf plugins to folder 2021-06-17 12:04:38 +01:00
bulk-operations.js Added bulkEdit to bulk-operations bookshelf plugin (#13223) 2021-08-13 12:19:02 +01:00
crud.js Added support for 'FOR UPDATE' lock (#14433) 2022-04-08 12:52:33 +01:00
data-manipulation.js Fixed unparsed booleans for "boolean" type columns 2022-01-20 17:00:16 +02:00
events.js Updated signature of Bookshelf model listeners 2021-09-10 16:59:11 +01:00
filtered-collection.js Moved Bookshelf plugins to folder 2021-06-17 12:04:38 +01:00
generate-slug.js 🐛 Fixed duplicate tags created when slugs contain spaces (#14277) 2022-03-10 13:07:00 +01:00
overrides.js 🐛 Fixed URLs not being correctly transformed during insert operations (#13618) 2021-10-20 15:22:46 +01:00
raw-knex.js Added "contains" operator support to ?filter= query params (#14286) 2022-03-09 13:02:17 +00:00
sanitize.js Fixed indenting for Bookshelf sanitize plugin JSDoc 2021-06-17 13:01:15 +01:00
user-type.js Moved Bookshelf plugins to folder 2021-06-17 12:04:38 +01:00