[OPTIMIZE]delete update_hit_groups to reduce cpu consumption & reduce maat_state memory usage
This commit is contained in:
@@ -24,6 +24,7 @@ extern "C"
|
||||
#include "log/log.h"
|
||||
#include "uthash/uthash.h"
|
||||
#include "hiredis/hiredis.h"
|
||||
#include "maat_limits.h"
|
||||
|
||||
enum maat_operation {
|
||||
MAAT_OP_DEL = 0,
|
||||
@@ -50,7 +51,7 @@ struct serial_rule {
|
||||
enum maat_operation op;//0: delete, 1: add.
|
||||
long long rule_id;
|
||||
long long timeout; // absolute unix time.
|
||||
char table_name[NAME_MAX];
|
||||
char table_name[MAX_NAME_STR_LEN];
|
||||
char *table_line;
|
||||
int n_foreign;
|
||||
struct foreign_key *f_keys;
|
||||
|
||||
@@ -65,7 +65,7 @@ long long compile_runtime_update_err_count(void *compile_runtime);
|
||||
int compile_runtime_match(struct compile_runtime *compile_rt, long long *compile_ids,
|
||||
size_t compile_ids_size, struct maat_state *state);
|
||||
|
||||
size_t compile_runtime_get_hit_paths(struct compile_runtime *compile_rt,
|
||||
size_t compile_runtime_get_hit_paths(struct compile_runtime *compile_rt, int thread_id,
|
||||
struct maat_compile_state *compile_state,
|
||||
struct maat_hit_path *hit_path_array,
|
||||
size_t array_size, size_t n_internal_hit_path);
|
||||
@@ -96,7 +96,7 @@ long long group2compile_runtime_update_err_count(void *g2c_runtime);
|
||||
|
||||
/* maat compile state API */
|
||||
struct maat_compile_state;
|
||||
struct maat_compile_state *maat_compile_state_new(int thread_id);
|
||||
struct maat_compile_state *maat_compile_state_new(void);
|
||||
void maat_compile_state_reset(struct maat_compile_state *compile_state);
|
||||
void maat_compile_state_free(struct maat_compile_state *compile_state);
|
||||
|
||||
@@ -109,6 +109,7 @@ size_t maat_compile_state_get_internal_hit_paths(struct maat_compile_state *comp
|
||||
struct maat_hit_path *hit_path_array,
|
||||
size_t array_size);
|
||||
size_t maat_compile_state_get_hit_groups(struct maat_compile_state *compile_state,
|
||||
struct group2group_runtime *g2g_rt,
|
||||
struct maat_hit_group *hit_group_array,
|
||||
size_t array_size);
|
||||
|
||||
|
||||
@@ -18,7 +18,8 @@ extern "C"
|
||||
|
||||
#define MAX_KEYWORDS_STR 1024
|
||||
#define MAX_MAAT_STAT_NUM 64
|
||||
|
||||
#define MAX_NAME_STR_LEN 64
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -201,24 +201,24 @@ enum last_scan_flag {
|
||||
|
||||
struct maat_state {
|
||||
struct maat *maat_instance;
|
||||
int thread_id;
|
||||
int compile_table_id;
|
||||
enum district_flag is_set_district;
|
||||
enum last_scan_flag is_last_scan;
|
||||
long long district_id; //-1: Any District; -2: Unkonwn District;
|
||||
int scan_cnt;
|
||||
struct maat_compile_state *compile_state;
|
||||
struct maat_compile_state *compile_state;
|
||||
int scan_cnt;
|
||||
int district_id; //-1: Any District; -2: Unkonwn District;
|
||||
uint16_t thread_id;
|
||||
int16_t compile_table_id;
|
||||
uint8_t is_set_district;
|
||||
uint8_t is_last_scan;
|
||||
};
|
||||
|
||||
int my_scandir(const char *dir, struct dirent ***namelist,
|
||||
int(*filter)(const struct dirent *),
|
||||
int(*compar)(const void *, const void *));
|
||||
|
||||
struct item_district *item_district_new(long long district_id);
|
||||
struct item_district *item_district_new(int district_id);
|
||||
|
||||
void item_district_free(void *item_district);
|
||||
|
||||
long long item_district_id(struct item_district *item_dist);
|
||||
int item_district_id(struct item_district *item_dist);
|
||||
|
||||
void *rule_monitor_loop(void *arg);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user