+Tue Oct 11 00:45:02 EDT 2005 Art Cancro <ajc@uncensored.citadel.org>
+* Replication checks and EUID indexing are now only enabled for rooms whose
+ default view is set to a groupware type of room. This speeds up the saving
+ and moving of messages for message and mail rooms.
+
Mon Oct 10 00:22:49 EDT 2005 Art Cancro <ajc@uncensored.citadel.org>
* IMAP STORE now calls CtdlSetSeen() with an entire list of message numbers.
/*
* Text description of this software
*/
-#define CITADEL "Citadel 6.58"
+#define CITADEL "Citadel 6.59"
/*
* REV_LEVEL is the current version number (multiplied by 100 to avoid having
* usually more strict because you're not really supposed to dump/load and
* upgrade at the same time.
*/
-#define REV_LEVEL 658 /* This version */
+#define REV_LEVEL 659 /* This version */
#define REV_MIN 591 /* Oldest compatible database */
#define EXPORT_REV_MIN 655 /* Oldest compatible export files */
*/
+
+/*
+ * Return nonzero if the supplied room is one which should have
+ * an EUID index.
+ */
+int DoesThisRoomNeedEuidIndexing(struct ctdlroom *qrbuf) {
+
+ switch(qrbuf->QRdefaultview) {
+ case VIEW_BBS: return(0);
+ case VIEW_MAILBOX: return(0);
+ case VIEW_ADDRESSBOOK: return(1);
+ case VIEW_CALENDAR: return(1);
+ case VIEW_TASKS: return(1);
+ case VIEW_NOTES: return(1);
+ }
+
+ return(0);
+}
+
+
+
+
+
+
/*
* Locate a message in a given room with a given euid, and return
* its message number.
while (rplist != NULL) {
if (getroom(&qr, rplist->name) == 0) {
- lprintf(CTDL_DEBUG, "Rebuilding EUID index for <%s>\n", rplist->name);
- usergoto(rplist->name, 0, 0, NULL, NULL);
- CtdlForEachMessage(MSGS_ALL, 0L, NULL, NULL, rebuild_euid_index_for_msg, NULL);
+ if (DoesThisRoomNeedEuidIndexing(&qr)) {
+ lprintf(CTDL_DEBUG,
+ "Rebuilding EUID index for <%s>\n",
+ rplist->name);
+ usergoto(rplist->name, 0, 0, NULL, NULL);
+ CtdlForEachMessage(MSGS_ALL, 0L, NULL, NULL,
+ rebuild_euid_index_for_msg, NULL);
+ }
}
ptr = rplist;
rplist = rplist->next;
* Globally rebuild the EUID indices in every room.
*/
void rebuild_euid_index(void) {
- cdb_trunc(CDB_EUIDINDEX); /* delete the old indices */
- ForEachRoom(rebuild_euid_index_for_room, NULL); /* enumerate the room names */
- rebuild_euid_index_for_room(NULL, NULL); /* now do indexing on them */
+ cdb_trunc(CDB_EUIDINDEX); /* delete the old indices */
+ ForEachRoom(rebuild_euid_index_for_room, NULL); /* enumerate rm names */
+ rebuild_euid_index_for_room(NULL, NULL); /* and index them */
}
*
*/
+int DoesThisRoomNeedEuidIndexing(struct ctdlroom *qrbuf);
long locate_message_by_euid(char *euid, struct ctdlroom *qrbuf);
void index_message_by_euid(char *euid, struct ctdlroom *qrbuf, long msgnum);
void rebuild_euid_index(void);
int i;
char roomname[ROOMNAMELEN];
struct ctdlroom qrbuf;
+ struct timeval tv1, tv2, tv3;
if (IMAP->num_msgs < 1) {
return(0);
* performance drag. Fix that too.
*
*/
+ gettimeofday(&tv1, NULL);
for (i = 0; i < IMAP->num_msgs; ++i) {
if (IMAP->flags[i] & IMAP_SELECTED) {
CtdlCopyMsgToRoom(IMAP->msgids[i], roomname);
}
/* Set the flags... */
+ gettimeofday(&tv2, NULL);
i = getroom(&qrbuf, roomname);
if (i != 0) return(i);
}
}
+ gettimeofday(&tv3, NULL);
+ lprintf(CTDL_DEBUG, "Copying the pointers took %ld microseconds\n",
+ (tv2.tv_usec + (tv2.tv_sec * 1000))
+ - (tv1.tv_usec + (tv1.tv_sec * 1000))
+ );
+ lprintf(CTDL_DEBUG, "Setting the flags took %ld microseconds\n",
+ (tv3.tv_usec + (tv3.tv_sec * 1000))
+ - (tv2.tv_usec + (tv2.tv_sec * 1000))
+ );
return(0);
}
/* Perform replication checks if necessary */
if ( (do_repl_check) && (msg != NULL) ) {
-
if (getroom(&CC->room,
((roomname != NULL) ? roomname : CC->room.QRname) )
!= 0) {
void ReplicationChecks(struct CtdlMessage *msg) {
long old_msgnum = (-1L);
+ if (DoesThisRoomNeedEuidIndexing(&CC->room) == 0) return;
+
+ lprintf(CTDL_DEBUG, "Performing replication checks in <%s>\n",
+ CC->room.QRname);
+
/* No exclusive id? Don't do anything. */
if (msg == NULL) return;
if (msg->cm_fields['E'] == NULL) return;
lprintf(CTDL_DEBUG, "Performing before-save hooks\n");
if (PerformMessageHooks(msg, EVT_BEFORESAVE) > 0) return(-3);
- /* If this message has an Exclusive ID, perform replication checks */
- lprintf(CTDL_DEBUG, "Performing replication checks\n");
- ReplicationChecks(msg);
+ /*
+ * If this message has an Exclusive ID, and the room is replication
+ * checking enabled, then do replication checks.
+ */
+ if (DoesThisRoomNeedEuidIndexing(&CC->room)) {
+ ReplicationChecks(msg);
+ }
/* Save it to disk */
lprintf(CTDL_DEBUG, "Saving to disk\n");
if ((CitControl.version > 000) && (CitControl.version < 608)) {
convert_ctdluid_to_minusone();
}
- if ((CitControl.version > 000) && (CitControl.version < 658)) {
+ if ((CitControl.version > 000) && (CitControl.version < 659)) {
rebuild_euid_index();
}