openerp-india team mailing list archive
-
openerp-india team
-
Mailing list archive
-
Message #12172
[Bug 1009014] Re: vacuum on transient model cannot work
Thinking further about _transient_max_count....
This parameter seems to mean that whenever the maximum number of records
is reached, that cleaning will be done. In the comments of the method,
it is described as a limit that when reached will trigger cleaning.
However in the code - which is not reached because of the bug described
- something entirely different is done: no matter what the actual number
of records is, when count base vacuum is called it will delete a maximum
of _transient_max_count rows.
Actually this might mean that the number of transient records will
increase forever. Put max-count on 10. Vacuuming will only be done every
20 records (20 is the _transient_check_time value). So 10 records will
be left in the database. On the next vacuum action, 20 records will be
left in the database. And so on....
Seems better to me to forget about count based vacuuming altogether.
What is the use case?
If there still is a reason to implement it, then the actual number of
records in the database should be retrieved, and compared with the
max_count to decide wether deletions should be carried out...
--
You received this bug notification because you are a member of OpenERP
Indian Team, which is subscribed to OpenERP Server.
https://bugs.launchpad.net/bugs/1009014
Title:
vacuum on transient model cannot work
Status in OpenERP Server:
Confirmed
Bug description:
For transient models there are some methods to automatically unlink
old records, based on age or a count of records.
At the same time there is logic that is intended to only cleanup older
records, after the vaccum function has been called a number of times.
The vacuum function is called:
- from a cronjob
- on each create call on a transient model
problem is that te counter to prevent too frequent calls, is reset on
every call. Therefore vacuum cleaning never gets done:
self._transient_check_count += 1
if (not force) and (self._transient_check_count % self._transient_check_time):
self._transient_check_count = 0
return True
This problem masks another problem: if configuration is based on a
maximum count of records, then when cleaning is done ALL existing
records will be deleted. This might not be a problem is only one user
is using the transient model at that time. But with multiple users,
this is bound to result in errors...
Therefore:
- the counter should ONLY be reset when actual cleaning is done.
- cleaning on number of records should leave a minimum amount of records, or alternatively, only delete records that have not been changed in say 10 minutes.
I will create a branch containing these changes...
To manage notifications about this bug go to:
https://bugs.launchpad.net/openobject-server/+bug/1009014/+subscriptions
References