From ffcefd0fb82345dddce170c0254fb20a167e18ba Mon Sep 17 00:00:00 2001 From: Alexander Taepper Date: Thu, 3 Aug 2023 13:57:54 +0200 Subject: [PATCH] fix: divergence between mac and linux info test results, fix memory leaks in Threshold.cpp --- endToEndTests/test/info.test.js | 20 +++++++++---------- src/silo/database.test.cpp | 12 +++++------ src/silo/query_engine/operators/threshold.cpp | 6 ++---- 3 files changed, 18 insertions(+), 20 deletions(-) diff --git a/endToEndTests/test/info.test.js b/endToEndTests/test/info.test.js index aec21d8c5..a266c9cb7 100644 --- a/endToEndTests/test/info.test.js +++ b/endToEndTests/test/info.test.js @@ -7,7 +7,7 @@ describe('The /info endpoint', () => { .get('/info') .expect(200) .expect('Content-Type', 'application/json') - .expect({ nBitmapsSize: 3898, sequenceCount: 100, totalSize: 60055044 }) + .expect({ nBitmapsSize: 3898, sequenceCount: 100, totalSize: 60054981 }) .end(done); }); @@ -26,15 +26,15 @@ describe('The /info endpoint', () => { 'bitmapContainerSizeStatistic' ); expect(returnedInfo.bitmapContainerSizePerGenomeSection.bitmapContainerSizeStatistic).to.deep.equal({ - numberOfArrayContainers: 43545, + numberOfArrayContainers: 43540, numberOfBitsetContainers: 0, - numberOfRunContainers: 78, - numberOfValuesStoredInArrayContainers: 59694, + numberOfRunContainers: 83, + numberOfValuesStoredInArrayContainers: 59577, numberOfValuesStoredInBitsetContainers: 0, - numberOfValuesStoredInRunContainers: 2237, - totalBitmapSizeArrayContainers: 119388, + numberOfValuesStoredInRunContainers: 2354, + totalBitmapSizeArrayContainers: 119154, totalBitmapSizeBitsetContainers: 0, - totalBitmapSizeRunContainers: 2964, + totalBitmapSizeRunContainers: 3170, }); expect(returnedInfo.bitmapContainerSizePerGenomeSection).to.have.property( @@ -62,11 +62,11 @@ describe('The /info endpoint', () => { expect(returnedInfo).to.have.property('bitmapSizePerSymbol'); expect(returnedInfo.bitmapSizePerSymbol).to.deep.equal({ '-': 6003470, - 'A': 6112681, + 'A': 6112653, 'B': 5980600, - 'C': 6064603, + 'C': 6064589, 'D': 5980600, - 'G': 6067693, + 'G': 6067672, 'H': 5980600, 'K': 5980630, 'M': 5980620, diff --git a/src/silo/database.test.cpp b/src/silo/database.test.cpp index 8e692e733..e67e5b5e2 100644 --- a/src/silo/database.test.cpp +++ b/src/silo/database.test.cpp @@ -40,7 +40,7 @@ TEST(DatabaseTest, shouldReturnCorrectDatabaseInfo) { const auto simple_info = database.getDatabaseInfo(); EXPECT_EQ( - detailed_info.bitmap_size_per_symbol.size_in_bytes.at(silo::NUCLEOTIDE_SYMBOL::A), 6112681 + detailed_info.bitmap_size_per_symbol.size_in_bytes.at(silo::NUCLEOTIDE_SYMBOL::A), 6112653 ); EXPECT_EQ( detailed_info.bitmap_size_per_symbol.size_in_bytes.at(silo::NUCLEOTIDE_SYMBOL::GAP), 6003470 @@ -54,7 +54,7 @@ TEST(DatabaseTest, shouldReturnCorrectDatabaseInfo) { EXPECT_EQ( detailed_info.bitmap_container_size_per_genome_section.bitmap_container_size_statistic .number_of_values_stored_in_run_containers, - 2237 + 2354 ); EXPECT_EQ( detailed_info.bitmap_container_size_per_genome_section.bitmap_container_size_statistic @@ -63,18 +63,18 @@ TEST(DatabaseTest, shouldReturnCorrectDatabaseInfo) { ); EXPECT_EQ( - detailed_info.bitmap_container_size_per_genome_section.total_bitmap_size_computed, 96160390 + detailed_info.bitmap_container_size_per_genome_section.total_bitmap_size_computed, 96160327 ); EXPECT_EQ( - detailed_info.bitmap_container_size_per_genome_section.total_bitmap_size_frozen, 48185111 + detailed_info.bitmap_container_size_per_genome_section.total_bitmap_size_frozen, 48185073 ); EXPECT_EQ( detailed_info.bitmap_container_size_per_genome_section.bitmap_container_size_statistic .total_bitmap_size_array_containers, - 119388 + 119154 ); - EXPECT_EQ(simple_info.total_size, 60055044); + EXPECT_EQ(simple_info.total_size, 60054981); EXPECT_EQ(simple_info.sequence_count, 100); EXPECT_EQ(simple_info.n_bitmaps_size, 3898); } diff --git a/src/silo/query_engine/operators/threshold.cpp b/src/silo/query_engine/operators/threshold.cpp index 2af5c39e0..5b31dd710 100644 --- a/src/silo/query_engine/operators/threshold.cpp +++ b/src/silo/query_engine/operators/threshold.cpp @@ -123,10 +123,8 @@ OperatorResult Threshold::evaluate() const { partition_bitmaps[j] |= partition_bitmaps[j - 1] - *bitmap; } if (k - i > n - 1) { - roaring::api::roaring_bitmap_or_inplace( - &partition_bitmaps[0].roaring, - roaring::api::roaring_bitmap_flip(&bitmap->roaring, 0, row_count) - ); + bitmap->flip(0, row_count); + partition_bitmaps[0] |= *bitmap; } } // NOLINTEND(readability-identifier-length)