You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by ca...@apache.org on 2022/10/08 13:56:39 UTC

[doris] branch branch-1.1-lts updated: [fix](be_ut) fix hll_test, vexpr_test and lru_cache_test failure (#13186)

This is an automated email from the ASF dual-hosted git repository.

caiconghui pushed a commit to branch branch-1.1-lts
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/branch-1.1-lts by this push:
     new 585ee736b5 [fix](be_ut) fix hll_test, vexpr_test and lru_cache_test failure (#13186)
585ee736b5 is described below

commit 585ee736b5d77c185a259a427be5bcc69b0b5e86
Author: HappenLee <ha...@hotmail.com>
AuthorDate: Sat Oct 8 21:56:33 2022 +0800

    [fix](be_ut) fix hll_test, vexpr_test and lru_cache_test failure (#13186)
    
    1. fix the hll test do not init the array
    2. vexpr test double delete function context
    3. fix lru cache UT test
---
 be/src/olap/lru_cache.h          |  2 +-
 be/test/olap/hll_test.cpp        |  2 +-
 be/test/olap/lru_cache_test.cpp  | 20 ++++++++++----------
 be/test/vec/exprs/vexpr_test.cpp | 10 ----------
 4 files changed, 12 insertions(+), 22 deletions(-)

diff --git a/be/src/olap/lru_cache.h b/be/src/olap/lru_cache.h
index 1896164aea..237de43f11 100644
--- a/be/src/olap/lru_cache.h
+++ b/be/src/olap/lru_cache.h
@@ -361,7 +361,7 @@ private:
     uint64_t _hit_count = 0;    // 命中cache的总次数
 };
 
-static const int kNumShardBits = 10;
+static const int kNumShardBits = 4;
 static const int kNumShards = 1 << kNumShardBits;
 
 class ShardedLRUCache : public Cache {
diff --git a/be/test/olap/hll_test.cpp b/be/test/olap/hll_test.cpp
index 5f1572e1b8..38b481f5a1 100644
--- a/be/test/olap/hll_test.cpp
+++ b/be/test/olap/hll_test.cpp
@@ -34,7 +34,7 @@ static uint64_t hash(uint64_t value) {
 }
 //  keep logic same with java version in fe when you change hll_test.cpp,see HllTest.java
 TEST_F(TestHll, Normal) {
-    uint8_t buf[HLL_REGISTERS_COUNT + 1];
+    uint8_t buf[HLL_REGISTERS_COUNT + 1] = {0};
 
     // empty
     {
diff --git a/be/test/olap/lru_cache_test.cpp b/be/test/olap/lru_cache_test.cpp
index d44a105595..3daf36c6d3 100644
--- a/be/test/olap/lru_cache_test.cpp
+++ b/be/test/olap/lru_cache_test.cpp
@@ -234,37 +234,37 @@ static void insert_LRUCache(LRUCache& cache, const CacheKey& key, int value,
 
 TEST_F(CacheTest, Usage) {
     LRUCache cache(LRUCacheType::SIZE);
-    cache.set_capacity(1050);
+    cache.set_capacity(1200);
 
-    // The lru usage is handle_size + charge = 96 - 1 = 95
-    // 95 + 3 means handle_size + key size
+    // The lru usage is handle_size + charge = 104 - 1 = 103
+    // 103 + 3 means handle_size + key size
     CacheKey key1("100");
     insert_LRUCache(cache, key1, 100, CachePriority::NORMAL);
-    ASSERT_EQ(198, cache.get_usage()); // 100 + 95 + 3
+    ASSERT_EQ(206, cache.get_usage());
 
     CacheKey key2("200");
     insert_LRUCache(cache, key2, 200, CachePriority::DURABLE);
-    ASSERT_EQ(496, cache.get_usage()); // 198 + 200 + 95 + 3
+    ASSERT_EQ(512, cache.get_usage());
 
     CacheKey key3("300");
     insert_LRUCache(cache, key3, 300, CachePriority::NORMAL);
-    ASSERT_EQ(894, cache.get_usage()); // 496 + 300 + 95 + 3
+    ASSERT_EQ(918, cache.get_usage());
 
     CacheKey key4("400");
     insert_LRUCache(cache, key4, 400, CachePriority::NORMAL);
-    ASSERT_EQ(796, cache.get_usage()); // 894 + 400 + 95 + 3 - (300 + 100 + (95 + 3) * 2)
+    ASSERT_EQ(812, cache.get_usage());
 
     CacheKey key5("500");
     insert_LRUCache(cache, key5, 500, CachePriority::NORMAL);
-    ASSERT_EQ(896, cache.get_usage()); // 796 + 500 + 95 + 3 - (400 + 95 +3)
+    ASSERT_EQ(912, cache.get_usage());
 
     CacheKey key6("600");
     insert_LRUCache(cache, key6, 600, CachePriority::NORMAL);
-    ASSERT_EQ(996, cache.get_usage()); // 896 + 600 + 95 +3 - (500 + 95 + 3)
+    ASSERT_EQ(1012, cache.get_usage());
 
     CacheKey key7("950");
     insert_LRUCache(cache, key7, 950, CachePriority::DURABLE);
-    ASSERT_EQ(1048, cache.get_usage()); // 996 + 950 + 95 +3 - (200 + 600 + (95 + 3) * 2)
+    ASSERT_EQ(1056, cache.get_usage());
 }
 
 TEST_F(CacheTest, Prune) {
diff --git a/be/test/vec/exprs/vexpr_test.cpp b/be/test/vec/exprs/vexpr_test.cpp
index c0d7bcc25a..a7db3a3531 100644
--- a/be/test/vec/exprs/vexpr_test.cpp
+++ b/be/test/vec/exprs/vexpr_test.cpp
@@ -79,12 +79,7 @@ TEST(TEST_VEXPR, ABSTEST) {
     auto block = row_batch.convert_to_vec_block();
     int ts = -1;
     context->execute(&block, &ts);
-
-    FunctionContext* fun_ct = context->fn_context(0);
     context->close(&runtime_stat);
-    if(fun_ct) {
-        delete fun_ct;
-    }
 }
 
 TEST(TEST_VEXPR, ABSTEST2) {
@@ -130,12 +125,7 @@ TEST(TEST_VEXPR, ABSTEST2) {
     auto block = row_batch.convert_to_vec_block();
     int ts = -1;
     context->execute(&block, &ts);
-
-    FunctionContext* fun_ct = context->fn_context(0);
     context->close(&runtime_stat);
-    if(fun_ct) {
-        delete fun_ct;
-    }
 }
 
 namespace doris {


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org