mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-09-01 15:05:23 +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;
|
isc_log_t *lctx = NULL;
|
||||||
uint32_t flags = 0U;
|
uint32_t flags = 0U;
|
||||||
int ch;
|
int ch;
|
||||||
|
bool compact = false;
|
||||||
bool downgrade = false;
|
bool downgrade = false;
|
||||||
bool upgrade = false;
|
bool upgrade = false;
|
||||||
|
unsigned int serial = 0;
|
||||||
|
char *endp = NULL;
|
||||||
|
|
||||||
progname = argv[0];
|
progname = argv[0];
|
||||||
while ((ch = isc_commandline_parse(argc, argv, "dux")) != -1) {
|
while ((ch = isc_commandline_parse(argc, argv, "c:dux")) != -1) {
|
||||||
switch (ch) {
|
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':
|
case 'd':
|
||||||
downgrade = true;
|
downgrade = true;
|
||||||
break;
|
break;
|
||||||
@@ -105,6 +117,9 @@ main(int argc, char **argv) {
|
|||||||
} else if (downgrade) {
|
} else if (downgrade) {
|
||||||
flags = DNS_JOURNAL_COMPACTALL | DNS_JOURNAL_VERSION1;
|
flags = DNS_JOURNAL_COMPACTALL | DNS_JOURNAL_VERSION1;
|
||||||
result = dns_journal_compact(mctx, file, 0, flags, 0);
|
result = dns_journal_compact(mctx, file, 0, flags, 0);
|
||||||
|
} else if (compact) {
|
||||||
|
flags = 0;
|
||||||
|
result = dns_journal_compact(mctx, file, serial, flags, 0);
|
||||||
} else {
|
} else {
|
||||||
result = dns_journal_print(mctx, flags, file, stdout);
|
result = dns_journal_print(mctx, flags, file, stdout);
|
||||||
if (result == DNS_R_NOJOURNAL) {
|
if (result == DNS_R_NOJOURNAL) {
|
||||||
|
@@ -29,7 +29,7 @@ named-journalprint - print zone journal in human-readable form
|
|||||||
Synopsis
|
Synopsis
|
||||||
~~~~~~~~
|
~~~~~~~~
|
||||||
|
|
||||||
:program:`named-journalprint` [**-dux**] {journal}
|
:program:`named-journalprint` [-c serial] [**-dux**] {journal}
|
||||||
|
|
||||||
Description
|
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
|
to indicate whether the record was added or deleted, and continues with
|
||||||
the resource record in master-file format.
|
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
|
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.
|
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
|
.SH SYNOPSIS
|
||||||
.sp
|
.sp
|
||||||
\fBnamed\-journalprint\fP [\fB\-dux\fP] {journal}
|
\fBnamed\-journalprint\fP [\-c serial] [\fB\-dux\fP] {journal}
|
||||||
.SH DESCRIPTION
|
.SH DESCRIPTION
|
||||||
.sp
|
.sp
|
||||||
\fBnamed\-journalprint\fP scans the contents of a zone journal file,
|
\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
|
to indicate whether the record was added or deleted, and continues with
|
||||||
the resource record in master\-file format.
|
the resource record in master\-file format.
|
||||||
.sp
|
.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
|
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.
|
printed at the beginning of the output and before each group of changes.
|
||||||
.sp
|
.sp
|
||||||
|
Reference in New Issue
Block a user