]> git.ipfire.org Git - thirdparty/knot-dns.git/commitdiff
zone-update: don't create journal upon full commit if journal disabled or not present
authorDaniel Salzman <daniel.salzman@nic.cz>
Fri, 11 Jan 2019 21:53:28 +0000 (22:53 +0100)
committerDaniel Salzman <daniel.salzman@nic.cz>
Fri, 11 Jan 2019 21:53:55 +0000 (22:53 +0100)
fixes #635

src/knot/updates/zone-update.c
src/knot/zone/zone.c

index 2007404a0f59e22b5b841f554023469afb843337..4ebd4b55d03a1e00e4d0a151cd5bdb6aec60c08f 100644 (file)
@@ -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);
        }
 
index 0ca3c382790e325b3023ae3e232b78139e5f8957..940af6423f3978185db05d54dd349d28b1efb5b6 100644 (file)
@@ -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