Mercurial > dovecot > original-hg > dovecot-1.2
diff src/util/logview.c @ 7931:502cfdcc5650 HEAD
Keep modseqs as 1 until the first modseq ext intro record enables them.
Performance should be better again when modseqs are disabled.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Sat, 21 Jun 2008 15:06:46 +0300 |
parents | 02bef9a155d7 |
children | 612eb505775f |
line wrap: on
line diff
--- a/src/util/logview.c Sat Jun 21 14:03:59 2008 +0300 +++ b/src/util/logview.c Sat Jun 21 15:06:46 2008 +0300 @@ -45,7 +45,7 @@ printf("create stamp = %u\n", hdr.create_stamp); printf("initial modseq = %llu\n", (unsigned long long)hdr.initial_modseq); - *modseq_r = I_MAX(hdr.initial_modseq, 1); + *modseq_r = hdr.initial_modseq; } static bool @@ -220,7 +220,7 @@ } static void log_record_print(const struct mail_transaction_header *hdr, - const void *data) + const void *data, uint64_t *modseq) { unsigned int size = hdr->size - sizeof(*hdr); @@ -275,8 +275,12 @@ printf(" - flags = %u\n", intro->flags); printf(" - name_size = %u\n", intro->name_size); if (intro->name_size > 0) { - printf(" - name = '%.*s'\n", - intro->name_size, (const char *)(intro+1)); + const char *name = (const char *)(intro+1); + + printf(" - name = '%.*s'\n", intro->name_size, name); + if (*modseq == 0 && intro->name_size == 6 && + memcmp(name, "modseq", 6) == 0) + *modseq = 1; } break; } @@ -372,7 +376,7 @@ printf("record: offset=%"PRIuUOFF_T", type=%s, size=%u", offset, log_record_type(hdr.type), hdr.size); - if (mail_transaction_header_has_modseq(&hdr)) { + if (*modseq > 0 && mail_transaction_header_has_modseq(&hdr)) { *modseq += 1; printf(", modseq=%llu", (unsigned long long)*modseq); } @@ -386,7 +390,7 @@ i_fatal("rec data read() %"PRIuSIZE_T" != %"PRIuSIZE_T, ret, hdr.size - sizeof(hdr)); } - log_record_print(&hdr, buf); + log_record_print(&hdr, buf, modseq); } else { lseek(fd, hdr.size - sizeof(hdr), SEEK_CUR); }