Commit 1ebc9c8f authored by Daniel Salzman's avatar Daniel Salzman

Merge branch 'load_diff_autoincrement_soa' into 'master'

zone load: if computed diff and soa unchanged, increment it

Closes #234

See merge request !899
parents dc2dbb7f 8a5ed2af
......@@ -157,7 +157,7 @@ int zone_update_from_differences(zone_update_t *update, zone_t *zone, zone_conte
}
ret = zone_contents_diff(old_cont, new_cont, &update->change);
if (ret != KNOT_EOK && ret != KNOT_ENODIFF) {
if (ret != KNOT_EOK && ret != KNOT_ENODIFF && ret != KNOT_ESEMCHECK) {
free(update->a_ctx);
changeset_clear(&update->change);
return ret;
......@@ -166,6 +166,15 @@ int zone_update_from_differences(zone_update_t *update, zone_t *zone, zone_conte
uint32_t apply_flags = update->flags & UPDATE_STRICT ? APPLY_STRICT : 0;
apply_init_ctx(update->a_ctx, update->new_cont, apply_flags);
if (ret == KNOT_ESEMCHECK) {
ret = zone_update_increment_soa(update, conf());
if (ret != KNOT_EOK) {
zone_update_clear(update);
return ret;
}
log_zone_info(zone->name, "automatic SOA serial increment");
}
return KNOT_EOK;
}
......@@ -532,7 +541,7 @@ static int set_new_soa(zone_update_t *update, unsigned serial_policy)
uint32_t old_serial = knot_soa_serial(&soa_cpy->rrs);
uint32_t new_serial = serial_next(old_serial, serial_policy);
if (serial_compare(old_serial, new_serial) != SERIAL_LOWER) {
log_zone_warning(update->zone->name, "updated serial is lower "
log_zone_warning(update->zone->name, "updated SOA serial is lower "
"than current, serial %u -> %u",
old_serial, new_serial);
}
......
#!/usr/bin/env python3
'''Test for reload of a changed zone (serial up, nochange, serial down). '''
'''Test for reload of a changed zone (serial up, nochange, serial down).'''
from dnstest.test import Test
from dnstest.utils import set_err, detail_log
......@@ -19,7 +19,7 @@ t.start()
# Load zones
serial = master.zone_wait(zone)
def reload_zone(serial, version, exp_serial, exp_version):
def reload_zone(version, exp_serial, exp_version):
master.update_zonefile(zone, version)
master.reload()
new_serial = master.zone_wait(zone)
......@@ -31,17 +31,13 @@ def reload_zone(serial, version, exp_serial, exp_version):
resp.check(rcode="NOERROR")
# Zone changes, serial increases (create changeset)
version = 1
serial = serial + 1
reload_zone(serial, version, serial, version)
reload_zone(1, serial + 1, 1)
# Zone changes, serial doesn't change (no new changeset)
version += 1
reload_zone(serial, version, serial, version - 1)
# Zone changes, serial doesn't change (create changeset, increment serial automatically)
reload_zone(2, serial + 2, 2)
# Zone changes, serial jumps out-of-range (journal is not applicable)
version += 1
reload_zone(serial - 2, version, serial, version - 2)
reload_zone(3, serial + 2, 2)
# Stop master.
master.stop()
......
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