@cryptotaxi247 / netdata-1 / commits / db9db41bc

Add support for changing the number of pages per extent dynamically during runtime. (#10593)

Markos Fountoulakis committed Mar 2, 2021 at 10:09 UTC db9db41bc8a3234b24f1468cd7172b719505cfa0
1 file changed +19 -1
database/engine/rrdengine.c
+19 -1
@@ -9,6 +9,8 @@ rrdeng_stats_t rrdeng_reserved_file_descriptors = 0;
9 rrdeng_stats_t global_pg_cache_over_half_dirty_events = 0;
10 rrdeng_stats_t global_flushing_pressure_page_deletions = 0;
11
12 +static unsigned pages_per_extent = MAX_PAGES_PER_EXTENT;
13 +
14 static void sanity_check(void)
15 {
16 /* Magic numbers must fit in the super-blocks */
@@ -679,7 +681,7 @@ static int do_flush_pages(struct rrdengine_worker_config* wc, int force, struct
681 PValue = JudyLFirst(pg_cache->committed_page_index.JudyL_array, &Index, PJE0),
682 descr = unlikely(NULL == PValue) ? NULL : *PValue ;
683
682 - descr != NULL && count != MAX_PAGES_PER_EXTENT ;
684 + descr != NULL && count != pages_per_extent ;
685
686 PValue = JudyLNext(pg_cache->committed_page_index.JudyL_array, &Index, PJE0),
687 descr = unlikely(NULL == PValue) ? NULL : *PValue) {
@@ -1044,6 +1046,21 @@ struct rrdeng_cmd rrdeng_deq_cmd(struct rrdengine_worker_config* wc)
1046 return ret;
1047 }
1048
1049 +static void load_configuration_dynamic(void)
1050 +{
1051 + unsigned read_num;
1052 + static int printed_error = 0;
1053 +
1054 + read_num = (unsigned) config_get_number(CONFIG_SECTION_GLOBAL, "dbengine extent pages",
1055 + MAX_PAGES_PER_EXTENT);
1056 + if (read_num > 0 && read_num <= MAX_PAGES_PER_EXTENT) {
1057 + pages_per_extent = read_num;
1058 + } else if (!printed_error) {
1059 + printed_error = 1;
1060 + error("Invalid dbengine extent pages %u given. Defaulting to %u.", read_num, pages_per_extent);
1061 + }
1062 +}
1063 +
1064 void async_cb(uv_async_t *handle)
1065 {
1066 uv_stop(handle->loop);
@@ -1097,6 +1114,7 @@ void timer_cb(uv_timer_t* handle)
1114 }
1115 }
1116 }
1117 + load_configuration_dynamic();
1118 #ifdef NETDATA_INTERNAL_CHECKS
1119 {
1120 char buf[4096];