@cryptotaxi247 / netdata-1 / commits / fc5605da7

Adjust max possible extent size (#18960)

* Adjust max possible extent size * Simplify calculation Fix also the have_read_error

Stelios Fragkakis committed Nov 7, 2024 at 12:52 UTC fc5605da7f3e6234c69bf43666c8f077a1683ad8
2 files changed +7 -4
src/database/engine/pdc.c
+4 -4
@@ -184,12 +184,12 @@ static struct {
184 .allocated = 0,
185 .allocated_bytes = 0,
186 },
187 - .max_size = MAX_PAGES_PER_EXTENT * RRDENG_BLOCK_SIZE,
187 + .max_size = MAX_EXTENT_UNCOMPRESSED_SIZE
188 };
189
190 void extent_buffer_init(void) {
191 - size_t max_extent_uncompressed = MAX_PAGES_PER_EXTENT * RRDENG_BLOCK_SIZE;
192 - size_t max_size = (size_t)LZ4_compressBound(MAX_PAGES_PER_EXTENT * RRDENG_BLOCK_SIZE);
191 + size_t max_extent_uncompressed = MAX_EXTENT_UNCOMPRESSED_SIZE;
192 + size_t max_size = (size_t)LZ4_compressBound(MAX_EXTENT_UNCOMPRESSED_SIZE);
193 if(max_size < max_extent_uncompressed)
194 max_size = max_extent_uncompressed;
195
@@ -1010,7 +1010,7 @@ static bool epdl_populate_pages_from_extent_data(
1010 uncompressed_payload_length += header->descr[i].page_length;
1011 }
1012
1013 - if(unlikely(uncompressed_payload_length > MAX_PAGES_PER_EXTENT * RRDENG_BLOCK_SIZE))
1013 + if(unlikely(uncompressed_payload_length > MAX_EXTENT_UNCOMPRESSED_SIZE))
1014 have_read_error = true;
1015
1016 if(likely(!have_read_error)) {
src/database/engine/rrdengine.h
+3
@@ -30,6 +30,9 @@ struct rrdeng_cmd;
30 #define MAX_PAGES_PER_EXTENT (109) /* TODO: can go higher only when journal supports bigger than 4KiB transactions */
31 #define DEFAULT_PAGES_PER_EXTENT (109)
32
33 +#define MAX_EXTENT_UNCOMPRESSED_SIZE (MAX_PAGES_PER_EXTENT * (RRDENG_BLOCK_SIZE + RRDENG_GORILLA_32BIT_BUFFER_SIZE))
34 +
35 +
36 #define RRDENG_FILE_NUMBER_SCAN_TMPL "%1u-%10u"
37 #define RRDENG_FILE_NUMBER_PRINT_TMPL "%1.1u-%10.10u"
38