summaryrefslogtreecommitdiff
path: root/addons/payment_authorize/static/src
diff options
context:
space:
mode:
authorJairo Llopis <jairo.llopis@tecnativa.com>2020-10-20 09:22:54 +0000
committerOlivier Dony <odo@odoo.com>2020-10-27 17:08:39 +0000
commit831d306e1bee5c01bad1c9c7a0c7d5b58b7789ea (patch)
tree25bfbe3a9780896ebe2998f914ebb0dd403ac7e2 /addons/payment_authorize/static/src
parentb80e44bac5de3ccffad42917307bb5f049a7bec6 (diff)
[FIX] base: replace useless vat index with regular one
The custom vat index name matched the name that the system uses for automatic indexes (when a field has `index=True`). But the `vat` field was created with `index=False`, and this means that the ORM would execute a `DROP INDEX IF EXISTS res_partner_vat_index` when updating any addon that touches the `res.partner` model. Since this model is so ubiquitous, this resulted in a ton of unnecessary `DROP INDEX` + `CREATE INDEX` queries when updating any database. What's even worse is that dropping or creating an index needs a complete semaphore lock of the whole table, so if you're updating a high-traffic HA production instance while it is running, you have a very high rate of concurrency failures, because almost everybody is going to be using the `res.partner` model in some way almost all the time. A deeper investigation reveals that the index itself was useless. It was added in a6e1eb9 and apparently meant to be used for optimizing name_search(). But even though a6e1eb9 modified name_search(), it did the substitution in Python[1], so in practice the database had no way to recognize the pattern and never used the index. The specificity of that index makes it useless for other cases too, so it can simply be dropped to save space. Further, considering that the `vat` field is a common search criterion, it actually makes sense to enable a normal index on that field, by setting `index=True`. Neither dropping the index nor creating the default one has any impact on existing databases, so it's safe in a stable series. A new installation or a forced update will be necessary to benefit from the changes. ~~Finally, because the bad custom index had the same name as the regular one, an upgrade script is foreseen to drop the old one before letting the ORM re-create it properly.~~ Fwd-port note: the upgrade script and version bump were reverted as a consequence of the unforeseen consequences in #60771. 1: https://github.com/odoo/odoo/blob/a6e1eb9f0ad285fac7d0ca0b9f89f046d78ec9c7/odoo/addons/base/models/res_partner.py#L710 @Tecnativa TT26303 Closes #60346 See also: #60771 closes odoo/odoo#60858 X-original-commit: 2f4a7de3d25cec36ac3b85e3f33122728346c206 Signed-off-by: Olivier Dony (odo) <odo@openerp.com>
Diffstat (limited to 'addons/payment_authorize/static/src')
0 files changed, 0 insertions, 0 deletions