Re: ipurge evolution

2009-12-29 Thread Cyril Servant
2009/12/24 Bron Gondwana br...@fastmail.fm:
 On Thu, Dec 24, 2009 at 11:49:56AM +0100, Cyril Servant wrote:
 Hi !

 In march, I submitted a patch for ipurge :
 https://bugzilla.andrew.cmu.edu/show_bug.cgi?id=3146
 The patch is still valid in 2.3.16
 Will you commit it ? :)

 Yeah, it looks good.  Note that received is inaccurate though,
 LAST_MODIFIED is actually updated whenever any flags are changed
 on the message.  You might actually be happier with
 OFFSET_INTERNALDATE if that's what you actually mean.

 It could do with some diff lines to man/ipurge.8 as well :)

 Bron.


You are right. I meant modified flags. The -X option already allows
the use of OFFSET_INTERNALDATE. I changed the patch to use the same
method as -X for -u (LAST_MODIFIED). It's now cleaner. I also modified
the man page :)
Here it is :
https://bugzilla.andrew.cmu.edu/show_bug.cgi?id=3146

Thanks,
-- 
Cyril


Re: Cyrus IMAPd 2.3.16 Released

2009-12-29 Thread Cyril Servant
2009/12/21 Ken Murchison mu...@andrew.cmu.edu:
 I am pleased to announce the release of Cyrus IMAPd 2.3.16.  This
 release should be considered production quality.  Major changes in the
 release are the following:

 - Added 'user_deny.db' to be able to selectively deny users access to
  Cyrus services.
 - Added 'popuseimapflags' option which enables setting and
  obeying IMAP flags in the POP server.
 - Added optimized method of handling an empty maildrop in pop3d.
  (based on work of Cyril Servant elfejoy...@gmail.com)
 - Added 'annotation_definitions' option for specifying
  external (third-party) annotations. (courtesy of Thomas
  Viehmann t...@beamnet.de)
 - Added COMPRESSion to replication protocol. (courtesy of Bron Gondwana
  br...@fastmail.fm)

 For full details, please see doc/changes.html and
 doc/install-upgrade.html which are included in the distribution.

 URLs for this release:
 ftp://ftp.andrew.cmu.edu/pub/cyrus/cyrus-imapd-2.3.16.tar.gz
 or
 http://ftp.andrew.cmu.edu/pub/cyrus/cyrus-imapd-2.3.16.tar.gz


 Questions and comments can be directed to
 info-cy...@lists.andrew.cmu.edu (public list), or cyrus-b...@andrew.cmu.edu.

 Happy Holidays!

 --
 Kenneth Murchison
 Systems Programmer
 Project Cyrus Developer/Maintainer
 Carnegie Mellon University


Hi !

Is there a reason to disallow the use of sql back-end for
annotation_db ? Here we use an old home-made mysql back-end for
annotation_db and it works fine.
So I propose this diff in lib/imapoptions :
-{ annotation_db, skiplist, STRINGLIST(berkeley,
berkeley-hash, skiplist)}
+{ annotation_db, skiplist, STRINGLIST(berkeley,
berkeley-hash, skiplist, sql)}

-- 
Cyril


ipurge evolution

2009-12-24 Thread Cyril Servant
Hi !

In march, I submitted a patch for ipurge :
https://bugzilla.andrew.cmu.edu/show_bug.cgi?id=3146
The patch is still valid in 2.3.16
Will you commit it ? :)

Thanks !
-- 
Cyril


Re: Pop optimisation

2009-11-26 Thread Cyril Servant
Bron, Ken, did you have time to take a look at this patch ?

By the way, here is an updated patch.
-- 
Cyril Servant

