feat: add resident funcs to udfd
This commit is contained in:
parent
e0445e0698
commit
8ed3bf3ef1
|
@ -120,6 +120,7 @@ extern SDiskCfg tsDiskCfg[];
|
||||||
|
|
||||||
// udf
|
// udf
|
||||||
extern bool tsStartUdfd;
|
extern bool tsStartUdfd;
|
||||||
|
extern char tsUdfdResFuncs[];
|
||||||
|
|
||||||
// schemaless
|
// schemaless
|
||||||
extern char tsSmlChildTableName[];
|
extern char tsSmlChildTableName[];
|
||||||
|
|
|
@ -163,6 +163,7 @@ int32_t tsTtlUnit = 86400;
|
||||||
int32_t tsTtlPushInterval = 86400;
|
int32_t tsTtlPushInterval = 86400;
|
||||||
int32_t tsGrantHBInterval = 60;
|
int32_t tsGrantHBInterval = 60;
|
||||||
int32_t tsUptimeInterval = 300; // seconds
|
int32_t tsUptimeInterval = 300; // seconds
|
||||||
|
char tsUdfdResFuncs[1024] = ""; // udfd resident funcs that teardown when udfd exits
|
||||||
|
|
||||||
#ifndef _STORAGE
|
#ifndef _STORAGE
|
||||||
int32_t taosSetTfsCfg(SConfig *pCfg) {
|
int32_t taosSetTfsCfg(SConfig *pCfg) {
|
||||||
|
@ -421,6 +422,7 @@ static int32_t taosAddServerCfg(SConfig *pCfg) {
|
||||||
if (cfgAddInt32(pCfg, "uptimeInterval", tsUptimeInterval, 1, 100000, 1) != 0) return -1;
|
if (cfgAddInt32(pCfg, "uptimeInterval", tsUptimeInterval, 1, 100000, 1) != 0) return -1;
|
||||||
|
|
||||||
if (cfgAddBool(pCfg, "udf", tsStartUdfd, 0) != 0) return -1;
|
if (cfgAddBool(pCfg, "udf", tsStartUdfd, 0) != 0) return -1;
|
||||||
|
if (cfgAddString(pCfg, "udfdResFuncs", tsUdfdResFuncs, 0) != 0) return -1;
|
||||||
GRANT_CFG_ADD;
|
GRANT_CFG_ADD;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -717,6 +719,7 @@ static int32_t taosSetServerCfg(SConfig *pCfg) {
|
||||||
tsUptimeInterval = cfgGetItem(pCfg, "uptimeInterval")->i32;
|
tsUptimeInterval = cfgGetItem(pCfg, "uptimeInterval")->i32;
|
||||||
|
|
||||||
tsStartUdfd = cfgGetItem(pCfg, "udf")->bval;
|
tsStartUdfd = cfgGetItem(pCfg, "udf")->bval;
|
||||||
|
tstrncpy(tsUdfdResFuncs, cfgGetItem(pCfg, "udfdResFuncs")->str, sizeof(tsUdfdResFuncs));
|
||||||
|
|
||||||
if (tsQueryBufferSize >= 0) {
|
if (tsQueryBufferSize >= 0) {
|
||||||
tsQueryBufferSizeBytes = tsQueryBufferSize * 1048576UL;
|
tsQueryBufferSizeBytes = tsQueryBufferSize * 1048576UL;
|
||||||
|
|
|
@ -951,11 +951,19 @@ void udfdConnectMnodeThreadFunc(void *args) {
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t udfdInitResidentFuncs() {
|
int32_t udfdInitResidentFuncs() {
|
||||||
|
if (strlen(tsUdfdResFuncs) == 0) {
|
||||||
|
return TSDB_CODE_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
global.residentFuncs = taosArrayInit(2, TSDB_FUNC_NAME_LEN);
|
global.residentFuncs = taosArrayInit(2, TSDB_FUNC_NAME_LEN);
|
||||||
char gpd[TSDB_FUNC_NAME_LEN] = "gpd";
|
char* pSave = tsUdfdResFuncs;
|
||||||
taosArrayPush(global.residentFuncs, gpd);
|
char* token;
|
||||||
char gpdBatch[TSDB_FUNC_NAME_LEN] = "gpdbatch";
|
while ((token = strtok_r(pSave, ",", &pSave)) != NULL) {
|
||||||
taosArrayPush(global.residentFuncs, gpdBatch);
|
char func[TSDB_FUNC_NAME_LEN] = {0};
|
||||||
|
strncpy(func, token, strlen(token));
|
||||||
|
taosArrayPush(global.residentFuncs, func);
|
||||||
|
}
|
||||||
|
|
||||||
return TSDB_CODE_SUCCESS;
|
return TSDB_CODE_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue