Commit 5f0b9863 authored by Dominik Taborsky's avatar Dominik Taborsky

zone_update: apply changes right away

parent 3945b506
......@@ -145,7 +145,7 @@ static int connect_nsec_nodes(zone_node_t *a, zone_node_t *b,
}
// Add new NSEC to the changeset (no matter if old was removed)
ret = changeset_add_rrset(data->changeset, &new_nsec, 0);
ret = changeset_add_addition(data->changeset, &new_nsec, 0);
knot_rdataset_clear(&new_nsec.rrs, NULL);
return ret;
}
......@@ -223,7 +223,7 @@ int knot_nsec_changeset_remove(const zone_node_t *n,
}
if (!knot_rrset_empty(&nsec)) {
// update changeset
result = changeset_rem_rrset(changeset, &nsec, 0);
result = changeset_add_removal(changeset, &nsec, 0);
if (result != KNOT_EOK) {
return result;
}
......@@ -251,7 +251,7 @@ int knot_nsec_changeset_remove(const zone_node_t *n,
}
// store RRSIG
result = changeset_rem_rrset(changeset, &synth_rrsigs, 0);
result = changeset_add_removal(changeset, &synth_rrsigs, 0);
knot_rdataset_clear(&synth_rrsigs.rrs, NULL);
}
......
......@@ -239,7 +239,7 @@ static int remove_nsec3param(const zone_contents_t *zone, changeset_t *changeset
assert(changeset);
knot_rrset_t rrset = node_rrset(zone->apex, KNOT_RRTYPE_NSEC3PARAM);
int ret = changeset_rem_rrset(changeset, &rrset, 0);
int ret = changeset_add_removal(changeset, &rrset, 0);
if (ret != KNOT_EOK) {
return ret;
}
......@@ -253,7 +253,7 @@ static int remove_nsec3param(const zone_contents_t *zone, changeset_t *changeset
return ret;
}
ret = changeset_rem_rrset(changeset, &rrsig, 0);
ret = changeset_add_removal(changeset, &rrsig, 0);
knot_rdataset_clear(&rrsig.rrs, NULL);
if (ret != KNOT_EOK) {
return ret;
......@@ -307,7 +307,7 @@ static int add_nsec3param(const zone_contents_t *zone, changeset_t *changeset,
return r;
}
r = changeset_add_rrset(changeset, rrset, 0);
r = changeset_add_addition(changeset, rrset, 0);
knot_rrset_free(&rrset, NULL);
return r;
}
......
......@@ -286,7 +286,7 @@ static int remove_expired_rrsigs(const knot_rrset_t *covered,
}
if (!knot_rrset_empty(&to_remove) && result == KNOT_EOK) {
result = changeset_rem_rrset(changeset, &to_remove, 0);
result = changeset_add_removal(changeset, &to_remove, 0);
}
knot_rdataset_clear(&synth_rrsig.rrs, NULL);
......@@ -341,7 +341,7 @@ static int add_missing_rrsigs(const knot_rrset_t *covered,
}
if (!knot_rrset_empty(&to_add) && result == KNOT_EOK) {
result = changeset_add_rrset(changeset, &to_add, 0);
result = changeset_add_addition(changeset, &to_add, 0);
}
knot_rdataset_clear(&to_add.rrs, NULL);
......@@ -374,7 +374,7 @@ static int remove_rrset_rrsigs(const knot_dname_t *owner, uint16_t type,
return KNOT_EOK;
}
ret = changeset_rem_rrset(changeset, &synth_rrsig, 0);
ret = changeset_add_removal(changeset, &synth_rrsig, 0);
knot_rdataset_clear(&synth_rrsig.rrs, NULL);
return ret;
......@@ -460,7 +460,7 @@ static int remove_standalone_rrsigs(const zone_node_t *node,
if (ret != KNOT_EOK) {
return ret;
}
ret = changeset_rem_rrset(changeset, &to_remove, 0);
ret = changeset_add_removal(changeset, &to_remove, 0);
knot_rdataset_clear(&to_remove.rrs, NULL);
if (ret != KNOT_EOK) {
return ret;
......@@ -742,7 +742,7 @@ static int remove_invalid_dnskeys(const knot_rrset_t *soa,
}
if (!knot_rrset_empty(&to_remove) && result == KNOT_EOK) {
result = changeset_rem_rrset(changeset, &to_remove, 0);
result = changeset_add_removal(changeset, &to_remove, 0);
}
knot_rdataset_clear(&to_remove.rrs, NULL);
......@@ -798,7 +798,7 @@ static int add_missing_dnskeys(const knot_rrset_t *soa,
}
if (!knot_rrset_empty(&to_add) && result == KNOT_EOK) {
result = changeset_add_rrset(changeset, &to_add, 0);
result = changeset_add_addition(changeset, &to_add, 0);
}
knot_rdataset_clear(&to_add.rrs, NULL);
......
......@@ -495,13 +495,13 @@ static int solve_soa_add(const knot_rrset_t *rr, changeset_t *change, knot_mm_t
/*! \brief Adds single RR into remove section of changeset. */
static int solve_del(const knot_rrset_t *rr, changeset_t *change, knot_mm_t *mm)
{
return changeset_rem_rrset(change, rr, 0);
return changeset_add_removal(change, rr, 0);
}
/*! \brief Adds single RR into add section of changeset. */
static int solve_add(const knot_rrset_t *rr, changeset_t *change, knot_mm_t *mm)
{
return changeset_add_rrset(change, rr, 0);
return changeset_add_addition(change, rr, 0);
}
/*! \brief Decides what the next IXFR-in state should be. */
......
......@@ -742,10 +742,10 @@ static int changesets_unpack(changeset_t *chs)
} else {
/* Remove RRSets. */
if (in_remove_section) {
ret = changeset_rem_rrset(chs, &rrset, 0);
ret = changeset_add_removal(chs, &rrset, 0);
} else {
/* Add RRSets. */
ret = changeset_add_rrset(chs, &rrset, 0);
ret = changeset_add_addition(chs, &rrset, 0);
}
}
knot_rrset_clear(&rrset, NULL);
......
......@@ -146,9 +146,23 @@ static bool can_remove(const zone_node_t *node, const knot_rrset_t *rr)
}
/*! \brief Removes single RR from zone contents. */
static int remove_rr(apply_ctx_t *ctx, zone_tree_t *tree, zone_node_t *node,
const knot_rrset_t *rr, changeset_t *chset)
int apply_remove_rr(apply_ctx_t *ctx, zone_contents_t *contents,
const knot_rrset_t *rr)
{
// Find node for this owner
zone_node_t *node = zone_contents_find_node_for_rr(contents, rr);
if (!can_remove(node, rr)) {
// Cannot be removed, either no node or nonexistent RR
if (ctx->flags & APPLY_STRICT) {
// Don't ignore missing RR if strict. Required for IXFR.
return KNOT_ENORECORD;
}
return KNOT_EOK;
}
zone_tree_t *tree = knot_rrset_is_nsec3rel(rr) ?
contents->nsec3_nodes : contents->nodes;
knot_rrset_t removed_rrset = node_rrset(node, rr->type);
knot_rdata_t *old_data = removed_rrset.rrs.data;
int ret = replace_rdataset_with_copy(node, rr->type);
......@@ -198,23 +212,7 @@ static int apply_remove(apply_ctx_t *ctx, zone_contents_t *contents, changeset_t
knot_rrset_t rr = changeset_iter_next(&itt);
while (!knot_rrset_empty(&rr)) {
// Find node for this owner
zone_node_t *node = zone_contents_find_node_for_rr(contents, &rr);
if (!can_remove(node, &rr)) {
// Cannot be removed, either no node or nonexistent RR
if (ctx->flags & APPLY_STRICT) {
// Don't ignore missing RR if strict. Required for IXFR.
changeset_iter_clear(&itt);
return KNOT_ENORECORD;
}
rr = changeset_iter_next(&itt);
continue;
}
zone_tree_t *tree = knot_rrset_is_nsec3rel(&rr) ?
contents->nsec3_nodes : contents->nodes;
int ret = remove_rr(ctx, tree, node, &rr, chset);
int ret = apply_remove_rr(ctx, contents, &rr);
if (ret != KNOT_EOK) {
changeset_iter_clear(&itt);
return ret;
......@@ -228,9 +226,15 @@ static int apply_remove(apply_ctx_t *ctx, zone_contents_t *contents, changeset_t
}
/*! \brief Adds a single RR into zone contents. */
static int add_rr(apply_ctx_t *ctx, const zone_contents_t *zone, zone_node_t *node,
const knot_rrset_t *rr, changeset_t *chset)
int apply_add_rr(apply_ctx_t *ctx, zone_contents_t *zone,
const knot_rrset_t *rr)
{
// Get or create node with this owner
zone_node_t *node = zone_contents_get_node_for_rr(zone, rr);
if (node == NULL) {
return KNOT_ENOMEM;
}
knot_rrset_t changed_rrset = node_rrset(node, rr->type);
if (!knot_rrset_empty(&changed_rrset)) {
// Modifying existing RRSet.
......@@ -278,14 +282,7 @@ static int apply_add(apply_ctx_t *ctx, zone_contents_t *contents, changeset_t *c
knot_rrset_t rr = changeset_iter_next(&itt);
while(!knot_rrset_empty(&rr)) {
// Get or create node with this owner
zone_node_t *node = zone_contents_get_node_for_rr(contents, &rr);
if (node == NULL) {
changeset_iter_clear(&itt);
return KNOT_ENOMEM;
}
int ret = add_rr(ctx, contents, node, &rr, chset);
int ret = apply_add_rr(ctx, contents, &rr);
if (ret != KNOT_EOK) {
changeset_iter_clear(&itt);
return ret;
......@@ -298,10 +295,10 @@ static int apply_add(apply_ctx_t *ctx, zone_contents_t *contents, changeset_t *c
}
/*! \brief Replace old SOA with a new one. */
static int apply_replace_soa(apply_ctx_t *ctx, zone_contents_t *contents, changeset_t *chset)
int apply_replace_soa(apply_ctx_t *ctx, zone_contents_t *contents, changeset_t *chset)
{
assert(chset->soa_from && chset->soa_to);
int ret = remove_rr(ctx, contents->nodes, contents->apex, chset->soa_from, chset);
int ret = apply_remove_rr(ctx, contents, chset->soa_from);
if (ret != KNOT_EOK) {
return ret;
}
......@@ -311,7 +308,7 @@ static int apply_replace_soa(apply_ctx_t *ctx, zone_contents_t *contents, change
return KNOT_EINVAL;
}
return add_rr(ctx, contents, contents->apex, chset->soa_to, chset);
return apply_add_rr(ctx, contents, chset->soa_to);
}
/*! \brief Apply single change to zone contents structure. */
......@@ -347,7 +344,7 @@ static int apply_single(apply_ctx_t *ctx, zone_contents_t *contents, changeset_t
/* --------------------- Zone copy and finalization ------------------------- */
/*! \brief Creates a shallow zone contents copy. */
static int prepare_zone_copy(zone_contents_t *old_contents,
int apply_prepare_zone_copy(zone_contents_t *old_contents,
zone_contents_t **new_contents)
{
if (old_contents == NULL || new_contents == NULL) {
......@@ -397,7 +394,7 @@ int apply_changesets(apply_ctx_t *ctx, zone_t *zone, list_t *chsets, zone_conten
}
zone_contents_t *contents_copy = NULL;
int ret = prepare_zone_copy(old_contents, &contents_copy);
int ret = apply_prepare_zone_copy(old_contents, &contents_copy);
if (ret != KNOT_EOK) {
return ret;
}
......@@ -441,7 +438,7 @@ int apply_changeset(apply_ctx_t *ctx, zone_t *zone, changeset_t *change, zone_co
}
zone_contents_t *contents_copy = NULL;
int ret = prepare_zone_copy(old_contents, &contents_copy);
int ret = apply_prepare_zone_copy(old_contents, &contents_copy);
if (ret != KNOT_EOK) {
return ret;
}
......@@ -535,12 +532,14 @@ void update_rollback(apply_ctx_t *ctx)
void update_free_zone(zone_contents_t **contents)
{
zone_tree_apply((*contents)->nodes, free_additional, NULL);
zone_tree_deep_free(&(*contents)->nodes);
zone_tree_deep_free(&(*contents)->nsec3_nodes);
if (contents && *contents) {
zone_tree_apply((*contents)->nodes, free_additional, NULL);
zone_tree_deep_free(&(*contents)->nodes);
zone_tree_deep_free(&(*contents)->nsec3_nodes);
dnssec_nsec3_params_free(&(*contents)->nsec3_params);
dnssec_nsec3_params_free(&(*contents)->nsec3_params);
free(*contents);
*contents = NULL;
free(*contents);
*contents = NULL;
}
}
......@@ -48,6 +48,20 @@ typedef struct apply_ctx apply_ctx_t;
*/
void apply_init_ctx(apply_ctx_t *ctx, uint32_t flags);
/*! \brief Removes single RR from zone contents. */
int apply_remove_rr(apply_ctx_t *ctx, zone_contents_t *contents,
const knot_rrset_t *rr);
/*! \brief Adds a single RR into zone contents. */
int apply_add_rr(apply_ctx_t *ctx, zone_contents_t *contents,
const knot_rrset_t *rr);
int apply_replace_soa(apply_ctx_t *ctx, zone_contents_t *contents, changeset_t *chset);
/*! \brief Creates a shallow zone contents copy. */
int apply_prepare_zone_copy(zone_contents_t *old_contents,
zone_contents_t **new_contents);
/*!
* \brief Applies changesets *with* zone shallow copy.
*
......
......@@ -256,7 +256,7 @@ size_t changeset_size(const changeset_t *ch)
return size;
}
int changeset_add_rrset(changeset_t *ch, const knot_rrset_t *rrset, unsigned flags)
int changeset_add_addition(changeset_t *ch, const knot_rrset_t *rrset, unsigned flags)
{
if (!ch || !rrset) {
return KNOT_EINVAL;
......@@ -288,7 +288,7 @@ int changeset_add_rrset(changeset_t *ch, const knot_rrset_t *rrset, unsigned fla
return ret;
}
int changeset_rem_rrset(changeset_t *ch, const knot_rrset_t *rrset, unsigned flags)
int changeset_add_removal(changeset_t *ch, const knot_rrset_t *rrset, unsigned flags)
{
if (!ch || !rrset) {
return KNOT_EINVAL;
......@@ -320,6 +320,36 @@ int changeset_rem_rrset(changeset_t *ch, const knot_rrset_t *rrset, unsigned fla
return ret;
}
int changeset_remove_addition(changeset_t *ch, const knot_rrset_t *rrset)
{
if (rrset->type == KNOT_RRTYPE_SOA) {
/* Do not add SOAs into actual contents. */
if (ch->soa_to != NULL) {
knot_rrset_free(&ch->soa_to, NULL);
ch->soa_to = NULL;
}
return KNOT_EOK;
}
zone_node_t *n = NULL;
return zone_contents_remove_rr(ch->add, rrset, &n);
}
int changeset_remove_removal(changeset_t *ch, const knot_rrset_t *rrset)
{
if (rrset->type == KNOT_RRTYPE_SOA) {
/* Do not add SOAs into actual contents. */
if (ch->soa_from != NULL) {
knot_rrset_free(&ch->soa_from, NULL);
ch->soa_from = NULL;
}
return KNOT_EOK;
}
zone_node_t *n = NULL;
return zone_contents_remove_rr(ch->remove, rrset, &n);
}
int changeset_merge(changeset_t *ch1, const changeset_t *ch2)
{
changeset_iter_t itt;
......@@ -327,7 +357,7 @@ int changeset_merge(changeset_t *ch1, const changeset_t *ch2)
knot_rrset_t rrset = changeset_iter_next(&itt);
while (!knot_rrset_empty(&rrset)) {
int ret = changeset_add_rrset(ch1, &rrset, CHANGESET_CHECK);
int ret = changeset_add_addition(ch1, &rrset, CHANGESET_CHECK);
if (ret != KNOT_EOK) {
changeset_iter_clear(&itt);
return ret;
......@@ -340,7 +370,7 @@ int changeset_merge(changeset_t *ch1, const changeset_t *ch2)
rrset = changeset_iter_next(&itt);
while (!knot_rrset_empty(&rrset)) {
int ret = changeset_rem_rrset(ch1, &rrset, CHANGESET_CHECK);
int ret = changeset_add_removal(ch1, &rrset, CHANGESET_CHECK);
if (ret != KNOT_EOK) {
changeset_iter_clear(&itt);
return ret;
......
......@@ -99,7 +99,7 @@ size_t changeset_size(const changeset_t *ch);
*
* \return KNOT_E*
*/
int changeset_add_rrset(changeset_t *ch, const knot_rrset_t *rrset, unsigned flags);
int changeset_add_addition(changeset_t *ch, const knot_rrset_t *rrset, unsigned flags);
/*!
* \brief Add RRSet to 'remove' part of changeset.
......@@ -110,7 +110,28 @@ int changeset_add_rrset(changeset_t *ch, const knot_rrset_t *rrset, unsigned fla
*
* \return KNOT_E*
*/
int changeset_rem_rrset(changeset_t *ch, const knot_rrset_t *rrset, unsigned flags);
int changeset_add_removal(changeset_t *ch, const knot_rrset_t *rrset, unsigned flags);
/*!
* \brief Remove an RRSet from the 'add' part of changeset.
*
* \param ch Changeset to add RRSet into.
* \param rrset RRSet to be added.
*
* \return KNOT_E*
*/
int changeset_remove_addition(changeset_t *ch, const knot_rrset_t *rrset);
/*!
* \brief Remove an RRSet from the 'remove' part of changeset.
*
* \param ch Changeset to add RRSet into.
* \param rrset RRSet to be added.
*
* \return KNOT_E*
*/
int changeset_remove_removal(changeset_t *ch, const knot_rrset_t *rrset);
/*!
* \brief Merges two changesets together. Legacy, to be removed with new zone API.
......
......@@ -538,15 +538,20 @@ static int process_rem_node(const knot_rrset_t *rr,
return KNOT_EOK;
}
zone_node_t *node_copy = node_shallow_copy(node, NULL);
// Remove all RRSets from node
for (int i = 0; i < node->rrset_count; ++i) {
knot_rrset_t rrset = node_rrset_at(node, i);
int ret = process_rem_rrset(&rrset, node, update);
size_t rrset_count = node_copy->rrset_count;
for (int i = 0; i < rrset_count; ++i) {
knot_rrset_t rrset = node_rrset_at(node_copy, rrset_count - i - 1);
int ret = process_rem_rrset(&rrset, node_copy, update);
if (ret != KNOT_EOK) {
return ret;
}
}
node_free(&node_copy, NULL);
return KNOT_EOK;
}
......
This diff is collapsed.
......@@ -43,10 +43,8 @@ typedef struct zone_update {
typedef struct {
zone_update_t *update; /*!< The update we're iterating over. */
hattrie_iter_t *base_it; /*!< Iterator for the original zone in the case of INCREMENTAL update or the new zone in case of FULL update. */
hattrie_iter_t *add_it; /*!< Iterator for the added nodes in the changeset. Available in the INCREMENTAL update only. */
const zone_node_t *base_node; /*!< The original node (INCREMENTAL update) or new node (FULL update). */
const zone_node_t *add_node; /*!< The additions to that node (INCREMENTAL update only). */
hattrie_iter_t *base_it; /*!< Iterator for the new zone. */
const zone_node_t *base_node; /*!< The new node. */
const zone_node_t *next_node; /*!< The smaller of t_node and ch_node (INCREMENTAL update) or next new node (FULL update). */
bool nsec3; /*!< Set when we're using the NSEC3 node tree. */
} zone_update_iter_t;
......
......@@ -80,7 +80,7 @@ static int add_node(const zone_node_t *node, changeset_t *changeset)
/* Add all rrsets from node. */
for (unsigned i = 0; i < node->rrset_count; i++) {
knot_rrset_t rrset = node_rrset_at(node, i);
int ret = changeset_add_rrset(changeset, &rrset, 0);
int ret = changeset_add_addition(changeset, &rrset, 0);
if (ret != KNOT_EOK) {
return ret;
}
......@@ -94,7 +94,7 @@ static int remove_node(const zone_node_t *node, changeset_t *changeset)
/* Remove all the RRSets of the node. */
for (unsigned i = 0; i < node->rrset_count; i++) {
knot_rrset_t rrset = node_rrset_at(node, i);
int ret = changeset_rem_rrset(changeset, &rrset, 0);
int ret = changeset_add_removal(changeset, &rrset, 0);
if (ret != KNOT_EOK) {
return ret;
}
......@@ -175,7 +175,7 @@ static int diff_rrsets(const knot_rrset_t *rrset1, const knot_rrset_t *rrset2,
}
if (!knot_rrset_empty(&to_remove)) {
int ret = changeset_rem_rrset(changeset, &to_remove, 0);
int ret = changeset_add_removal(changeset, &to_remove, 0);
knot_rdataset_clear(&to_remove.rrs, NULL);
if (ret != KNOT_EOK) {
knot_rdataset_clear(&to_add.rrs, NULL);
......@@ -184,7 +184,7 @@ static int diff_rrsets(const knot_rrset_t *rrset1, const knot_rrset_t *rrset2,
}
if (!knot_rrset_empty(&to_add)) {
int ret = changeset_add_rrset(changeset, &to_add, 0);
int ret = changeset_add_addition(changeset, &to_add, 0);
knot_rdataset_clear(&to_add.rrs, NULL);
return ret;
}
......@@ -244,7 +244,7 @@ static int knot_zone_diff_node(zone_node_t **node_ptr, void *data)
node_rrset(node_in_second_tree, rrset.type);
if (knot_rrset_empty(&rrset_from_second_node)) {
/* RRSet has been removed. Make a copy and remove. */
int ret = changeset_rem_rrset(
int ret = changeset_add_removal(
param->changeset, &rrset, 0);
if (ret != KNOT_EOK) {
return ret;
......@@ -271,7 +271,7 @@ static int knot_zone_diff_node(zone_node_t **node_ptr, void *data)
knot_rrset_t rrset_from_first_node = node_rrset(node, rrset.type);
if (knot_rrset_empty(&rrset_from_first_node)) {
/* RRSet has been added. Make a copy and add. */
int ret = changeset_add_rrset(
int ret = changeset_add_addition(
param->changeset, &rrset, 0);
if (ret != KNOT_EOK) {
return ret;
......
......@@ -49,20 +49,20 @@ int main(int argc, char *argv[])
uint8_t data[8] = "\7teststr";
knot_rrset_add_rdata(apex_txt_rr, data, sizeof(data), 3600, NULL);
int ret = changeset_add_rrset(ch, apex_txt_rr, CHANGESET_CHECK);
int ret = changeset_add_addition(ch, apex_txt_rr, CHANGESET_CHECK);
ok(ret == KNOT_EOK, "changeset: add RRSet");
ok(changeset_size(ch) == 1, "changeset: size add");
ret = changeset_rem_rrset(ch, apex_txt_rr, CHANGESET_CHECK);
ret = changeset_add_removal(ch, apex_txt_rr, CHANGESET_CHECK);
ok(ret == KNOT_EOK, "changeset: rem RRSet");
ok(changeset_size(ch) == 1, "changeset: size remove");
ok(!changeset_empty(ch), "changeset: empty");
changeset_add_rrset(ch, apex_txt_rr, CHANGESET_CHECK);
changeset_add_addition(ch, apex_txt_rr, CHANGESET_CHECK);
// Add another RR to node.
knot_rrset_t *apex_spf_rr = knot_rrset_new(d, KNOT_RRTYPE_SPF, KNOT_CLASS_IN, NULL);
assert(apex_spf_rr);
knot_rrset_add_rdata(apex_spf_rr, data, sizeof(data), 3600, NULL);
ret = changeset_add_rrset(ch, apex_spf_rr, CHANGESET_CHECK);
ret = changeset_add_addition(ch, apex_spf_rr, CHANGESET_CHECK);
ok(ret == KNOT_EOK, "changeset: add multiple");
// Add another node.
......@@ -72,7 +72,7 @@ int main(int argc, char *argv[])
knot_rrset_t *other_rr = knot_rrset_new(d, KNOT_RRTYPE_TXT, KNOT_CLASS_IN, NULL);
assert(other_rr);
knot_rrset_add_rdata(other_rr, data, sizeof(data), 3600, NULL);
ret = changeset_add_rrset(ch, other_rr, CHANGESET_CHECK);
ret = changeset_add_addition(ch, other_rr, CHANGESET_CHECK);
ok(ret == KNOT_EOK, "changeset: remove multiple");
// Test add traversal.
......@@ -93,8 +93,8 @@ int main(int argc, char *argv[])
changeset_iter_clear(&it);
ok(knot_rrset_empty(&iter), "changeset: traversal: skip non-terminals");
changeset_rem_rrset(ch, apex_txt_rr, CHANGESET_CHECK);
changeset_rem_rrset(ch, apex_txt_rr, CHANGESET_CHECK);
changeset_add_removal(ch, apex_txt_rr, CHANGESET_CHECK);
changeset_add_removal(ch, apex_txt_rr, CHANGESET_CHECK);
// Test remove traversal.
ret = changeset_iter_rem(&it, ch, false);
......@@ -127,7 +127,7 @@ int main(int argc, char *argv[])
knot_dname_free(&apex_txt_rr->owner, NULL);
apex_txt_rr->owner = knot_dname_from_str_alloc("something.test.");
assert(apex_txt_rr->owner);
ret = changeset_add_rrset(ch2, apex_txt_rr, CHANGESET_CHECK);
ret = changeset_add_addition(ch2, apex_txt_rr, CHANGESET_CHECK);
assert(ret == KNOT_EOK);
// Add something to remove section.
......@@ -135,7 +135,7 @@ int main(int argc, char *argv[])
apex_txt_rr->owner =
knot_dname_from_str_alloc("and.now.for.something.completely.different.test.");
assert(apex_txt_rr->owner);
ret = changeset_rem_rrset(ch2, apex_txt_rr, CHANGESET_CHECK);
ret = changeset_add_removal(ch2, apex_txt_rr, CHANGESET_CHECK);
assert(ret == KNOT_EOK);
// Test merge.
......
......@@ -100,7 +100,7 @@ static void init_random_changeset(changeset_t *ch, const uint32_t from, const ui
for (size_t i = 0; i < size / 2; ++i) {
knot_rrset_t rr;
init_random_rr(&rr, apex);
int ret = changeset_add_rrset(ch, &rr, 0);
int ret = changeset_add_addition(ch, &rr, 0);
(void)ret;
assert(ret == KNOT_EOK);
knot_rrset_clear(&rr, NULL);
......@@ -110,7 +110,7 @@ static void init_random_changeset(changeset_t *ch, const uint32_t from, const ui
for (size_t i = 0; i < size / 2; ++i) {
knot_rrset_t rr;
init_random_rr(&rr, apex);
int ret = changeset_rem_rrset(ch, &rr, 0);
int ret = changeset_add_removal(ch, &rr, 0);
(void)ret;
assert(ret == KNOT_EOK);
knot_rrset_clear(&rr, NULL);
......
......@@ -190,10 +190,6 @@ void test_incremental(zone_t *zone, zs_scanner_t *sc)
ok(update.zone == zone && changeset_empty(&update.change) && update.mm.alloc,
"incremental zone update: init");
ok(zone->contents->apex == zone_update_get_apex(&update) &&
zone_update_no_change(&update),
"incremental zone update: no change");
if (zs_set_input_string(sc, add_str, strlen(add_str)) != 0 ||
zs_parse_all(sc) != 0) {
assert(0);
......@@ -236,7 +232,7 @@ void test_incremental(zone_t *zone, zs_scanner_t *sc)
/* Node Removal */
ret = zone_update_remove_node(&update, rem_node_name);
synth_node = zone_update_get_node(&update, rem_node_name);
ok(ret == KNOT_EOK && synth_node && node_empty(synth_node),
ok(ret == KNOT_EOK && !synth_node,// && node_empty(synth_node),
"incremental zone update: node removal");
knot_dname_free(&rem_node_name, NULL);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment