summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibor Peltan <libor.peltan@nic.cz>2017-06-09 13:30:30 +0200
committerLibor Peltan <libor.peltan@nic.cz>2017-06-09 13:30:30 +0200
commitb3a7ddc9788b7cbdb03574838824751862d9d0b5 (patch)
treeae64b1797cae9b335115618887c7873f8fd66aa2
parentMerge branch 'fix' into 'master' (diff)
downloadknot-b3a7ddc9788b7cbdb03574838824751862d9d0b5.tar.xz
knot-b3a7ddc9788b7cbdb03574838824751862d9d0b5.zip
journal: calculating LMDB usage before starting txn
-rw-r--r--src/knot/journal/journal.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/knot/journal/journal.c b/src/knot/journal/journal.c
index f6ab4e4b1..5f946c2ca 100644
--- a/src/knot/journal/journal.c
+++ b/src/knot/journal/journal.c
@@ -1232,6 +1232,8 @@ static int store_changesets(journal_t *j, list_t *changesets)
int inserting_merged = false;
+ size_t occupied_last, occupied_now = knot_db_lmdb_get_usage(j->db->db);
+
WALK_LIST(ch, *changesets) {
nchs++;
serialized_size_total += changeset_serialized_size(ch);
@@ -1243,9 +1245,7 @@ static int store_changesets(journal_t *j, list_t *changesets)
// if you're tempted to add dirty_serial deletion somewhere here, you're wrong. Don't do it.
// PART 2 : recalculating the previous insert's occupy change
- size_t occupied_last, occupied_now;
md_get_common_last_occupied(txn, &occupied_last);
- occupied_now = knot_db_lmdb_get_usage(j->db->db);
md_set(txn, NULL, MDKEY_GLOBAL_LAST_TOTAL_OCCUPIED, occupied_now);
if (occupied_now != occupied_last) {
knot_dname_t *last_zone = NULL;