Slow deletes (Cyrus-imapd 2.2.12 and quotalegacy)
Patrick Boutilier
boutilpj at ednet.ns.ca
Fri Oct 14 13:11:59 EDT 2005
Having a problem where deleting a cyrus user takes approximately 45
seconds. Using strace I can see that the lag occurs when cyrus goes
through each quota file in /var/imap/quota to try and figure out which
quota file to delete.
Searching Google I found this thread:
http://asg.web.cmu.edu/archive/message.php?mailbox=archive.cyrus-devel&msg=837
One of the messages in the thread
(http://asg.web.cmu.edu/archive/message.php?mailbox=archive.cyrus-devel&msg=840)
mentions that only the quota tool is affected by the foreach() call but
that is not correct. It also affects deleting a user.
From what I can see when performing a TRANSFER, DELETE, or RENAME
imapd.c calls the function user_deletedata to "take care of deleting
ACLs, subscriptions, seen state and quotas".
user_deletedata is a function in user.c which calls
user_deletequotaroots to delete the quotas. The problematic foreach() is
in this function also.
int user_deletequotaroots(const char *user)
{
struct namespace namespace;
char buf[MAX_MAILBOX_NAME+1], *inboxname = buf;
struct txn *tid = NULL;
int r;
/* set namespace */
r = mboxname_init_namespace(&namespace, 0);
/* get user's toplevel quotaroot (INBOX) */
if (!r)
r = (*namespace.mboxname_tointernal)(&namespace, "INBOX",
user, inboxname);
if (!r) {
struct find_rock frock = { NULL, NULL };
frock.inboxname = inboxname;
frock.tid = &tid;
r = config_quota_db->foreach(qdb, inboxname, strlen(inboxname),
&find_p, &find_cb, &frock, &tid);
}
if (!r) quota_commit(&tid);
return r;
}
I checked out the latest cyrus-imapd from CVS and the changes to the
quota tool work as expected. Much faster and strace shows that
/var/imap/quota is no longer being parsed file by file.
Would it be possible to port this new quota code into user.c as well so
user deletions work just as well? Thanks.
More information about the Info-cyrus
mailing list