Stop hammering ir_translation id sequence#11
Conversation
We've had some instances actually reaching the 2**31 limit, because
the temporary table used to prepare potential insertions used the same
id sequence as the main table, hence each insert in the temporary table
bumps the sequence.
Aggravations:
- if one hits the wall, the instance won't start
- if one resets the sequence too close from an existing id, it won't start either
- the existing ids are spread across the whole spectrum, making it hard to find
a safe range to reset the sequence.
Yes this probably means instances that restart too much, but that's another issue.
The whole system is questionable at best [1] but this fix should have no impact, and
improve a bit startup performance and PostgreSQL health. On the other hand, we can't
guarantee without a long analysis that's out of our scope that even changing
ir_translation to a bigint would have no impact, yet alone give this the full rewrite
it certainly deserves.
[1] for starters, why use the DB at all in preparation, and use a temporary table
that's logically tied to a specific connection ?
|
Looks nice. But could you explain a way to reproduce the issue and see the id_seq grow? Could you also point to the version on which this issue was seen? (oca? odoo? branch? commit?) |
|
Target version: the one I'm doing the PR against ! In my case: Then start odoo (and stop it if you like): And check the values again: Conclusion: no actual value has been used, but the sequence has been updated more than 300 times. The more addons you have, the worst it is. After the fix, you'd see a delta of 1 for |
|
I've been a bit imprecise in my wording : it occurred in production on a tagged version of that branch but it affects most probably all versions since 2011. We can check that afterwards if you like |
Description of the issue/feature this PR addresses: startup failures due to ir_translation_id_seq overflow (DataError)
Current behavior before PR: ir_translation_id_seq grows by big steps, can reach 2**31 in months
Desired behavior after PR is merged: ir_translation_id_seq grows only if new translations appear
(I have NOT signed Odoo CLA)
We've had some instances actually reaching the 2**31 limit, because
the temporary table used to prepare potential insertions used the same
id sequence as the main table, hence each insert in the temporary table
bumps the sequence.
Aggravations:
a safe range to reset the sequence.
Yes this probably means instances that restart too much, but that's another issue.
The whole system is questionable at best [1] but this fix should have no impact, and
improve a bit startup performance and PostgreSQL health. On the other hand, we can't
guarantee without a long analysis that's out of our scope that even changing
ir_translation to a bigint would have no impact, yet alone give this the full rewrite
it certainly deserves.
[1] for starters, why use the DB at all in preparation, and use a temporary table
that's logically tied to a specific connection ?