2009/11/19 Servant Cyril cyril.serv...@atosorigin.com:
 Hello,

 Here is a patch for optimizing pop. Let me explain : Here we have lots 
 (millions) of mailboxes. Many people connect to pop every few minutes, doing 
 LIST, and if there are mails, they do RETR and DELE. Most of time, there is 
 no mail (for 138770 pop connections, there was no mail 92498 times = 66.6%). 
 Without the patch, the seen, index, cache and header files are opened. With 
 this patch, we only read statuscache.db (which is already opened) when there 
 is no mail.

 On the stat image joined, you can see what's happening when we empty 
 statuscache.db (at 10:51) : pop optimization doesn't work the first time a 
 client connects to pop (Lots of reads), and then, as the same clients connect 
 again to pop, reads slowly decrease. Without the patch, reads would stay high.

 --
 Cyril Servant


 Ce message et les pi?ces jointes sont confidentiels et r?serv?s ? l'usage 
 exclusif de ses destinataires. Il peut ?galement ?tre prot?g? par le secret 
 professionnel. Si vous recevez ce message par erreur, merci d'en avertir 
 imm?diatement l'exp?diteur et de le d?truire. L'int?grit? du message ne 
 pouvant ?tre assur?e sur Internet, la responsabilit? du groupe Atos Origin ne 
 pourra ?tre recherch?e quant au contenu de ce message. Bien que les meilleurs 
 efforts soient faits pour maintenir cette transmission exempte de tout virus, 
 l'exp?diteur ne donne aucune garantie ? cet ?gard et sa responsabilit? ne 
 saurait ?tre recherch?e pour tout dommage r?sultant d'un virus transmis.

 This e-mail and the documents attached are confidential and intended solely 
 for the addressee; it may also be privileged. If you receive this e-mail in 
 error, please notify the sender immediately and destroy it. As its integrity 
 cannot be secured on the Internet, the Atos Origin group liability cannot be 
 triggered for the message content. Although the sender endeavours to maintain 
 a computer virus-free network, the sender does not warrant that this 
 transmission is virus-free and will not be liable for any damages resulting 
 from any virus transmitted.




-- 
Cyril
diff -u -r cyrus-imapd-2.3.15.orig/imap/index.c cyrus-imapd-2.3.15/imap/index.c
--- cyrus-imapd-2.3.15.orig/imap/index.c	2009-09-09 03:22:38.0 +0200
+++ cyrus-imapd-2.3.15/imap/index.c	2009-11-19 11:56:57.0 +0100
@@ -5511,3 +5511,116 @@
 	l = n;
 }
 }
