summaryrefslogtreecommitdiffstats
path: root/database/engine/journalfile.c
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2019-09-03 10:23:38 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2019-09-03 10:23:38 +0000
commit574098461cd45be12a497afbdac6f93c58978387 (patch)
tree9eb60a5930b7c20d42f7fde1e234cae3968ed3d9 /database/engine/journalfile.c
parentAdding upstream version 1.16.1. (diff)
downloadnetdata-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.c9
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);
}
/*