Skip to content
Snippets Groups Projects
Commit c3cbd5c2 authored by Libor Peltan's avatar Libor Peltan Committed by Daniel Salzman
Browse files

zonedb: commit catalog before reusing members...

...so that new config applies on them
parent 5165074e
No related branches found
No related tags found
1 merge request!1279Catalog conf groups
......@@ -404,6 +404,12 @@ static knot_zonedb_t *create_zonedb(conf_t *conf, server_t *server, list_t *expi
knot_zonedb_insert(db_new, zone);
}
int ret = catalog_update_commit(&server->catalog_upd, &server->catalog);
if (ret != KNOT_EOK) {
log_error("catalog, failed to apply changes (%s)", knot_strerror(ret));
return db_new;
}
if (db_old != NULL) {
knot_zonedb_iter_t *it = knot_zonedb_iter_begin(db_old);
while (!knot_zonedb_iter_finished(it)) {
......@@ -417,29 +423,22 @@ static knot_zonedb_t *create_zonedb(conf_t *conf, server_t *server, list_t *expi
knot_zonedb_iter_free(it);
} else if (check_open_catalog(&server->catalog)) {
reuse_cold_zone_ctx_t rcz = { db_new, server, conf };
int ret = catalog_apply(&server->catalog, NULL, reuse_cold_zone_cb, &rcz, false);
ret = catalog_apply(&server->catalog, NULL, reuse_cold_zone_cb, &rcz, false);
if (ret != KNOT_EOK) {
log_error("catalog, failed to reload member zones (%s)", knot_strerror(ret));
}
}
catalog_commit_cleanup(&server->catalog);
int ret = catalog_update_commit(&server->catalog_upd, &server->catalog);
if (ret == KNOT_EOK) {
catalog_it_t *it = catalog_it_begin(&server->catalog_upd);
while (!catalog_it_finished(it)) {
catalog_upd_val_t *val = catalog_it_val(it);
zone_t *zone = add_member_zone(val, db_new, server, conf);
if (zone != NULL) {
knot_zonedb_insert(db_new, zone);
}
catalog_it_next(it);
catalog_it_t *it = catalog_it_begin(&server->catalog_upd);
while (!catalog_it_finished(it)) {
catalog_upd_val_t *val = catalog_it_val(it);
zone_t *zone = add_member_zone(val, db_new, server, conf);
if (zone != NULL) {
knot_zonedb_insert(db_new, zone);
}
catalog_it_free(it);
} else {
log_error("catalog, failed to apply changes (%s)", knot_strerror(ret));
catalog_it_next(it);
}
catalog_it_free(it);
return db_new;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment