Commit affcf20a authored by Daniel Salzman's avatar Daniel Salzman

Merge branch 'journal-revert-commit' into 'master'

Revert "journal: handling errors at getting LMDB usage"

See merge request !795
parents cf3dddd4 c85825e0
...@@ -1274,30 +1274,20 @@ static int store_changesets(journal_t *j, list_t *changesets) ...@@ -1274,30 +1274,20 @@ static int store_changesets(journal_t *j, list_t *changesets)
// PART 2 : recalculating the previous insert's occupy change // PART 2 : recalculating the previous insert's occupy change
md_get_common_last_occupied(txn, &occupied_last); md_get_common_last_occupied(txn, &occupied_last);
if (occupied_now == 0) { md_set(txn, NULL, MDKEY_GLOBAL_LAST_TOTAL_OCCUPIED, occupied_now);
// This shall not happen. We just handle it to minimize damage in case it would. Not 100% correct. if (occupied_now != occupied_last) {
uint64_t tz_occupied; knot_dname_t *last_zone = NULL;
md_get(txn, j->zone, MDKEY_PERZONE_OCCUPIED, &tz_occupied); uint64_t lz_occupied;
tz_occupied += serialized_size_total; md_get_common_last_inserter_zone(txn, &last_zone);
occupied_last += serialized_size_total; if (last_zone != NULL) {
md_set(txn, NULL, MDKEY_GLOBAL_LAST_TOTAL_OCCUPIED, occupied_last); md_get(txn, last_zone, MDKEY_PERZONE_OCCUPIED, &lz_occupied);
md_set(txn, j->zone, MDKEY_PERZONE_OCCUPIED, tz_occupied); lz_occupied = (lz_occupied + occupied_now > occupied_last ?
} else { lz_occupied + occupied_now - occupied_last : 0);
md_set(txn, NULL, MDKEY_GLOBAL_LAST_TOTAL_OCCUPIED, occupied_now); md_set(txn, last_zone, MDKEY_PERZONE_OCCUPIED, lz_occupied);
if (occupied_now != occupied_last) { free(last_zone);
knot_dname_t *last_zone = NULL;
uint64_t lz_occupied;
md_get_common_last_inserter_zone(txn, &last_zone);
if (last_zone != NULL) {
md_get(txn, last_zone, MDKEY_PERZONE_OCCUPIED, &lz_occupied);
lz_occupied = (lz_occupied + occupied_now > occupied_last ?
lz_occupied + occupied_now - occupied_last : 0);
md_set(txn, last_zone, MDKEY_PERZONE_OCCUPIED, lz_occupied);
free(last_zone);
}
} }
md_set_common_last_inserter_zone(txn, j->zone);
} }
md_set_common_last_inserter_zone(txn, j->zone);
// PART 3a : delete all if inserting bootstrap changeset // PART 3a : delete all if inserting bootstrap changeset
if (inserting_bootstrap) { if (inserting_bootstrap) {
......
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