mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-08-31 06:25:31 +00:00
Allow named-journalprint to compact journals at a given serial
This commit is contained in:
@@ -68,12 +68,24 @@ main(int argc, char **argv) {
|
||||
isc_log_t *lctx = NULL;
|
||||
uint32_t flags = 0U;
|
||||
int ch;
|
||||
bool compact = false;
|
||||
bool downgrade = false;
|
||||
bool upgrade = false;
|
||||
unsigned int serial = 0;
|
||||
char *endp = NULL;
|
||||
|
||||
progname = argv[0];
|
||||
while ((ch = isc_commandline_parse(argc, argv, "dux")) != -1) {
|
||||
while ((ch = isc_commandline_parse(argc, argv, "c:dux")) != -1) {
|
||||
switch (ch) {
|
||||
case 'c':
|
||||
compact = true;
|
||||
serial = strtoul(isc_commandline_argument, &endp, 0);
|
||||
if (endp == isc_commandline_argument || *endp != 0) {
|
||||
fprintf(stderr, "invalid serial: %s\n",
|
||||
isc_commandline_argument);
|
||||
exit(1);
|
||||
}
|
||||
break;
|
||||
case 'd':
|
||||
downgrade = true;
|
||||
break;
|
||||
@@ -105,6 +117,9 @@ main(int argc, char **argv) {
|
||||
} else if (downgrade) {
|
||||
flags = DNS_JOURNAL_COMPACTALL | DNS_JOURNAL_VERSION1;
|
||||
result = dns_journal_compact(mctx, file, 0, flags, 0);
|
||||
} else if (compact) {
|
||||
flags = 0;
|
||||
result = dns_journal_compact(mctx, file, serial, flags, 0);
|
||||
} else {
|
||||
result = dns_journal_print(mctx, flags, file, stdout);
|
||||
if (result == DNS_R_NOJOURNAL) {
|
||||
|
@@ -29,7 +29,7 @@ named-journalprint - print zone journal in human-readable form
|
||||
Synopsis
|
||||
~~~~~~~~
|
||||
|
||||
:program:`named-journalprint` [**-dux**] {journal}
|
||||
:program:`named-journalprint` [-c serial] [**-dux**] {journal}
|
||||
|
||||
Description
|
||||
~~~~~~~~~~~
|
||||
@@ -51,6 +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 ``-x`` option causes additional data about the journal file to be
|
||||
printed at the beginning of the output and before each group of changes.
|
||||
|
||||
|
@@ -32,7 +32,7 @@ level margin: \\n[rst2man-indent\\n[rst2man-indent-level]]
|
||||
..
|
||||
.SH SYNOPSIS
|
||||
.sp
|
||||
\fBnamed\-journalprint\fP [\fB\-dux\fP] {journal}
|
||||
\fBnamed\-journalprint\fP [\-c serial] [\fB\-dux\fP] {journal}
|
||||
.SH DESCRIPTION
|
||||
.sp
|
||||
\fBnamed\-journalprint\fP scans the contents of a zone journal file,
|
||||
@@ -52,6 +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.
|
||||
.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.
|
||||
.sp
|
||||
|
Reference in New Issue
Block a user