Commit 0281eedf authored by Lubos Slovak's avatar Lubos Slovak

Some testing changes to IXFR post-processing.

parent 9559db25
......@@ -747,7 +747,17 @@ struct knot_node *knot_dname_get_node(const knot_dname_t *dname)
if (dname == NULL) {
return NULL;
}
return dname->node;
knot_node_t *node = dname->node;
// check if we should return the new or the old node
if (node && knot_node_zone(node)
&& knot_zone_contents_gen_is_new(knot_zone_contents(
knot_node_zone(node)))) {
node = knot_node_get_new_node(node);
}
return node;
}
/*----------------------------------------------------------------------------*/
......
......@@ -2269,8 +2269,9 @@ static void xfrin_switch_node_in_dname_table(knot_dname_t *dname, void *data)
}
assert(knot_node_new_node(knot_dname_node(dname)) != NULL);
knot_dname_set_node(dname, knot_node_get_new_node(
knot_dname_get_node(dname)));
knot_dname_update_node(dname);
// knot_dname_set_node(dname, knot_node_get_new_node(
// knot_dname_get_node(dname)));
}
/*----------------------------------------------------------------------------*/
......@@ -2293,10 +2294,10 @@ static int xfrin_switch_nodes(knot_zone_contents_t *contents_copy)
xfrin_switch_node_in_hash_table, NULL);
assert(ret == 0);
// Traverse also the dname table and change the node pointers in dnames
knot_zone_contents_dname_table_apply(contents_copy,
xfrin_switch_node_in_dname_table,
NULL);
// // Traverse also the dname table and change the node pointers in dnames
// knot_zone_contents_dname_table_apply(contents_copy,
// xfrin_switch_node_in_dname_table,
// NULL);
return KNOT_EOK;
}
......@@ -3171,6 +3172,20 @@ int xfrin_switch_zone(knot_zone_t *zone,
dbg_xfrin_verb("Old contents: %p, apex: %p, new apex: %p\n",
old, (old) ? old->apex : NULL, new_contents->apex);
// switch pointers in domain names, now only the new zone is used
if (transfer_type == XFR_TYPE_IIN) {
// Traverse also the dname table and change the node pointers
// in dnames
int ret = knot_zone_contents_dname_table_apply(
new_contents,
xfrin_switch_node_in_dname_table, NULL);
assert(ret == KNOT_EOK);
}
// set generation to old, so that the flags may be used in next transfer
// and we do not search for new nodes anymore
knot_zone_contents_set_gen_old(new_contents);
// wait for readers to finish
dbg_xfrin_verb("Waiting for readers to finish...\n");
synchronize_rcu();
......
......@@ -869,8 +869,10 @@ void knot_zone_contents_dump(knot_zone_contents_t *zone, char loaded_zone);
#else
#define dbg_rrset(msg...)
#define dbg_rrset_hex(data, len)
#define dbg_rrset_exec(cmds)
#define dbg_rrset_verb(msg...)
#define dbg_rrset_hex_verb(data, len)
#define dbg_rrset_exec_verb(cmds)
#define dbg_rrset_detail(msg...)
#define dbg_rrset_hex_detail(data, len)
#define dbg_rrset_exec_detail(cmds)
......
......@@ -560,7 +560,7 @@ void knot_node_set_new_node(knot_node_t *node,
/*----------------------------------------------------------------------------*/
void knot_node_set_zone(knot_node_t *node, knot_zone_t *zone)
void knot_node_set_zone(knot_node_t *node, const knot_zone_t *zone)
{
if (node == NULL) {
return;
......@@ -571,6 +571,17 @@ void knot_node_set_zone(knot_node_t *node, knot_zone_t *zone)
/*----------------------------------------------------------------------------*/
const knot_zone_t *knot_node_zone(const knot_node_t *node)
{
if (node == NULL) {
return NULL;
}
return node->zone;
}
/*----------------------------------------------------------------------------*/
void knot_node_update_ref(knot_node_t **ref)
{
if (*ref != NULL && (*ref)->new_node != NULL) {
......
......@@ -74,7 +74,7 @@ struct knot_node {
struct knot_node *nsec3_referer;
struct knot_zone *zone;
const struct knot_zone_contents *zone;
struct knot_node *new_node;
......@@ -342,7 +342,9 @@ knot_node_t *knot_node_get_new_node(const knot_node_t *node);
void knot_node_set_new_node(knot_node_t *node, knot_node_t *new_node);
void knot_node_set_zone(knot_node_t *node, struct knot_zone *zone);
void knot_node_set_zone(knot_node_t *node, const struct knot_zone *zone);
const struct knot_zone *knot_node_zone(const knot_node_t *node);
void knot_node_update_ref(knot_node_t **ref);
......
......@@ -1061,7 +1061,7 @@ knot_zone_contents_t *knot_zone_contents_new(knot_node_t *apex,
contents->apex = apex;
contents->zone = zone;
knot_node_set_zone(apex, zone);
knot_node_set_zone(apex, contents->zone);
contents->node_count = 1;
dbg_zone_verb("Creating tree for normal nodes.\n");
......@@ -2759,6 +2759,8 @@ int knot_zone_contents_shallow_copy2(const knot_zone_contents_t *from,
contents->node_count = from->node_count;
contents->flags = from->flags;
// set the 'new' flag
knot_zone_contents_set_gen_new(contents);
contents->zone = from->zone;
......
......@@ -175,6 +175,7 @@ knot_zone_contents_t *knot_zone_switch_contents(knot_zone_t *zone,
knot_zone_contents_t *old_contents =
rcu_xchg_pointer(&zone->contents, new_contents);
return old_contents;
}
......
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