Always perform a re-write when processing a version 1 journal

version 1 journals may have a mix of type 1 and type 2 transaction
headers so always use the recovery code.
This commit is contained in:
Mark Andrews
2021-05-04 17:22:56 +10:00
parent 71df4fb84c
commit 4a8e33b9f0
3 changed files with 16 additions and 8 deletions

View 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.

View 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.

View 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;
}
/*