Commit d6a84505 authored by Jan Kadlec's avatar Jan Kadlec

zone-events: Removed old update relics.

parent ba63bb98
......@@ -297,7 +297,8 @@ static int axfr_answer_finalize(struct answer_data *data)
}
/* Switch contents. */
zone_contents_t *old_contents = update_switch_contents(zone, proc->contents);
zone_contents_t *old_contents = zone_switch_contents(zone, proc->contents);
synchronize_rcu();
AXFRIN_LOG(LOG_INFO, "Serial %u -> %u",
zone_contents_serial(old_contents),
zone_contents_serial(proc->contents));
......
......@@ -167,7 +167,6 @@ static int sign_update(zone_t *zone, const zone_contents_t *old_contents,
}
// Apply DNSSEC changeset
zone_contents_set_gen_old(new_contents);
ret = apply_changesets_directly(new_contents, sec_chs);
if (ret != KNOT_EOK) {
changesets_free(&sec_chs, NULL);
......@@ -255,7 +254,8 @@ static int process_authenticated(uint16_t *rcode, struct query_data *qdata)
}
// Switch zone contents.
zone_contents_t *old_contents = update_switch_contents(zone, new_contents);
zone_contents_t *old_contents = zone_switch_contents(zone, new_contents);
synchronize_rcu();
update_free_old_zone(&old_contents);
update_cleanup(ddns_chs);
......
......@@ -554,13 +554,6 @@ static int prepare_zone_copy(zone_contents_t *old_contents,
return KNOT_EINVAL;
}
// Ensure that the zone generation is set to old.
if (!zone_contents_gen_is_old(old_contents)) {
#warning TODO - does this still make sense?
// This means that the previous update was not completed.
return KNOT_EAGAIN;
}
/*
* Create a shallow copy of the zone, so that the structures may be
* updated.
......@@ -677,24 +670,6 @@ int apply_changesets_directly(zone_contents_t *contents, changesets_t *chsets)
return ret;
}
zone_contents_t *update_switch_contents(zone_t *zone, zone_contents_t *new_contents)
{
if (zone == NULL || new_contents == NULL) {
return NULL;
}
zone_contents_t *old = zone_switch_contents(zone, new_contents);
// set generation to old, so that the flags may be used in next transfer
// and we do not search for new nodes anymore
zone_contents_set_gen_old(new_contents);
// wait for readers to finish
synchronize_rcu();
return old;
}
void update_cleanup(changesets_t *chgs)
{
if (chgs == NULL) {
......
......@@ -73,17 +73,6 @@ int apply_changesets(zone_t *zone, changesets_t *chsets,
int apply_changesets_directly(zone_contents_t *contents,
changesets_t *chsets);
/*!
* \brief Switches zone contents in the zone.
*
* \param zone Zone whose contents we want to switch.
* \param new_contents New zone contents.
*
* \return KNOT_E*
*/
zone_contents_t *update_switch_contents(zone_t *zone,
zone_contents_t *new_contents);
/*!
* \brief Cleanups successful update. (IXFR, DNSSEC, DDNS).
* \param chgs Changesets used to create the update.
......
......@@ -49,13 +49,6 @@ typedef struct {
/*----------------------------------------------------------------------------*/
const uint8_t KNOT_ZONE_FLAGS_GEN_OLD = 0; /* xxxxxx00 */
const uint8_t KNOT_ZONE_FLAGS_GEN_NEW = 1 << 0; /* xxxxxx01 */
const uint8_t KNOT_ZONE_FLAGS_GEN_FIN = 1 << 1; /* xxxxxx10 */
const uint8_t KNOT_ZONE_FLAGS_GEN_MASK = 3; /* 00000011 */
/*----------------------------------------------------------------------------*/
static int tree_apply_cb(zone_node_t **node, void *data)
{
if (node == NULL || data == NULL) {
......@@ -418,7 +411,6 @@ zone_contents_t *zone_contents_new(const knot_dname_t *apex_name)
}
memset(contents, 0, sizeof(zone_contents_t));
contents->node_count = 1;
contents->apex = node_new(apex_name);
if (contents->apex == NULL) {
goto cleanup;
......@@ -445,36 +437,6 @@ cleanup:
/*----------------------------------------------------------------------------*/
int zone_contents_gen_is_old(const zone_contents_t *contents)
{
return ((contents->flags & KNOT_ZONE_FLAGS_GEN_MASK)
== KNOT_ZONE_FLAGS_GEN_OLD);
}
/*----------------------------------------------------------------------------*/
int zone_contents_gen_is_new(const zone_contents_t *contents)
{
return ((contents->flags & KNOT_ZONE_FLAGS_GEN_MASK)
== KNOT_ZONE_FLAGS_GEN_NEW);
}
/*----------------------------------------------------------------------------*/
void zone_contents_set_gen_old(zone_contents_t *contents)
{
contents->flags &= ~KNOT_ZONE_FLAGS_GEN_MASK;
contents->flags |= KNOT_ZONE_FLAGS_GEN_OLD;
}
/*----------------------------------------------------------------------------*/
void zone_contents_set_gen_new(zone_contents_t *contents)
{
contents->flags &= ~KNOT_ZONE_FLAGS_GEN_MASK;
contents->flags |= KNOT_ZONE_FLAGS_GEN_NEW;
}
static zone_node_t *zone_contents_get_node(const zone_contents_t *zone,
const knot_dname_t *name)
{
......@@ -513,8 +475,6 @@ static int zone_contents_add_node(zone_contents_t *zone, zone_node_t *node,
return ret;
}
++zone->node_count;
if (!create_parents) {
return KNOT_EOK;
}
......@@ -561,8 +521,6 @@ static int zone_contents_add_node(zone_contents_t *zone, zone_node_t *node,
next_node->flags |= NODE_FLAGS_WILDCARD_CHILD;
}
++zone->node_count;
dbg_zone_detail("Next parent.\n");
node = next_node;
parent = knot_wire_next_label(parent, NULL);
......@@ -1311,9 +1269,6 @@ int zone_contents_shallow_copy(const zone_contents_t *from, zone_contents_t **to
return KNOT_ENOMEM;
}
contents->flags = from->flags;
zone_contents_set_gen_new(contents);
int ret = recreate_normal_tree(from, contents);
if (ret != KNOT_EOK) {
knot_zone_tree_free(&contents->nodes);
......
......@@ -47,27 +47,6 @@ typedef struct zone_contents_t {
knot_zone_tree_t *nsec3_nodes;
knot_nsec3_params_t nsec3_params;
/*!
* \todo Unify the use of this field - authoritative nodes vs. all.
*/
size_t node_count;
/*! \brief Various flags
*
* Two rightmost bits denote zone contents generation.
*
* Possible values:
* - 00 - Original version of the zone. Old nodes should be used.
* - 01 - New (updated) zone. New nodes should be used.
* - 10 - New (updated) zone, but exactly the stored nodes should be
* used, no matter their generation.
*
* The third bit denotes whether ANY queries are enabled or disabled:
* - 1xx - ANY queries disabled
* - 0xx - ANY queries enabled
*/
uint8_t flags;
} zone_contents_t;
/*!
......@@ -79,12 +58,6 @@ typedef int (*zone_contents_apply_cb_t)(zone_node_t *node, void *data);
zone_contents_t *zone_contents_new(const knot_dname_t *apex_name);
int zone_contents_gen_is_old(const zone_contents_t *contents);
int zone_contents_gen_is_new(const zone_contents_t *contents);
void zone_contents_set_gen_old(zone_contents_t *contents);
void zone_contents_set_gen_new(zone_contents_t *contents);
int zone_contents_add_rr(zone_contents_t *z, const knot_rrset_t *rr, zone_node_t **n);
int zone_contents_remove_node(zone_contents_t *contents, const knot_dname_t *owner);
......
......@@ -215,7 +215,8 @@ int zone_change_apply_and_store(changesets_t **chs,
}
/* Switch zone contents. */
zone_contents_t *old_contents = update_switch_contents(zone, new_contents);
zone_contents_t *old_contents = zone_switch_contents(zone, new_contents);
synchronize_rcu();
update_free_old_zone(&old_contents);
/* Free changesets, but not the data. */
......
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