From 1c08363dc4cfe79d00ef6248d87564400eb3d234 Mon Sep 17 00:00:00 2001 From: zhengchao Date: Tue, 29 Jun 2021 21:18:18 +0800 Subject: [PATCH] =?UTF-8?q?bool=20Matcher=E5=AF=B9=E8=BE=93=E5=85=A5?= =?UTF-8?q?=E7=9A=84item=20id=EF=BC=88clause=20id=EF=BC=89=E6=8E=92?= =?UTF-8?q?=E5=BA=8F=E5=92=8C=E5=8E=BB=E9=87=8D=EF=BC=8C=E4=BC=9A=E6=94=B9?= =?UTF-8?q?=E5=8F=98=E5=A4=96=E9=83=A8ut=5Farray=E5=86=85=E5=AE=B9?= =?UTF-8?q?=EF=BC=8C=E5=8F=AF=E8=83=BD=E9=80=A0=E6=88=90=E9=A3=8E=E9=99=A9?= =?UTF-8?q?=EF=BC=8C=20=E5=8E=BB=E9=99=A4bool=20matcher=20=E4=B8=AD?= =?UTF-8?q?=E7=9A=84=E8=BF=99=E9=83=A8=E5=88=86=E4=BB=A3=E7=A0=81=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- inc/bool_matcher.h | 2 +- src/entry/Maat_hierarchy.cpp | 2 +- src/entry/Maat_rule.cpp | 4 ++-- src/entry/bool_matcher.cpp | 14 +++++++------- test/perf_test_maatframe.cpp | 3 +++ 5 files changed, 14 insertions(+), 11 deletions(-) diff --git a/inc/bool_matcher.h b/inc/bool_matcher.h index 20cde6d..08df846 100644 --- a/inc/bool_matcher.h +++ b/inc/bool_matcher.h @@ -52,7 +52,7 @@ extern "C" struct bool_matcher * bool_matcher_new(struct bool_expr * exprs, size_t expr_num, unsigned int max_thread_num, size_t * mem_size); /* Returned results are sorted by expr_id in descending order. */ - /* 本函数将对数组item_ids进行排序,会改变item_ids中元素的顺序 */ + //Input item_ids MUST be ASCENDING order and NO duplication. int bool_matcher_match(struct bool_matcher * matcher, unsigned int thread_id, unsigned long long * item_ids, size_t item_num, struct bool_expr_match * results, size_t n_result); void bool_matcher_free(struct bool_matcher * matcher); diff --git a/src/entry/Maat_hierarchy.cpp b/src/entry/Maat_hierarchy.cpp index ede86e4..d4e4b84 100644 --- a/src/entry/Maat_hierarchy.cpp +++ b/src/entry/Maat_hierarchy.cpp @@ -331,7 +331,7 @@ static void Maat_hierarchy_region_free(struct Maat_hierarchy* hier, struct Maat_ struct Maat_hierarchy* Maat_hierarchy_new(int thread_num, void* mesa_handle_logger, struct Maat_garbage_bin* bin) { struct Maat_hierarchy* hier=ALLOC(struct Maat_hierarchy, 1); - int ret=0; + UNUSED int ret=0; hier->logger=mesa_handle_logger; hier->thread_num=thread_num; hier->version=time(NULL); diff --git a/src/entry/Maat_rule.cpp b/src/entry/Maat_rule.cpp index 9db757e..1098b95 100644 --- a/src/entry/Maat_rule.cpp +++ b/src/entry/Maat_rule.cpp @@ -57,7 +57,7 @@ extern "C" } #endif -int MAAT_FRAME_VERSION_3_2_1_20210613=1; +int MAAT_FRAME_VERSION_3_2_2_20210629=1; int is_valid_table_name(const char* str) { @@ -1425,7 +1425,7 @@ int del_region_rule(struct Maat_table_schema* table, int region_id, int group_id struct Maat_table_runtime* table_rt=NULL; struct op_expr_t* op_expr=NULL; - int ret=0; + UNUSED int ret=0; struct Maat_region_inner* region=NULL; region=(struct Maat_region_inner*)Maat_hierarchy_region_dettach_user_data(maat_scanner->hier, region_id); if(region==NULL) diff --git a/src/entry/bool_matcher.cpp b/src/entry/bool_matcher.cpp index 5ca3461..cabc552 100644 --- a/src/entry/bool_matcher.cpp +++ b/src/entry/bool_matcher.cpp @@ -150,13 +150,13 @@ int bool_matcher_match(struct bool_matcher * matcher, unsigned int thread_id, un if(matcher==NULL) return -1; if(item_num==0) return 0; - sort(item_ids, item_ids+item_num); - size_t J=0; - for(unsigned int i=1; i +using namespace std; #include #include #include @@ -92,6 +93,7 @@ TEST(BoolMatcher, Match) input_item_ids[input_item_num]=random(); input_item_num++; } + sort(input_item_ids, input_item_ids+input_item_num); ret=bool_matcher_match(bm, 1, input_item_ids, input_item_num, result_array, 1024); if(ret>0) { @@ -116,6 +118,7 @@ TEST(BoolMatcher, Match) input_item_ids[14]=222; input_item_ids[15]=333; input_item_num=8; + sort(input_item_ids, input_item_ids+input_item_num); for(i=0; i