From: Daniel Salzman Date: Fri, 11 Jan 2019 21:53:28 +0000 (+0100) Subject: zone-update: don't create journal upon full commit if journal disabled or not present X-Git-Tag: v2.8.0~115^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2192fc5ff4111e2da8683a2ba6e1c97a6aa4b41f;p=thirdparty%2Fknot-dns.git zone-update: don't create journal upon full commit if journal disabled or not present fixes #635 --- diff --git a/src/knot/updates/zone-update.c b/src/knot/updates/zone-update.c index 2007404a0f..4ebd4b55d0 100644 --- a/src/knot/updates/zone-update.c +++ b/src/knot/updates/zone-update.c @@ -650,9 +650,10 @@ static int commit_full(conf_t *conf, zone_update_t *update) /* Store new zone contents in journal. */ conf_val_t val = conf_zone_get(conf, C_JOURNAL_CONTENT, update->zone->name); - if (conf_opt(&val) == JOURNAL_CONTENT_ALL) { + unsigned content = conf_opt(&val); + if (content == JOURNAL_CONTENT_ALL) { ret = zone_in_journal_store(conf, update->zone, update->new_cont); - } else { // zone_in_journal_store does this automatically + } else if (content != JOURNAL_CONTENT_NONE) { // zone_in_journal_store does this automatically ret = zone_changes_clear(conf, update->zone); } diff --git a/src/knot/zone/zone.c b/src/knot/zone/zone.c index 0ca3c38279..940af6423f 100644 --- a/src/knot/zone/zone.c +++ b/src/knot/zone/zone.c @@ -303,9 +303,13 @@ int zone_changes_clear(conf_t *conf, zone_t *zone) JOURNAL_LOCK_RW - int ret = open_journal(zone); - if (ret == KNOT_EOK) { - ret = journal_drop_changesets(zone->journal); + int ret = KNOT_EOK; + + if (journal_exists(zone->journal_db, zone->name)) { + ret = open_journal(zone); + if (ret == KNOT_EOK) { + ret = journal_drop_changesets(zone->journal); + } } JOURNAL_UNLOCK_RW