Conversation
08b065a to
04cc152
Compare
04cc152 to
afe120e
Compare
27d3824 to
22accc3
Compare
c6f5a98 to
22accc3
Compare
|
CI failling on auditlog module but don't see any relation with this PR: |
22accc3 to
3e9cffc
Compare
3e9cffc to
d20f0cd
Compare
| .sudo() | ||
| .get_param( | ||
| "database_autovacuum_tuning.autovacuum_vacuum_max_threshold", | ||
| default="100000", |
There was a problem hiding this comment.
| default="100000", | |
| default="0", |
| "database_autovacuum_tuning.autovacuum_vacuum_max_threshold", | ||
| default="100000", | ||
| ) | ||
| or 100000 |
There was a problem hiding this comment.
| or 100000 | |
| or 0 |
There was a problem hiding this comment.
When the parameter is unset, we want 0
There was a problem hiding this comment.
When the parameter is unset, we want 0 => Changed that
| .sudo() | ||
| .get_param( | ||
| "database_autovacuum_tuning.autovacuum_vacuum_analyze_max_threshold", | ||
| default="50000", |
There was a problem hiding this comment.
| default="50000", | |
| default="0", |
|
|
||
| @api.model | ||
| def _tune(self): | ||
| vacuum_threshold = int( |
There was a problem hiding this comment.
Handle ValueError (for an empty string, something that does not parse as an integer)
| "database_autovacuum_tuning.autovacuum_vacuum_analyze_max_threshold", | ||
| default="50000", | ||
| ) | ||
| or 50000 |
There was a problem hiding this comment.
| or 50000 | |
| or 0 |
| @@ -0,0 +1,21 @@ | |||
| 1. Install the module on the database you want to tune. | |||
| 2. Ensure the `pgstattuple` extension is installed in PostgreSQL. | |||
There was a problem hiding this comment.
| 2. Ensure the `pgstattuple` extension is installed in PostgreSQL. |
| @@ -0,0 +1,2 @@ | |||
| id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink | |||
| access_database_autovacuum_tuning_system,access_database_autovacuum_tuning_system,model_database_autovacuum_tuning,base.group_system,1,1,1,1 | |||
There was a problem hiding this comment.
| access_database_autovacuum_tuning_system,access_database_autovacuum_tuning_system,model_database_autovacuum_tuning,base.group_system,1,1,1,1 | |
| access_database_autovacuum_tuning_system,access_database_autovacuum_tuning_system,model_database_autovacuum_tuning,base.group_system,1,0,1,1 |
There was a problem hiding this comment.
That seems fair to me. The system user does not need to write to the registers.
| @classmethod | ||
| def setUpClass(cls): | ||
| super().setUpClass() | ||
| cls.env.cr.execute("CREATE EXTENSION IF NOT EXISTS pgstattuple") |
There was a problem hiding this comment.
| cls.env.cr.execute("CREATE EXTENSION IF NOT EXISTS pgstattuple") |
There was a problem hiding this comment.
Not using pgstattuple extension anymore
| def _get_dead_tuples(self, schemaname="public", tablename="res_partner"): | ||
| table = f"{schemaname}.{tablename}" | ||
| self.env.cr.execute( | ||
| "SELECT dead_tuple_count FROM pgstattuple(%s::regclass)", |
| def setUpClass(cls): | ||
| super().setUpClass() | ||
| cls.env.cr.execute("CREATE EXTENSION IF NOT EXISTS pgstattuple") | ||
| with cls.env.registry.cursor() as cr: |
There was a problem hiding this comment.
I believe cursors are disabled in tests to never commit. If you want to test here I would recommend mocking.
There was a problem hiding this comment.
mocking the method now
45e51db to
9c69e00
Compare
9c69e00 to
772221f
Compare
Database Autovacuum Tuning helps administrators keep PostgreSQL healthy by
exposing recommended autovacuum settings in Odoo. It provides guidance for sizing thresholds and scale factors so large, busy databases
avoid table bloat and excessive vacuum lag. Use it to standardize autovacuum
configuration across environments and speed up maintenance operations without
manual tuning.