summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorzhengchao <[email protected]>2020-12-05 16:54:04 +0600
committerzhengchao <[email protected]>2020-12-05 16:54:04 +0600
commita925ed039da2deeac919fb6bf758893d4d344a3a (patch)
treecf03960d9985753dd3349df1f915075c11467955
parentf8ca593ea1cadf4aab42d0491f327e5a9ed9a73a (diff)
region_compile中compile_rule缓存数组的大小,调整为与调用参数相同。去除部分无效代码。v3.1.9v3.1.8
-rw-r--r--src/entry/Maat_api.cpp4
-rw-r--r--src/entry/Maat_hierarchy.cpp22
-rw-r--r--src/inc_internal/Maat_limits.h1
-rw-r--r--test/test_maatframe.cpp17
4 files changed, 17 insertions, 27 deletions
diff --git a/src/entry/Maat_api.cpp b/src/entry/Maat_api.cpp
index 29cfa97..1880041 100644
--- a/src/entry/Maat_api.cpp
+++ b/src/entry/Maat_api.cpp
@@ -226,7 +226,7 @@ int region_compile(_Maat_feather_t*feather, struct Maat_hierarchy_compile_mid* c
int scan_ret=0;
int i=0;
- struct Maat_compile_rule* compile_rule_array[MAX_SCANNER_HIT_NUM];
+ struct Maat_compile_rule* compile_rule_array[size];
struct Maat_compile_rule* compile_rule=NULL;
int virtual_table_id=0;
@@ -247,7 +247,7 @@ int region_compile(_Maat_feather_t*feather, struct Maat_hierarchy_compile_mid* c
Maat_hierarchy_compile_mid_udpate(compile_mid, region->region_id, virtual_table_id, region_hit_wraper->Nth_scan, i);
}
- scan_ret=Maat_hierarchy_region_compile(compile_mid, is_last_region, (void**)compile_rule_array, MAX_SCANNER_HIT_NUM);
+ scan_ret=Maat_hierarchy_region_compile(compile_mid, is_last_region, (void**)compile_rule_array, size);
//Maat_hierarchy is rwlock protected, it always returns non-NULL compile_rule.
if(scan_ret>1)
{
diff --git a/src/entry/Maat_hierarchy.cpp b/src/entry/Maat_hierarchy.cpp
index d61acb2..7d36579 100644
--- a/src/entry/Maat_hierarchy.cpp
+++ b/src/entry/Maat_hierarchy.cpp
@@ -16,11 +16,6 @@
#define module_maat_hierarchy "MAAT_HIERARCHY"
-#define TO_CLAUSE_ID(clause_index, compile_id) ((unsigned long long)clause_index<<32|compile_id)
-#define TO_CLAUSE_ID_COMPATBILE(vid, gid) ((unsigned long long)vid<<32|gid)
-#define TO_LITERAL_ID(vt_id, group_id) ((long long)vt_id<<32|group_id)
-
-
struct Maat_hierarchy_group
{
@@ -53,17 +48,6 @@ struct Maat_hierarchy_literal_id
int group_id;
int virtual_table_id;
};
-struct Maat_hierarchy_literal_usage_key
-{
- int clause_index;
- int compile_id;
-};
-struct Maat_hierarchy_literal_usage
-{
- struct Maat_hierarchy_literal_usage_key literal_usage_key;
- char not_flag;
- UT_hash_handle hh;
-};
struct Maat_hierarchy_literal
{
@@ -100,10 +84,6 @@ static void _group_vertex_free(struct Maat_hierarchy_group* group)
}
-
-
-
-
struct Maat_hierarchy
{
pthread_rwlock_t rwlock;
@@ -303,7 +283,6 @@ 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_hierarchy* hier=ALLOC(struct Maat_hierarchy, 1);
@@ -1364,7 +1343,6 @@ int Maat_hierarchy_region_compile(struct Maat_hierarchy_compile_mid* mid, int is
pthread_rwlock_rdlock(&hier->rwlock);
bool_match_ret=bool_matcher_match(hier->bm, mid->thread_num,
(unsigned long long*)utarray_eltptr(mid->_all_hit_clause_array, 0), utarray_len(mid->_all_hit_clause_array),
- //mid->all_hit_clause_array, mid->all_hit_clause_cnt,
(void**)compile_array, ud_array_sz);
for(i=0; i<bool_match_ret; i++)
{
diff --git a/src/inc_internal/Maat_limits.h b/src/inc_internal/Maat_limits.h
index f7a6abf..7fea843 100644
--- a/src/inc_internal/Maat_limits.h
+++ b/src/inc_internal/Maat_limits.h
@@ -3,7 +3,6 @@
#define MAX_DISTRICT_LEN 64
#define MAX_SCANNER_HIT_NUM 4096
-#define MAX_GROUP_CACHE 128
#define MAX_FAILED_NUM 128
diff --git a/test/test_maatframe.cpp b/test/test_maatframe.cpp
index 6ecf3b3..8a94efa 100644
--- a/test/test_maatframe.cpp
+++ b/test/test_maatframe.cpp
@@ -3509,7 +3509,9 @@ TEST_F(MaatCmdTest, GroupInMassCompiles)
sleep(1);
int ret=0, url_table_id=0, appid_table_id=0;
- const char* http_url="https://www.baidu.com/s?wd=zhengzhou&rsv_spt=1&rsv_iqid=0x8b4cae8100000560&issp=1&f=8&rsv_bp=1";
+
+ const char* http_url1="https://www.baidu.com/s?wd=tsg";
+ const char* http_url2="https://www.baidu.com/s?wd=zhengzhou&rsv_spt=1&rsv_iqid=0x8b4cae8100000560&issp=1&f=8&rsv_bp=1";
struct Maat_rule_t result[4];
scan_status_t mid=NULL;
@@ -3522,7 +3524,7 @@ TEST_F(MaatCmdTest, GroupInMassCompiles)
ASSERT_GT(appid_table_id, 0);
- ret=Maat_full_scan_string(feather, url_table_id, CHARSET_GBK, http_url, strlen(http_url),
+ ret=Maat_full_scan_string(feather, url_table_id, CHARSET_GBK, http_url2, strlen(http_url2),
result, NULL, 4, &mid, 0);
EXPECT_EQ(ret, -2);
@@ -3531,6 +3533,17 @@ TEST_F(MaatCmdTest, GroupInMassCompiles)
EXPECT_EQ(result[0].config_id, target_compile.config_id);
Maat_clean_status(&mid);
+
+
+ ret=Maat_full_scan_string(feather, url_table_id, CHARSET_GBK, http_url1, strlen(http_url1),
+ result, NULL, 4, &mid, 0);
+ EXPECT_EQ(ret, -2);
+
+ ret=Maat_scan_intval(feather, appid_table_id, 100, result, 4, &mid, 0);
+ EXPECT_EQ(ret, 4);
+
+ Maat_clean_status(&mid);
+
}