On Sonntag 22 Februar 2009 Paul J Stevens wrote:
> this has already been fixed in 2.3:

Yes, but could/should be in 2.2 too...? I think 2.2 will be used for 
quite a long time still, as 2.3 is development state, and after becoming 
2.4.0 needs to settle a bit before we are able to use it in production.

> if a mailbox has no child-mailboxes:
> delete from dbmail_mailboxes where mailbox_idnr = ?;
> if a mailbox does have child-mailboxes:
> BEGIN;
> UPDATE dbmail_messages SET status=PURGE WHERE mailbox_idnr = ?;
> UPDATE dbmail_mailboxes SET no_select = 1 WHERE mailbox_idnr = ?;
> COMMIT

Ah, 2.3 keeps the mailboxes until "dbmail-util -p", right? 
Why is it different: once you delete a mailbox and once you mark it 
no_select? Wouldn't the same schema all the time be better? I'd prefer 
keeping all mailboxes until after a "dbmail-util -p", to keep support 
from end users low ("I've deleted my mailbox". "OK, here is it 
restored". "Yeah, great support!").

You seem to be making a loop and then two updates per mailbox. Why not 
doing it all in one statement? The database is always faster with single 
commands, should be fine like:
UPDATE dbmail_mailboxes SET no_select = 1 WHERE mailbox_idnr IN (SELECT 
mailbox_idnr WHERE name like 'mbx/to/delete%');
UPDATE dbmail_messages SET status=PURGE WHERE mailbox_idnr IN (SELECT 
mailbox_idnr WHERE name like 'mbx/to/delete%');

And another question: Isn't it better to first mark the mailboxes 
no_select, and afterwards status=PURGE all messages? Like that, another 
user cannot enter the mailboxes anymore, and only afterward you throw 
messages away. It could be confusing on heavily shared accounts if a 
user enters a mailbox and suddenly messages vanish. This can also crash 
some clients (reading list of messages in mailbox - status=PURGE runs - 
tries to read message - bumm).

mfg zmi
-- 
// Michael Monnerie, Ing.BSc    -----      http://it-management.at
// Tel: 0660 / 415 65 31                      .network.your.ideas.
// PGP Key:         "curl -s http://zmi.at/zmi.asc | gpg --import"
// Fingerprint: AC19 F9D5 36ED CD8A EF38  500E CE14 91F7 1C12 09B4
// Keyserver: wwwkeys.eu.pgp.net                  Key-ID: 1C1209B4

Attachment: signature.asc
Description: This is a digitally signed message part.

_______________________________________________
Dbmail-dev mailing list
[email protected]
http://twister.fastxs.net/mailman/listinfo/dbmail-dev

Reply via email to