Commit ffa7e3ab authored by Evan Hunt's avatar Evan Hunt
Browse files

journal fixes

- silence out of range errors from dns_journal_compact() when serial == 0;
  just start from the beginning of the journal.
- add the starting and ending serial number from the journal header to
  the output of dns_journal_print().
- use a value less than 2^32 for DNS_ZONEFLG_FIXJOURNAL; a larger value
  could cause problems in some build environments.
parent d6f33fcd
Pipeline #65821 canceled with stages
in 11 seconds
...@@ -909,7 +909,7 @@ journal_next(dns_journal_t *j, journal_pos_t *pos, bool retry) { ...@@ -909,7 +909,7 @@ journal_next(dns_journal_t *j, journal_pos_t *pos, bool retry) {
/* XHDR_VERSION1 -> XHDR_VERSION2 */ /* XHDR_VERSION1 -> XHDR_VERSION2 */
isc_log_write( isc_log_write(
JOURNAL_COMMON_LOGARGS, ISC_LOG_DEBUG(3), JOURNAL_COMMON_LOGARGS, ISC_LOG_DEBUG(3),
"%s: XHDR_VERSION1 -> XHDR_VERSION2 at %u\n", "%s: XHDR_VERSION1 -> XHDR_VERSION2 at %u",
j->filename, pos->serial); j->filename, pos->serial);
j->xhdr_version = XHDR_VERSION2; j->xhdr_version = XHDR_VERSION2;
result = journal_next(j, pos, true); result = journal_next(j, pos, true);
...@@ -923,7 +923,7 @@ journal_next(dns_journal_t *j, journal_pos_t *pos, bool retry) { ...@@ -923,7 +923,7 @@ journal_next(dns_journal_t *j, journal_pos_t *pos, bool retry) {
/* XHDR_VERSION2 -> XHDR_VERSION1 */ /* XHDR_VERSION2 -> XHDR_VERSION1 */
isc_log_write( isc_log_write(
JOURNAL_COMMON_LOGARGS, ISC_LOG_DEBUG(3), JOURNAL_COMMON_LOGARGS, ISC_LOG_DEBUG(3),
"%s: XHDR_VERSION2 -> XHDR_VERSION1 at %u\n", "%s: XHDR_VERSION2 -> XHDR_VERSION1 at %u",
j->filename, pos->serial); j->filename, pos->serial);
j->xhdr_version = XHDR_VERSION1; j->xhdr_version = XHDR_VERSION1;
result = journal_next(j, pos, true); result = journal_next(j, pos, true);
...@@ -1638,6 +1638,8 @@ dns_journal_print(isc_mem_t *mctx, uint32_t flags, const char *filename, ...@@ -1638,6 +1638,8 @@ dns_journal_print(isc_mem_t *mctx, uint32_t flags, const char *filename,
if (printxhdr) { if (printxhdr) {
fprintf(file, "Journal format = %sHeader version = %d\n", fprintf(file, "Journal format = %sHeader version = %d\n",
j->header.format + 1, j->header_ver1 ? 1 : 2); j->header.format + 1, j->header_ver1 ? 1 : 2);
fprintf(file, "Start serial = %u\n", j->header.begin.serial);
fprintf(file, "End serial = %u\n", j->header.end.serial);
fprintf(file, "Index (size = %u):\n", j->header.index_size); fprintf(file, "Index (size = %u):\n", j->header.index_size);
for (uint32_t i = 0; i < j->header.index_size; i++) { for (uint32_t i = 0; i < j->header.index_size; i++) {
if (j->index[i].offset == 0) { if (j->index[i].offset == 0) {
......
...@@ -474,17 +474,18 @@ typedef enum { ...@@ -474,17 +474,18 @@ typedef enum {
* up-to-date */ * up-to-date */
DNS_ZONEFLG_NEEDNOTIFY = 0x00000400U, /*%< need to send out notify DNS_ZONEFLG_NEEDNOTIFY = 0x00000400U, /*%< need to send out notify
* messages */ * messages */
DNS_ZONEFLG_DIFFONRELOAD = 0x00000800U, /*%< generate a journal diff on DNS_ZONEFLG_FIXJOURNAL = 0x00000800U, /*%< journal file had
* reload */ * recoverable error,
DNS_ZONEFLG_NOMASTERS = 0x00001000U, /*%< an attempt to refresh a * needs rewriting */
* zone with no primaries DNS_ZONEFLG_NOMASTERS = 0x00001000U, /*%< an attempt to refresh a
* occurred */ * zone with no primaries
DNS_ZONEFLG_LOADING = 0x00002000U, /*%< load from disk in progress*/ * occurred */
DNS_ZONEFLG_HAVETIMERS = 0x00004000U, /*%< timer values have been set DNS_ZONEFLG_LOADING = 0x00002000U, /*%< load from disk in progress*/
* from SOA (if not set, we DNS_ZONEFLG_HAVETIMERS = 0x00004000U, /*%< timer values have been set
* are still using * from SOA (if not set, we
* default timer values) */ * are still using
DNS_ZONEFLG_FORCEXFER = 0x00008000U, /*%< Force a zone xfer */ * default timer values) */
DNS_ZONEFLG_FORCEXFER = 0x00008000U, /*%< Force a zone xfer */
DNS_ZONEFLG_NOREFRESH = 0x00010000U, DNS_ZONEFLG_NOREFRESH = 0x00010000U,
DNS_ZONEFLG_DIALNOTIFY = 0x00020000U, DNS_ZONEFLG_DIALNOTIFY = 0x00020000U,
DNS_ZONEFLG_DIALREFRESH = 0x00040000U, DNS_ZONEFLG_DIALREFRESH = 0x00040000U,
...@@ -504,9 +505,6 @@ typedef enum { ...@@ -504,9 +505,6 @@ typedef enum {
* notify due to the zone * notify due to the zone
* just being loaded for * just being loaded for
* the first time. */ * the first time. */
DNS_ZONEFLG_FIXJOURNAL = 0x100000000U, /*%< journal file had
* recoverable error,
* needs rewriting */
DNS_ZONEFLG___MAX = UINT64_MAX, /* trick to make the ENUM 64-bit wide */ DNS_ZONEFLG___MAX = UINT64_MAX, /* trick to make the ENUM 64-bit wide */
} dns_zoneflg_t; } dns_zoneflg_t;
   
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment