0
0
Fork 0
mirror of https://github.com/netdata/netdata.git synced 2025-04-13 09:11:50 +00:00

Do not allocate/copy extent data twice.

This commit is contained in:
vkalintiris 2024-11-24 14:57:05 +02:00
parent 586895d8a2
commit ac2f112560

View file

@ -1255,11 +1255,6 @@ void epdl_find_extent_and_populate_pages(struct rrdengine_instance *ctx, EPDL *e
void *extent_data = datafile_extent_read(ctx, epdl->file, epdl->extent_offset, epdl->extent_size);
if(extent_data != NULL) {
void *copied_extent_compressed_data = dbengine_extent_alloc(epdl->extent_size);
memcpy(copied_extent_compressed_data, extent_data, epdl->extent_size);
datafile_extent_read_free(extent_data);
if(worker)
worker_is_busy(UV_EVENT_DBENGINE_EXTENT_CACHE_LOOKUP);
@ -1272,11 +1267,11 @@ void epdl_find_extent_and_populate_pages(struct rrdengine_instance *ctx, EPDL *e
.size = epdl->extent_size,
.end_time_s = 0,
.update_every_s = 0,
.data = copied_extent_compressed_data,
.data = extent_data,
}, &added);
if (!added) {
dbengine_extent_free(copied_extent_compressed_data, epdl->extent_size);
dbengine_extent_free(extent_data, epdl->extent_size);
internal_fatal(epdl->extent_size != pgc_page_data_size(extent_cache, extent_cache_page),
"DBENGINE: cache size does not match the expected size");
}