diff --git a/src/knot/updates/apply.c b/src/knot/updates/apply.c index 8a94c14cbe0f0cde224947093186d39aa82ef5d2..310c04e009d83db636ebc5ecabefa075267abc5c 100644 --- a/src/knot/updates/apply.c +++ b/src/knot/updates/apply.c @@ -378,7 +378,7 @@ int apply_replace_soa(apply_ctx_t *ctx, changeset_t *chset) // Check for SOA with proper serial but different rdata. if (node_rrtype_exists(contents->apex, KNOT_RRTYPE_SOA)) { - return KNOT_EINVAL; + return KNOT_EZONEINVAL; } return apply_add_rr(ctx, chset->soa_to); @@ -483,17 +483,11 @@ int apply_changesets_directly(apply_ctx_t *ctx, list_t *chsets) WALK_LIST(set, *chsets) { int ret = apply_single(ctx, set); if (ret != KNOT_EOK) { - update_rollback(ctx); return ret; } } - int ret = zone_contents_adjust_full(ctx->contents); - if (ret != KNOT_EOK) { - update_rollback(ctx); - } - - return ret; + return zone_contents_adjust_full(ctx->contents); } int apply_changeset_directly(apply_ctx_t *ctx, changeset_t *ch) diff --git a/src/knot/updates/apply.h b/src/knot/updates/apply.h index 657056f0219391c228405adfdef68a398bba2230..ed9256455582a15e3f35096fee159b46ad54891d 100644 --- a/src/knot/updates/apply.h +++ b/src/knot/updates/apply.h @@ -129,6 +129,8 @@ int apply_changeset(apply_ctx_t *ctx, zone_t *zone, changeset_t *ch, /*! * \brief Applies changesets directly to the zone, without copying it. * + * \warning Modified zone is in inconsitent state after error and should be freed. + * * \param ctx Apply context. * \param chsets List of changesets to be applied to the zone. * diff --git a/src/knot/zone/zone-load.c b/src/knot/zone/zone-load.c index c683c7f41bc14884f81bca1093dfe5ea3cc2f9cd..29dabd0c3e5415187320f803b5903ae0d074b9ab 100644 --- a/src/knot/zone/zone-load.c +++ b/src/knot/zone/zone-load.c @@ -136,7 +136,7 @@ int zone_load_journal(conf_t *conf, zone_t *zone, zone_contents_t *contents) log_zone_info(zone->name, "changes from journal applied %u -> %u", serial, zone_contents_serial(contents)); } else { - log_zone_error(zone->name, "changes from journal applied %u -> %u (%s)", + log_zone_error(zone->name, "failed to apply journal changes %u -> %u (%s)", serial, zone_contents_serial(contents), knot_strerror(ret)); } diff --git a/src/knot/zone/zone-load.h b/src/knot/zone/zone-load.h index 5ee80dc6509af7dca3523d70570fbcf00ddaae74..ccd81adc1547835f5b28244fd10bfc694c4c4600 100644 --- a/src/knot/zone/zone-load.h +++ b/src/knot/zone/zone-load.h @@ -42,6 +42,8 @@ int zone_load_check(conf_t *conf, zone_contents_t *contents); /*! * \brief Update zone contents from the journal. * + * \warning If error, the zone is in inconsitent state and should be freed. + * * \param conf * \param zone * \param contents