提供选项:MAAT_OPT_DEFERRED_LOAD,支持延迟初始化。

This commit is contained in:
zhengchao
2017-08-22 10:03:38 +08:00
parent 64a9284430
commit f5b1b08ee9
5 changed files with 49 additions and 20 deletions

View File

@@ -605,8 +605,8 @@ int Maat_set_feather_opt(Maat_feather_t feather,enum MAAT_INIT_OPT type,const vo
}
_feather->AUTO_NUMBERING_ON=*((int*)value);
break;
case MAAT_OPT_DEFERRED_INIT:
_feather->DEFERRED_INIT_ON=1;
case MAAT_OPT_DEFERRED_LOAD:
_feather->DEFERRED_LOAD_ON=1;
break;
default:
return -1;
@@ -693,7 +693,7 @@ void maat_read_full_config(_Maat_feather_t* _feather)
int Maat_initiate_feather(Maat_feather_t feather)
{
_Maat_feather_t* _feather=(_Maat_feather_t*)feather;
if(_feather->DEFERRED_INIT_ON==0)
if(_feather->DEFERRED_LOAD_ON==0)
{
maat_read_full_config(_feather);
}

View File

@@ -3168,8 +3168,10 @@ void *thread_rule_monitor(void *arg)
//pthread_setname_np are introduced in glibc2.12
//ret=pthread_setname_np(pthread_self(),maat_name);
assert(ret>=0);
if(feather->DEFERRED_INIT_ON!=0)
if(feather->DEFERRED_LOAD_ON!=0)
{
MESA_handle_runtime_log(feather->logger,RLOG_LV_INFO,maat_module,
"Deferred Loading ON, updating in %s.",__func__);
maat_read_full_config(feather);
}
while(feather->still_working)

View File

@@ -355,7 +355,7 @@ struct _Maat_feather_t
struct _Maat_scanner_t *update_tmp_scanner;
MESA_lqueue_head garbage_q;
int table_cnt;
int DEFERRED_INIT_ON;
int DEFERRED_LOAD_ON;
int GROUP_MODE_ON;
int REDIS_MODE_ON;
int still_working;