summaryrefslogtreecommitdiff
path: root/src/journal/sd-journal.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2012-07-16 22:24:02 +0200
committerLennart Poettering <lennart@poettering.net>2012-07-17 00:59:03 +0200
commitdca6219e04505e9fa10b32e71059ce2abfae1dad (patch)
tree29b7c20c60afa197e471d2ed8a44cca92cc68249 /src/journal/sd-journal.c
parent7653b3c29adbad9d299fe9ff09ed30fbcc606acc (diff)
journal: automatically rotate journal files if the data hash table is full > 75%
Previously, when the main data hash table grows too full the performance simply started to decrease drastically. Instead, now simply rotate to a new journal file as the hash table gets to full, so that we can start with a new fresh empty hash table.
Diffstat (limited to 'src/journal/sd-journal.c')
-rw-r--r--src/journal/sd-journal.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/journal/sd-journal.c b/src/journal/sd-journal.c
index 6befd8b3ce..77469e9ebd 100644
--- a/src/journal/sd-journal.c
+++ b/src/journal/sd-journal.c
@@ -2009,6 +2009,22 @@ _public_ int sd_journal_get_cutoff_monotonic_usec(sd_journal *j, sd_id128_t boot
return first ? 0 : 1;
}
+void journal_print_header(sd_journal *j) {
+ Iterator i;
+ JournalFile *f;
+ bool newline = false;
+
+ assert(j);
+
+ HASHMAP_FOREACH(f, j->files, i) {
+ if (newline)
+ putchar('\n');
+ else
+ newline = true;
+
+ journal_file_print_header(f);
+ }
+}
/* _public_ int sd_journal_query_unique(sd_journal *j, const char *field) { */
/* if (!j) */