Large Mailbox Append Fix

Bron Gondwana brong at
Tue Sep 25 00:41:57 EDT 2007

On Mon, 24 Sep 2007 23:39:52 -0400, "Ken Murchison" <murch at> said:
> Yes, my for() loop test was incorrect, and SHOULD BE:
> (index_list->count < max_count) &&
> 		 (msgno <= mailbox->exists)
> So, for mailbox->exists=1000, and max_count=1000, when we exit the for() 
> loop for case b), index_list->count=1000 and
> msgno=1001.  Since msgno > mailbox->exists, we set index_list->last_uid 
> to 3005, which should result in:
> UPLOAD 3005 <date> [1000 messages]\r\n

I'm afraid I still don't see how your code addresses the case where there
turn out to be no more messages with higher UIDs which need uploading even
though we've hit exactly max_count messages.  It doesn't pre-scan to the
end and check if there's going to be another one so it can predict if it
needs to set last_uid to the mailbox value.

Can you please email the sync_client.c with the patch applied so I can see
the function in its final form and run some thought experiments against it.
At the moment I feel I might be attacking a strawman, but given how bad the
performance hit of un-necessary cache rewrites on big folders was, I want
to make sure we get this logic right!


  Bron Gondwana
  brong at

More information about the Cyrus-devel mailing list