+
+int index_statuscache(char *mboxname, char *name, struct auth_state *authstate, unsigned statusitems, struct statuscache_data *scdata)
+{
+int r;
+struct mailbox mailbox;
+int doclose = 0;
+int num_recent = 0;
+int num_unseen = 0;
+int sepchar;
+static struct seq_set seq_set = { NULL, 0, 0, 0 , NULL};
+
+/* Check status cache if possible */
+if (config_getswitch(IMAPOPT_STATUSCACHE)) {
+	/* Do actual lookup of cache item. */
+	r = statuscache_lookup(mboxname, name, statusitems, scdata);
+
+	/* Seen/recent status uses push invalidation events from
+	 * seen_db.c.   This avoids needing to open cyrus.header to get
+	 * the mailbox uniqueid to open the seen db and get the
+	 * unseen_mtime and recentuid. */
+
+	if (!r) {
+	syslog(LOG_DEBUG, statuscache, '%s', '%s', '0x%02x', 'yes',
+		mboxname, name, statusitems);
+	goto statusdone;
+	}
+
+	syslog(LOG_DEBUG, statuscache, '%s', '%s', '0x%02x', 'no',
+		mboxname, name, statusitems);
+}
+
+/* Missing or invalid cache entry */
+r = mailbox_open_header(mboxname, authstate, mailbox);
+
+if (!r) {
+	doclose = 1;
+	r = mailbox_open_index(mailbox);
+}
+
+if (!r  mailbox.exists != 0 
+	(statusitems  (STATUS_RECENT | STATUS_UNSEEN))) {
+	/* Read \Seen state */
+	struct seen *status_seendb;
+	time_t last_read, last_change = 0;
+	unsigned last_uid;
+	char *last_seenuids;
+
+	r = seen_open(mailbox,
+		(mailbox.options  OPT_IMAP_SHAREDSEEN) ? anyone :
+		name,
+		SEEN_CREATE, status_seendb);
+
+	if (!r) {
+	r = seen_lockread(status_seendb, last_read, last_uid,
+		last_change, last_seenuids);
+	seen_close(status_seendb);
+	}
+
+	if (!r) {
+	const char *base;
+	unsigned long len = 0;
+	unsigned msg, uid;
+
+	map_refresh(mailbox.index_fd, 0, base, len,
+		mailbox.start_offset +
+		mailbox.exists * mailbox.record_size,
+		index, mailbox.name);
+
+	seq_set.len = seq_set.mark = 0;
+	index_parse_sequence(last_seenuids, 0, seq_set);
+
+	for (msg = 0; msg  mailbox.exists; msg++) {
+		uid = ntohl(*((bit32 *)(base + mailbox.start_offset +
+msg * mailbox.record_size +
+OFFSET_UID)));
+		/* Always calculate num_recent,
+		 * even if only need num_unseen... for caching below */
+		if (uid  last_uid) num_recent++;
+		if ((statusitems  STATUS_UNSEEN) 
+			!index_insequence(uid, seq_set, 1)) num_unseen++;
+		/* NB: The value of the third argument

statuscache and fatal

2009-11-04 Thread Cyril Servant
Hello,

I wonder why is a fatal function called when the statuscache backend
can't be opened. This makes the process terminate (then fork again,
then terminate, then...). This is not logical, because statuscache
is... a cache ! Cyrus should work fine without (and actually, it does,
with the patch attached).

As we use an sql backend for statuscache, when the sql server is not
available, we prefer that cyrus-imapd works without cache than a total
breakdown.

-- 
Cyril
--- imap/statuscache_db.c	30 Mar 2009 07:52:37 -	1.1.1.2
+++ imap/statuscache_db.c	4 Nov 2009 10:17:11 -
@@ -94,7 +94,7 @@
 if (ret != 0) {
 	syslog(LOG_ERR, DBERROR: opening %s: %s, fname,
 	   cyrusdb_strerror(ret));
+	syslog(LOG_ERR, statuscache in degraded mode);
- 	fatal(can't read statuscache file, EC_TEMPFAIL);
 }
 
 if (tofree) free(tofree);


Warning if a service name contains non alphanumerical character

2009-04-21 Thread Cyril Servant
Hello,

last week, I ran into a configuration issue :
- in cyrus.conf, I configured two imapd services, named 'imap' and
'imap_int' (this was my error).
- cyrus started correctly, but those services hung after the first
successful connection. This is because cyrus ignores '_int', and
therefore believes these two services are named 'imap'... and locks a
single file for both services...

The only thing that annoys me is that no warning appears in the logs,
the processes hang quietly.

So I wrote a patch for this : if a service name contains a
non-alphanumeric AND non-space character, a warning is syslogged when
master reads the configuration.

Here is the bugzilla link :
https://bugzilla.andrew.cmu.edu/show_bug.cgi?id=3152

-- 
Cyril Servant cyril.serv...@atosorigin.com



Re: ipurge evolution

2009-03-27 Thread Cyril Servant
Hello,

Le vendredi 27 mars 2009 à 03:09 +0100, Wesley Craig a écrit :
 Could you enter this in Bugzilla as a feature request, please?  Also,
 a unified diff would be preferable.

Yes, it's done.
 
 :wes
 
 On 26 Mar 2009, at 06:38, Cyril Servant wrote:
  Here is the patch for ipurge.c 2.3.14 :
 
-- 
Cyril Servant cyril.serv...@atosorigin.com