dig_with_opts -t soa ixfr > dig.out.test$n
grep 'status: NOERROR' dig.out.test$n > /dev/null || ret=1
grep '2012010902' dig.out.test$n > /dev/null || ret=1
-grep 'zone ixfr/IN: journal rollforward completed successfully: recoverable' ns1/named.run > /dev/null || ret=1
+grep 'zone ixfr/IN: journal rollforward completed successfully: up to date' ns1/named.run > /dev/null || ret=1
[ $ret -eq 0 ] || echo_i "failed"
status=`expr $status + $ret`
dig_with_opts -t soa hdr1d1d2d1d2 > dig.out.test$n
grep 'status: NOERROR' dig.out.test$n > /dev/null || ret=1
grep '2012010905' dig.out.test$n > /dev/null || ret=1
-grep 'zone hdr1d1d2d1d2/IN: journal rollforward completed successfully: recoverable' ns1/named.run > /dev/null || ret=1
+grep 'zone hdr1d1d2d1d2/IN: journal rollforward completed successfully: success' ns1/named.run > /dev/null || ret=1
+grep 'zone_journal_compact: zone hdr1d1d2d1d2/IN: repair full journal' ns1/named.run > /dev/null || ret=1
+grep 'hdr1d1d2d1d2/IN: dns_journal_compact: success' ns1/named.run > /dev/null || ret=1
[ $ret -eq 0 ] || echo_i "failed"
status=`expr $status + $ret`
dig_with_opts -t soa hdr1d2d1d2d1 > dig.out.test$n
grep 'status: NOERROR' dig.out.test$n > /dev/null || ret=1
grep '2012010905' dig.out.test$n > /dev/null || ret=1
-grep 'zone hdr1d2d1d2d1/IN: journal rollforward completed successfully: recoverable' ns1/named.run > /dev/null || ret=1
+grep 'zone hdr1d2d1d2d1/IN: journal rollforward completed successfully: success' ns1/named.run > /dev/null || ret=1
+grep 'zone hdr1d2d1d2d1/IN: retried using old journal format' ns1/named.run > /dev/null || ret=1
+grep 'zone_journal_compact: zone hdr1d2d1d2d1/IN: repair full journal' ns1/named.run > /dev/null || ret=1
+grep 'zone hdr1d2d1d2d1/IN: dns_journal_compact: success' ns1/named.run > /dev/null || ret=1
[ $ret -eq 0 ] || echo_i "failed"
status=`expr $status + $ret`
n=`expr $n + 1`
echo_i "check max-journal-size works after journal update ($n)"
ret=0
-# a dump should have been triggered by repairing the journal,
-# which would have resulted in the journal already being
-# compacted.
-[ $(wc -c < ns1/maxjournal.db.jnl) -lt 4000 ] || ret=1
+# journal was repaired, it should still be big
+[ $(wc -c < ns1/maxjournal.db.jnl) -gt 12000 ] || ret=1
+# the zone hasn't been dumped yet, so 'rndc sync' should work without
+# needing a zone update first.
+rndc_with_opts 10.53.0.1 sync maxjournal
+check_size() (
+ [ $(wc -c < ns1/maxjournal.db.jnl) -lt 4000 ]
+)
+retry_quiet 10 check_size || ret=1
[ $ret -eq 0 ] || echo_i "failed"
status=`expr $status + $ret`
isc_result_t
dns_journal_rollforward(isc_mem_t *mctx, dns_db_t *db, unsigned int options,
- const char *filename);
+ const char *filename, bool *recovered);
/*%<
* Roll forward (play back) the journal file "filename" into the
* database "db". This should be called when the server starts
*\li 'db' is a valid database which does not have a version
* open for writing.
*\li 'filename' is the name of the journal file belonging to 'db'.
+ *\li 'recovered' is a optional pointer to a boolean that returns
+ * whether a recoverable error was detected.
*
* Returns:
*\li DNS_R_NOJOURNAL when journal does not exist.
*\li DNS_R_UPTODATE when the database was already up to date.
*\li ISC_R_SUCCESS journal has been applied successfully to the
* database without any issues.
- *\li DNS_R_RECOVERABLE if successful or up to date, but the journal
- * was found to contain at least one outdated transaction header.
*
* others
*/
isc_result_t
dns_journal_rollforward(isc_mem_t *mctx, dns_db_t *db, unsigned int options,
- const char *filename) {
+ const char *filename, bool *recovered) {
dns_journal_t *j = NULL;
isc_result_t result;
}
result = roll_forward(j, db, options);
- if ((result == ISC_R_SUCCESS || result == DNS_R_UPTODATE) &&
- j->recovered) {
- result = DNS_R_RECOVERABLE;
- }
failure:
+ if (recovered != NULL) {
+ *recovered = j->recovered;
+ }
dns_journal_destroy(&j);
return (result);
}
options = 0;
}
result = dns_journal_rollforward(zone->mctx, db, options,
- zone->journal);
- if (result != ISC_R_SUCCESS && result != DNS_R_RECOVERABLE &&
- result != ISC_R_NOTFOUND && result != DNS_R_UPTODATE &&
- result != DNS_R_NOJOURNAL && result != ISC_R_RANGE)
+ zone->journal, &fixjournal);
+ if (result != ISC_R_SUCCESS && result != ISC_R_NOTFOUND &&
+ result != DNS_R_UPTODATE && result != DNS_R_NOJOURNAL &&
+ result != ISC_R_RANGE)
{
dns_zone_logc(zone, DNS_LOGCATEGORY_ZONELOAD,
ISC_LOG_ERROR,
dns_result_totext(result));
if (result == ISC_R_SUCCESS) {
needdump = true;
- } else if (result == DNS_R_RECOVERABLE) {
+ }
+ if (fixjournal) {
dns_zone_logc(zone, DNS_LOGCATEGORY_ZONELOAD,
ISC_LOG_ERROR,
"retried using old journal format");
- needdump = true;
- fixjournal = true;
}
}
result = ISC_R_SUCCESS;
+ if (fixjournal) {
+ DNS_ZONE_SETFLAG(zone, DNS_ZONEFLG_FIXJOURNAL);
+ zone_journal_compact(zone, zone->db, 0);
+ }
if (needdump) {
- if (fixjournal) {
- DNS_ZONE_SETFLAG(zone, DNS_ZONEFLG_FIXJOURNAL);
- zone_journal_compact(zone, zone->db, 0);
- zone_needdump(zone, 0);
- } else if (zone->type == dns_zone_key) {
+ if (zone->type == dns_zone_key) {
zone_needdump(zone, 30);
} else {
zone_needdump(zone, DNS_DUMP_DELAY);