summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorshenyangyang4 <shenyangyang4@huawei.com>2020-12-10 06:44:31 -0500
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2020-12-16 14:28:38 +0100
commit83c47527396842302154203fbb5ada66747d0175 (patch)
tree29257f4a105ee2a9fa0eccb7e311051e10c3f171
parentbf3de3d18093f5a9d90c8211b362b260b332303c (diff)
downloadsystemd-83c47527396842302154203fbb5ada66747d0175.tar.gz
journalctl: don't skip the entries that have the same seqnum
These two judgement can't judge that two entries are repeating fully. So i think seqnum is needed to make full judgement. (cherry picked from commit b17f651a17cd6ec0ceac7835f2f8607fbd9ddb95) (cherry picked from commit 60fc09f5db900d622aa956fdc98283f149b4a8b2)
-rw-r--r--src/journal/journal-file.c8
-rw-r--r--src/journal/sd-journal.c3
2 files changed, 8 insertions, 3 deletions
diff --git a/src/journal/journal-file.c b/src/journal/journal-file.c
index cdcded2e24..2cb5e5c51d 100644
--- a/src/journal/journal-file.c
+++ b/src/journal/journal-file.c
@@ -2752,12 +2752,14 @@ int journal_file_compare_locations(JournalFile *af, JournalFile *bf) {
assert(af->location_type == LOCATION_SEEK);
assert(bf->location_type == LOCATION_SEEK);
- /* If contents and timestamps match, these entries are
- * identical, even if the seqnum does not match */
+ /* If contents, timestamps and seqnum match, these entries are
+ * identical*/
if (sd_id128_equal(af->current_boot_id, bf->current_boot_id) &&
af->current_monotonic == bf->current_monotonic &&
af->current_realtime == bf->current_realtime &&
- af->current_xor_hash == bf->current_xor_hash)
+ af->current_xor_hash == bf->current_xor_hash &&
+ sd_id128_equal(af->header->seqnum_id, bf->header->seqnum_id) &&
+ af->current_seqnum == bf->current_seqnum)
return 0;
if (sd_id128_equal(af->header->seqnum_id, bf->header->seqnum_id)) {
diff --git a/src/journal/sd-journal.c b/src/journal/sd-journal.c
index f511b6d40d..60acd883f2 100644
--- a/src/journal/sd-journal.c
+++ b/src/journal/sd-journal.c
@@ -449,6 +449,9 @@ _pure_ static int compare_with_location(const JournalFile *f, const Location *l,
f->current_realtime == l->realtime &&
l->xor_hash_set &&
f->current_xor_hash == l->xor_hash &&
+ l->seqnum_set &&
+ sd_id128_equal(f->header->seqnum_id, l->seqnum_id) &&
+ f->current_seqnum == l->seqnum &&
f != current_file)
return 0;