Fallback to normal procedure if creating of ixfr-from-differences fails

(cherry picked from commit b1254430df)
(cherry picked from commit e92d5421c3)
This commit is contained in:
Witold Kręcicki 2018-06-27 14:10:04 +02:00 committed by Evan Hunt
parent e7506b6a70
commit 200a3fef3c
2 changed files with 16 additions and 11 deletions

View file

@ -1013,7 +1013,7 @@ dns_journal_writediff(dns_journal_t *j, dns_diff_t *diff) {
dns_difftuple_t *t;
isc_buffer_t buffer;
void *mem = NULL;
size_t size;
isc_uint64_t size;
isc_result_t result;
isc_region_t used;
@ -1044,7 +1044,11 @@ dns_journal_writediff(dns_journal_t *j, dns_diff_t *diff) {
}
if (size >= DNS_JOURNAL_SIZE_MAX) {
return (ISC_R_RANGE);
isc_log_write(JOURNAL_COMMON_LOGARGS, ISC_LOG_ERROR,
"dns_journal_writediff: %s: journal entry "
"too big to be stored: %llu bytes", j->filename,
size);
return (ISC_R_NOSPACE);
}
mem = isc_mem_get(j->mctx, size);
@ -1100,6 +1104,7 @@ isc_result_t
dns_journal_commit(dns_journal_t *j) {
isc_result_t result;
journal_rawheader_t rawheader;
isc_uint64_t total;
REQUIRE(DNS_JOURNAL_VALID(j));
REQUIRE(j->state == JOURNAL_STATE_TRANSACTION ||
@ -1152,12 +1157,12 @@ dns_journal_commit(dns_journal_t *j) {
/*
* We currently don't support huge journal entries.
*/
unsigned long long total = j->x.pos[1].offset - j->x.pos[0].offset;
total = j->x.pos[1].offset - j->x.pos[0].offset;
if (total >= DNS_JOURNAL_SIZE_MAX) {
isc_log_write(JOURNAL_COMMON_LOGARGS, ISC_LOG_ERROR,
"transaction too big to be stored in journal :"
"transaction too big to be stored in journal: "
"%llub (max is %llub)", total,
(unsigned long long)DNS_JOURNAL_SIZE_MAX);
(isc_uint64_t)DNS_JOURNAL_SIZE_MAX);
return (ISC_R_UNEXPECTED);
}

View file

@ -14281,15 +14281,14 @@ zone_replacedb(dns_zone_t *zone, dns_db_t *db, isc_boolean_t dump) {
result = dns_db_diff(zone->mctx, db, ver, zone->db, NULL,
zone->journal);
if (result == ISC_R_RANGE) {
if (result != ISC_R_SUCCESS) {
char strbuf[ISC_STRERRORSIZE];
isc__strerror(errno, strbuf, sizeof(strbuf));
dns_zone_log(zone, ISC_LOG_ERROR,
"ixfr-from-differences: failed: "
"difference too big to be stored "
"in journal");
goto fail;
"%s", strbuf);
goto fallback;
}
if (result != ISC_R_SUCCESS)
goto fail;
if (dump)
zone_needdump(zone, DNS_DUMP_DELAY);
else if (zone->journalsize != -1) {
@ -14313,6 +14312,7 @@ zone_replacedb(dns_zone_t *zone, dns_db_t *db, isc_boolean_t dump) {
if (zone->type == dns_zone_master && inline_raw(zone))
zone_send_secureserial(zone, serial);
} else {
fallback:
if (dump && zone->masterfile != NULL) {
/*
* If DNS_ZONEFLG_FORCEXFER was set we don't want