Commit 794a8faa authored by Libor Peltan's avatar Libor Peltan

journal: bootstrap: overwriting bootstrap changeset on AXFR

parent 2ee59365
......@@ -248,7 +248,7 @@ static int axfr_finalize(struct refresh_data *data)
}
ret = zone_in_journal_store(data->conf, data->zone, new_zone);
if (ret != KNOT_EOK && ret != KNOT_EEXIST && ret != KNOT_ENOTSUP) {
if (ret != KNOT_EOK && ret != KNOT_ENOTSUP) {
IXFRIN_LOG(LOG_WARNING, data->zone->name, data->remote,
"failed to write zone contents to journal (%s)",
knot_strerror(ret));
......
......@@ -1330,8 +1330,8 @@ static int store_changesets(journal_t *j, list_t *changesets)
changeset_t * chs_head = (HEAD(*changesets));
bool is_bootstrap = (chs_head->soa_from == NULL);
uint32_t serial = is_bootstrap ? 0 : knot_soa_serial(&chs_head->soa_from->rrs);
if (!is_bootstrap && md_flag(txn, SERIAL_TO_VALID) &&
serial_compare(txn->shadow_md.last_serial_to, serial) != 0) {
if (md_flag(txn, SERIAL_TO_VALID) && (is_bootstrap ||
serial_compare(txn->shadow_md.last_serial_to, serial) != 0)) {
log_zone_warning(j->zone, "journal, discontinuity in changes history (%u -> %u), dropping older changesets",
txn->shadow_md.last_serial_to, serial);
if (!md_flushed(txn) && !journal_merge_allowed(j)) {
......
......@@ -574,7 +574,7 @@ static int commit_full(conf_t *conf, zone_update_t *update, zone_contents_t **co
/* Store new zone contents in journal. */
if (update->zone->journal_db != NULL) { // TODO this should be better
ret = zone_in_journal_store(conf, update->zone, update->new_cont);
if (ret != KNOT_EOK && ret != KNOT_EEXIST && ret != KNOT_ENOTSUP) {
if (ret != KNOT_EOK && ret != KNOT_ENOTSUP) {
return ret;
}
}
......
......@@ -370,12 +370,6 @@ int zone_in_journal_store(conf_t *conf, zone_t *zone, zone_contents_t *new_conte
return KNOT_ENOTSUP;
}
if (journal_exists(zone->journal_db, zone->name)) {
// for now we refuse storing zone-in-journal into existing journal
// TODO maybe store the diff in such case as a normal changeset ?
return KNOT_EEXIST;
}
changeset_t *co_ch = changeset_from_contents(new_contents);
int ret = co_ch ? zone_change_store(conf, zone, co_ch) : KNOT_ENOMEM;
changeset_from_contents_free(co_ch);
......
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