diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2019-09-03 10:23:38 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2019-09-03 10:23:38 +0000 |
commit | 574098461cd45be12a497afbdac6f93c58978387 (patch) | |
tree | 9eb60a5930b7c20d42f7fde1e234cae3968ed3d9 /database/engine/journalfile.c | |
parent | Adding upstream version 1.16.1. (diff) | |
download | netdata-574098461cd45be12a497afbdac6f93c58978387.tar.xz netdata-574098461cd45be12a497afbdac6f93c58978387.zip |
Adding upstream version 1.17.0.upstream/1.17.0
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'database/engine/journalfile.c')
-rw-r--r-- | database/engine/journalfile.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/database/engine/journalfile.c b/database/engine/journalfile.c index d6e4f3174..fac680aa0 100644 --- a/database/engine/journalfile.c +++ b/database/engine/journalfile.c @@ -269,7 +269,6 @@ static void restore_extent_metadata(struct rrdengine_instance *ctx, struct rrden extent = mallocz(sizeof(*extent) + count * sizeof(extent->pages[0])); extent->offset = jf_metric_data->extent_offset; extent->size = jf_metric_data->extent_size; - extent->number_of_pages = count; extent->datafile = journalfile->datafile; extent->next = NULL; @@ -282,7 +281,6 @@ static void restore_extent_metadata(struct rrdengine_instance *ctx, struct rrden error("Unknown page type encountered."); continue; } - ++valid_pages; temp_id = (uuid_t *)jf_metric_data->descr[i].uuid; uv_rwlock_rdlock(&pg_cache->metrics_index.lock); @@ -308,11 +306,16 @@ static void restore_extent_metadata(struct rrdengine_instance *ctx, struct rrden descr->end_time = jf_metric_data->descr[i].end_time; descr->id = &page_index->id; descr->extent = extent; - extent->pages[i] = descr; + extent->pages[valid_pages++] = descr; pg_cache_insert(ctx, page_index, descr); } + + extent->number_of_pages = valid_pages; + if (likely(valid_pages)) df_extent_insert(extent); + else + freez(extent); } /* |