]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
journalctl: don't skip the entries that have the same seqnum
authorshenyangyang4 <shenyangyang4@huawei.com>
Thu, 10 Dec 2020 11:44:31 +0000 (06:44 -0500)
committerLennart Poettering <lennart@poettering.net>
Tue, 15 Dec 2020 17:07:11 +0000 (18:07 +0100)
These two judgement can't judge that two entries are repeating fully.
So i think seqnum is needed to make full judgement.

src/journal/journal-file.c
src/journal/sd-journal.c

index bcd932554d49a8e8d8c9adadbc375241214de5b9..20c4edb6caa635089d53a3537c4e48eb155697b2 100644 (file)
@@ -2741,12 +2741,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)) {
index 946f74d53538648663a35cf1ad18b5d3e951bd90..624fc5fab549627189c7d6791494efb86ed118e2 100644 (file)
@@ -448,6 +448,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;