0
0
Fork 0
mirror of https://github.com/netdata/netdata.git synced 2025-04-14 09:38:34 +00:00

Adjust max possible extent size ()

* Adjust max possible extent size

* Simplify calculation
Fix also the have_read_error
This commit is contained in:
Stelios Fragkakis 2024-11-07 12:52:14 +02:00 committed by GitHub
parent bc8ebf9bc9
commit fc5605da7f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 7 additions and 4 deletions
src/database/engine

View file

@ -184,12 +184,12 @@ static struct {
.allocated = 0,
.allocated_bytes = 0,
},
.max_size = MAX_PAGES_PER_EXTENT * RRDENG_BLOCK_SIZE,
.max_size = MAX_EXTENT_UNCOMPRESSED_SIZE
};
void extent_buffer_init(void) {
size_t max_extent_uncompressed = MAX_PAGES_PER_EXTENT * RRDENG_BLOCK_SIZE;
size_t max_size = (size_t)LZ4_compressBound(MAX_PAGES_PER_EXTENT * RRDENG_BLOCK_SIZE);
size_t max_extent_uncompressed = MAX_EXTENT_UNCOMPRESSED_SIZE;
size_t max_size = (size_t)LZ4_compressBound(MAX_EXTENT_UNCOMPRESSED_SIZE);
if(max_size < max_extent_uncompressed)
max_size = max_extent_uncompressed;
@ -1010,7 +1010,7 @@ static bool epdl_populate_pages_from_extent_data(
uncompressed_payload_length += header->descr[i].page_length;
}
if(unlikely(uncompressed_payload_length > MAX_PAGES_PER_EXTENT * RRDENG_BLOCK_SIZE))
if(unlikely(uncompressed_payload_length > MAX_EXTENT_UNCOMPRESSED_SIZE))
have_read_error = true;
if(likely(!have_read_error)) {

View file

@ -30,6 +30,9 @@ struct rrdeng_cmd;
#define MAX_PAGES_PER_EXTENT (109) /* TODO: can go higher only when journal supports bigger than 4KiB transactions */
#define DEFAULT_PAGES_PER_EXTENT (109)
#define MAX_EXTENT_UNCOMPRESSED_SIZE (MAX_PAGES_PER_EXTENT * (RRDENG_BLOCK_SIZE + RRDENG_GORILLA_32BIT_BUFFER_SIZE))
#define RRDENG_FILE_NUMBER_SCAN_TMPL "%1u-%10u"
#define RRDENG_FILE_NUMBER_PRINT_TMPL "%1.1u-%10.10u"