region_compile中compile_rule缓存数组的大小,调整为与调用参数相同。去除部分无效代码。
This commit is contained in:
@@ -226,7 +226,7 @@ int region_compile(_Maat_feather_t*feather, struct Maat_hierarchy_compile_mid* c
|
|||||||
int scan_ret=0;
|
int scan_ret=0;
|
||||||
int i=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;
|
struct Maat_compile_rule* compile_rule=NULL;
|
||||||
int virtual_table_id=0;
|
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);
|
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.
|
//Maat_hierarchy is rwlock protected, it always returns non-NULL compile_rule.
|
||||||
if(scan_ret>1)
|
if(scan_ret>1)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -16,11 +16,6 @@
|
|||||||
#define module_maat_hierarchy "MAAT_HIERARCHY"
|
#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
|
struct Maat_hierarchy_group
|
||||||
{
|
{
|
||||||
@@ -53,17 +48,6 @@ struct Maat_hierarchy_literal_id
|
|||||||
int group_id;
|
int group_id;
|
||||||
int virtual_table_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
|
struct Maat_hierarchy_literal
|
||||||
{
|
{
|
||||||
@@ -100,10 +84,6 @@ static void _group_vertex_free(struct Maat_hierarchy_group* group)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
struct Maat_hierarchy
|
struct Maat_hierarchy
|
||||||
{
|
{
|
||||||
pthread_rwlock_t rwlock;
|
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* Maat_hierarchy_new(int thread_num, void* mesa_handle_logger)
|
||||||
{
|
{
|
||||||
struct Maat_hierarchy* hier=ALLOC(struct Maat_hierarchy, 1);
|
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);
|
pthread_rwlock_rdlock(&hier->rwlock);
|
||||||
bool_match_ret=bool_matcher_match(hier->bm, mid->thread_num,
|
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),
|
(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);
|
(void**)compile_array, ud_array_sz);
|
||||||
for(i=0; i<bool_match_ret; i++)
|
for(i=0; i<bool_match_ret; i++)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -3,7 +3,6 @@
|
|||||||
#define MAX_DISTRICT_LEN 64
|
#define MAX_DISTRICT_LEN 64
|
||||||
|
|
||||||
#define MAX_SCANNER_HIT_NUM 4096
|
#define MAX_SCANNER_HIT_NUM 4096
|
||||||
#define MAX_GROUP_CACHE 128
|
|
||||||
|
|
||||||
#define MAX_FAILED_NUM 128
|
#define MAX_FAILED_NUM 128
|
||||||
|
|
||||||
|
|||||||
@@ -3509,7 +3509,9 @@ TEST_F(MaatCmdTest, GroupInMassCompiles)
|
|||||||
sleep(1);
|
sleep(1);
|
||||||
|
|
||||||
int ret=0, url_table_id=0, appid_table_id=0;
|
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];
|
struct Maat_rule_t result[4];
|
||||||
scan_status_t mid=NULL;
|
scan_status_t mid=NULL;
|
||||||
@@ -3522,7 +3524,7 @@ TEST_F(MaatCmdTest, GroupInMassCompiles)
|
|||||||
ASSERT_GT(appid_table_id, 0);
|
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);
|
result, NULL, 4, &mid, 0);
|
||||||
EXPECT_EQ(ret, -2);
|
EXPECT_EQ(ret, -2);
|
||||||
|
|
||||||
@@ -3531,6 +3533,17 @@ TEST_F(MaatCmdTest, GroupInMassCompiles)
|
|||||||
EXPECT_EQ(result[0].config_id, target_compile.config_id);
|
EXPECT_EQ(result[0].config_id, target_compile.config_id);
|
||||||
|
|
||||||
Maat_clean_status(&mid);
|
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);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user