Michael Alan Dorman wrote:

"Aaron Stone" <[EMAIL PROTECTED]> writes:

This also underscores the need for transactions, otherwise it would be
possible for two messages to be inserted at almost the same time and lose
count of the size of one of those messages. A full recalculation as part of
the maintenance script might tide us over in the mean time...


As long as you're doing the addition in your SQL (update blah set
quota = quota + size) statement, there should be no problem of lost
additions.  Without begin/commit, transactions are implicit in
PostgreSQL, and such actions are atomic in MySQL.
I'm using SQL addition and subtraction. So not much of a problem there.

BTW, I've commited some code which also decreases the user's current mailsize when messages are deleted (or status set to >= 2).

I've done some tests inserting new messages and storing them as deleted (no change in quotum use) and expunging. All seems to work OK.

I've done some other optimizations:
some functions (e.g. db_expunge()) need to have the user_idnr of the owner of the mailbox. This was looked up every time using a query, even though the function calling db_expunge() had the user_idnr already. So, it's much better to pass the user_idnr along from the calling function.

There are a lot more functions that have this behaviour. We can gain quite a lot if we eliminate this.

Ilja

Reply via email to