fix max table count error

This commit is contained in:
liuwentan
2023-04-22 11:30:49 +08:00
parent 72066281dc
commit b8f98a1e9e
2 changed files with 11 additions and 12 deletions

View File

@@ -248,7 +248,7 @@ struct maat_runtime* maat_runtime_create(long long version, struct maat *maat_in
}
maat_rt->ref_tbl_mgr = maat_instance->tbl_mgr;
maat_rt->max_table_num = table_manager_table_count(maat_instance->tbl_mgr);
maat_rt->max_table_num = table_manager_table_size(maat_instance->tbl_mgr);
maat_rt->sequence_map = maat_kv_store_new();
maat_rt->logger = maat_instance->logger;
maat_rt->ref_garbage_bin = maat_instance->garbage_bin;
@@ -324,12 +324,12 @@ void maat_start_cb(long long new_version, int update_type, void *u_param)
struct maat *maat_instance = (struct maat *)u_param;
maat_instance->new_version = new_version;
size_t i = 0;
size_t table_cnt = table_manager_table_count(maat_instance->tbl_mgr);
size_t max_table_cnt = table_manager_table_size(maat_instance->tbl_mgr);
enum table_type table_type = TABLE_TYPE_INVALID;
if (update_type == MAAT_UPDATE_TYPE_FULL) {
maat_instance->creating_maat_rt = maat_runtime_create(new_version, maat_instance);
for (i = 0; i < table_cnt; i++) {
for (i = 0; i < max_table_cnt; i++) {
table_type = table_manager_get_table_type(maat_instance->tbl_mgr, i);
if (table_type == TABLE_TYPE_COMPILE) {
// compile runtime need a reference to maat runtime
@@ -341,7 +341,7 @@ void maat_start_cb(long long new_version, int update_type, void *u_param)
maat_instance->maat_version = new_version;
}
for (i = 0; i < table_cnt; i++) {
for (i = 0; i < max_table_cnt; i++) {
table_type = table_manager_get_table_type(maat_instance->tbl_mgr, i);
if (table_type == TABLE_TYPE_PLUGIN) {
void *schema = table_manager_get_schema(maat_instance->tbl_mgr, i);
@@ -404,10 +404,10 @@ long long maat_runtime_rule_num(struct maat_runtime *maat_rt)
void maat_plugin_table_all_callback_finish(struct table_manager *tbl_mgr)
{
size_t table_cnt = table_manager_table_count(tbl_mgr);
size_t max_table_cnt = table_manager_table_size(tbl_mgr);
enum table_type table_type = TABLE_TYPE_INVALID;
for (size_t i = 0; i < table_cnt; i++) {
for (size_t i = 0; i < max_table_cnt; i++) {
table_type = table_manager_get_table_type(tbl_mgr, i);
if (table_type != TABLE_TYPE_PLUGIN) {
continue;

View File

@@ -432,7 +432,6 @@ TEST_F(MaatIris, basic) {
}
#endif
#if 0
class MaatFlagScan : public testing::Test
{
protected:
@@ -3193,7 +3192,7 @@ TEST_F(TableInfo, Conjunction) {
maat_state_free(state);
state = NULL;
}
#endif
class MaatFileTest : public testing::Test
{
protected:
@@ -3207,8 +3206,8 @@ protected:
maat_options_set_caller_thread_number(opts, g_thread_num);
maat_options_set_instance_name(opts, "files");
maat_options_set_iris(opts, rule_folder, rule_folder);
//maat_options_set_rule_update_checking_interval_ms(opts, scan_interval_ms);
//maat_options_set_rule_effect_interval_ms(opts, effective_interval_ms);
maat_options_set_rule_update_checking_interval_ms(opts, scan_interval_ms);
maat_options_set_rule_effect_interval_ms(opts, effective_interval_ms);
maat_options_set_logger(opts, "./maat_framework_gtest.log", LOG_LEVEL_INFO);
_shared_maat_instance = maat_new(opts, table_info);
@@ -3289,7 +3288,7 @@ TEST_F(MaatFileTest, StreamFiles) {
free(name_list);
}
#if 0
class HierarchyTest : public testing::Test
{
protected:
@@ -5654,7 +5653,7 @@ TEST_F(MaatRollbackTest, FullConfigRollback) {
maat_state_free(state);
state = NULL;
}
#endif
int main(int argc, char ** argv)
{
int ret=0;