]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Always perform a re-write when processing a version 1 journal
authorMark Andrews <marka@isc.org>
Tue, 4 May 2021 07:22:56 +0000 (17:22 +1000)
committerMark Andrews <marka@isc.org>
Wed, 5 May 2021 13:36:06 +0000 (23:36 +1000)
version 1 journals may have a mix of type 1 and type 2 transaction
headers so always use the recovery code.

(cherry picked from commit 4a8e33b9f01820f576d8000d9e479d70ee693c62)

bin/tools/named-journalprint.rst
doc/man/named-journalprint.8in
lib/dns/journal.c

index 974afe39d9ebbbb00b5edab6560d472a6dcd7569..8bc4a3e13695dfadce77211697d92374571fbf01 100644 (file)
@@ -51,10 +51,11 @@ into a human-readable text format. Each line begins with ``add`` or ``del``,
 to indicate whether the record was added or deleted, and continues with
 the resource record in master-file format.
 
-The ``-c`` option provides a mechanism to compact the journal starting
-with the specified serial. Note this option *must not* be used while
-``named`` is running and can cause data loss if the the zone file does
-not contain the data that is being remove.  Use with extreme caution.
+The ``-c`` (compact) option provides a mechanism to reduce the size of
+a journal by removing (most/all) transactions prior to the specified
+serial number. Note: this option *must not* be used while ``named`` is
+running, and can cause data loss if the zone file has not been updated
+to contain the data being removed from the journal. Use with extreme caution.
 
 The ``-x`` option causes additional data about the journal file to be
 printed at the beginning of the output and before each group of changes.
index 0c75780baf6f97b38155a266087d516860fc1c35..40805113d7c670f37cce5b9218d84525a14b97ab 100644 (file)
@@ -52,10 +52,11 @@ into a human\-readable text format. Each line begins with \fBadd\fP or \fBdel\fP
 to indicate whether the record was added or deleted, and continues with
 the resource record in master\-file format.
 .sp
-The \fB\-c\fP option provides a mechanism to compact the journal starting
-with the specified serial. Note this option \fImust not\fP be used while
-\fBnamed\fP is running and can cause data loss if the the zone file does
-not contain the data that is being remove.  Use with extreme caution.
+The \fB\-c\fP (compact) option provides a mechanism to reduce the size of
+a journal by removing (most/all) transactions prior to the specified
+serial number. Note: this option \fImust not\fP be used while \fBnamed\fP is
+running, and can cause data loss if the zone file has not been updated
+to contain the data being removed from the journal. Use with extreme caution.
 .sp
 The \fB\-x\fP option causes additional data about the journal file to be
 printed at the beginning of the output and before each group of changes.
index c4931ba10146cc1d22de4a8b6b2cda5f5ed9159d..878255e4be35d31df29acbe34b8391450bfac9e0 100644 (file)
@@ -2493,6 +2493,11 @@ dns_journal_compact(isc_mem_t *mctx, char *filename, uint32_t serial,
                return (result);
        }
 
+       /*
+        * Always perform a re-write when processing a version 1 journal.
+        */
+       rewrite = j1->header_ver1;
+
        /*
         * Check whether we need to rewrite the whole journal
         * file (for example, to upversion it).
@@ -2581,6 +2586,7 @@ dns_journal_compact(isc_mem_t *mctx, char *filename, uint32_t serial,
        INSIST(best_guess.serial != j1->header.end.serial);
        if (best_guess.serial != serial) {
                CHECK(journal_next(j1, &best_guess, false));
+               serial = best_guess.serial;
        }
 
        /*