adjust
This commit is contained in:
parent
084d0ab367
commit
6e1e4702a5
|
@ -101,7 +101,6 @@ typedef struct SNodeList {
|
||||||
|
|
||||||
typedef struct SNodeAllocator SNodeAllocator;
|
typedef struct SNodeAllocator SNodeAllocator;
|
||||||
|
|
||||||
void nodesInit();
|
|
||||||
int32_t nodesInitAllocatorSet();
|
int32_t nodesInitAllocatorSet();
|
||||||
void nodesDestroyAllocatorSet();
|
void nodesDestroyAllocatorSet();
|
||||||
int32_t nodesCreateAllocator(int64_t queryId, int32_t chunkSize, int64_t* pAllocatorId);
|
int32_t nodesCreateAllocator(int64_t queryId, int32_t chunkSize, int64_t* pAllocatorId);
|
||||||
|
|
|
@ -156,7 +156,6 @@ extern void s3End();
|
||||||
|
|
||||||
int32_t dmInit() {
|
int32_t dmInit() {
|
||||||
dInfo("start to init dnode env");
|
dInfo("start to init dnode env");
|
||||||
nodesInit();
|
|
||||||
if (dmDiskInit() != 0) return -1;
|
if (dmDiskInit() != 0) return -1;
|
||||||
if (!dmCheckDataDirVersion()) return -1;
|
if (!dmCheckDataDirVersion()) return -1;
|
||||||
if (!dmCheckDiskSpace()) return -1;
|
if (!dmCheckDiskSpace()) return -1;
|
||||||
|
|
|
@ -46,7 +46,7 @@ typedef struct SBuiltinNodeDefinition {
|
||||||
SBuiltinNodeDefinition funcNodes[QUERY_NODE_END] = {NULL};
|
SBuiltinNodeDefinition funcNodes[QUERY_NODE_END] = {NULL};
|
||||||
|
|
||||||
static TdThreadOnce functionNodeInit = PTHREAD_ONCE_INIT;
|
static TdThreadOnce functionNodeInit = PTHREAD_ONCE_INIT;
|
||||||
static int32_t initNodeCode = -1;
|
volatile int32_t initNodeCode = -1;
|
||||||
|
|
||||||
static void setFunc(const char* name, int32_t type, int32_t nodeSize, FExecNodeToJson toJsonFunc,
|
static void setFunc(const char* name, int32_t type, int32_t nodeSize, FExecNodeToJson toJsonFunc,
|
||||||
FExecJsonToNode toNodeFunc, FExecDestoryNode destoryFunc) {
|
FExecJsonToNode toNodeFunc, FExecDestoryNode destoryFunc) {
|
||||||
|
@ -59,19 +59,16 @@ static void setFunc(const char* name, int32_t type, int32_t nodeSize, FExecNodeT
|
||||||
|
|
||||||
static void doInitNodeFuncArray();
|
static void doInitNodeFuncArray();
|
||||||
|
|
||||||
void nodesInit() {
|
|
||||||
taosThreadOnce(&functionNodeInit, doInitNodeFuncArray);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool funcArrayCheck(int32_t type) {
|
bool funcArrayCheck(int32_t type) {
|
||||||
if (type < 0 || QUERY_NODE_END < (type+1)) {
|
if (type < 0 || QUERY_NODE_END <= type) {
|
||||||
nodesError("funcArrayCheck unknown type = %d", type);
|
nodesError("funcArrayCheck out of range type = %d", type);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (initNodeCode != 0) {
|
if (initNodeCode != 0) {
|
||||||
nodesInit();
|
taosThreadOnce(&functionNodeInit, doInitNodeFuncArray);
|
||||||
}
|
}
|
||||||
if (!funcNodes[type].name) {
|
if (!funcNodes[type].name) {
|
||||||
|
nodesError("funcArrayCheck unsupported type = %d", type);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
@ -6494,7 +6491,7 @@ static int32_t jsonToInsertStmt(const SJson* pJson, void* pObj) {
|
||||||
int32_t specificNodeToJson(const void* pObj, SJson* pJson) {
|
int32_t specificNodeToJson(const void* pObj, SJson* pJson) {
|
||||||
ENodeType type = nodeType(pObj);
|
ENodeType type = nodeType(pObj);
|
||||||
if (!funcArrayCheck(type)) {
|
if (!funcArrayCheck(type)) {
|
||||||
return TSDB_CODE_SUCCESS;
|
return TSDB_CODE_NOT_FOUND;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (funcNodes[type].toJsonFunc) {
|
if (funcNodes[type].toJsonFunc) {
|
||||||
|
@ -6508,7 +6505,7 @@ int32_t specificNodeToJson(const void* pObj, SJson* pJson) {
|
||||||
int32_t jsonToSpecificNode(const SJson* pJson, void* pObj) {
|
int32_t jsonToSpecificNode(const SJson* pJson, void* pObj) {
|
||||||
ENodeType type = nodeType(pObj);
|
ENodeType type = nodeType(pObj);
|
||||||
if (!funcArrayCheck(type)) {
|
if (!funcArrayCheck(type)) {
|
||||||
return TSDB_CODE_SUCCESS;
|
return TSDB_CODE_NOT_FOUND;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (funcNodes[type].toNodeFunc) {
|
if (funcNodes[type].toNodeFunc) {
|
||||||
|
@ -7423,16 +7420,16 @@ void nodesDestroyNode(SNode* pNode) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t index = nodeType(pNode);
|
int32_t type = nodeType(pNode);
|
||||||
if (!funcArrayCheck(index)) {
|
if (!funcArrayCheck(type)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (funcNodes[index].destoryFunc) {
|
if (funcNodes[type].destoryFunc) {
|
||||||
funcNodes[index].destoryFunc(pNode);
|
funcNodes[type].destoryFunc(pNode);
|
||||||
nodesFree(pNode);
|
nodesFree(pNode);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
nodesError("nodesDestroyNode unknown node type = %d", nodeType(pNode));
|
nodesWarn("nodesDestroyNode unknown type = %d", type);
|
||||||
nodesFree(pNode);
|
nodesFree(pNode);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -131,7 +131,6 @@ static void destroyNodeAllocator(void* p) {
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t nodesInitAllocatorSet() {
|
int32_t nodesInitAllocatorSet() {
|
||||||
nodesInit();
|
|
||||||
if (g_allocatorReqRefPool >= 0) {
|
if (g_allocatorReqRefPool >= 0) {
|
||||||
nodesWarn("nodes already initialized");
|
nodesWarn("nodes already initialized");
|
||||||
return TSDB_CODE_SUCCESS;
|
return TSDB_CODE_SUCCESS;
|
||||||
|
|
Loading…
Reference in New Issue