/* 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);
}
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