Merge branch 'develop' of https://github.com/taosdata/TDengine into develop
This commit is contained in:
commit
1a9fc8047c
|
@ -369,7 +369,8 @@ static void dnodeUpdateMnodeInfos(SDMMnodeInfos *pMnodes) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool dnodeReadMnodeInfos() {
|
static bool dnodeReadMnodeInfos() {
|
||||||
char ipFile[TSDB_FILENAME_LEN] = {0};
|
char ipFile[TSDB_FILENAME_LEN*2] = {0};
|
||||||
|
|
||||||
sprintf(ipFile, "%s/mnodeIpList.json", tsDnodeDir);
|
sprintf(ipFile, "%s/mnodeIpList.json", tsDnodeDir);
|
||||||
FILE *fp = fopen(ipFile, "r");
|
FILE *fp = fopen(ipFile, "r");
|
||||||
if (!fp) {
|
if (!fp) {
|
||||||
|
@ -537,7 +538,8 @@ static void dnodeSendStatusMsg(void *handle, void *tmrId) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool dnodeReadDnodeCfg() {
|
static bool dnodeReadDnodeCfg() {
|
||||||
char dnodeCfgFile[TSDB_FILENAME_LEN] = {0};
|
char dnodeCfgFile[TSDB_FILENAME_LEN*2] = {0};
|
||||||
|
|
||||||
sprintf(dnodeCfgFile, "%s/dnodeCfg.json", tsDnodeDir);
|
sprintf(dnodeCfgFile, "%s/dnodeCfg.json", tsDnodeDir);
|
||||||
|
|
||||||
FILE *fp = fopen(dnodeCfgFile, "r");
|
FILE *fp = fopen(dnodeCfgFile, "r");
|
||||||
|
|
|
@ -28,8 +28,12 @@ int32_t main(int32_t argc, char *argv[]) {
|
||||||
// Set global configuration file
|
// Set global configuration file
|
||||||
for (int32_t i = 1; i < argc; ++i) {
|
for (int32_t i = 1; i < argc; ++i) {
|
||||||
if (strcmp(argv[i], "-c") == 0) {
|
if (strcmp(argv[i], "-c") == 0) {
|
||||||
if (i < argc - 1) {
|
if (i < argc - 1) {
|
||||||
strcpy(configDir, argv[++i]);
|
if (strlen(argv[++i]) > TSDB_FILENAME_LEN - 1) {
|
||||||
|
printf("config file path overflow");
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
|
}
|
||||||
|
strcpy(configDir, argv[i]);
|
||||||
} else {
|
} else {
|
||||||
printf("'-c' requires a parameter, default:%s\n", configDir);
|
printf("'-c' requires a parameter, default:%s\n", configDir);
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
|
|
|
@ -129,7 +129,10 @@ void *dnodeAllocateVnodeWqueue(void *pVnode) {
|
||||||
|
|
||||||
if (pWorker->qset == NULL) {
|
if (pWorker->qset == NULL) {
|
||||||
pWorker->qset = taosOpenQset();
|
pWorker->qset = taosOpenQset();
|
||||||
if (pWorker->qset == NULL) return NULL;
|
if (pWorker->qset == NULL) {
|
||||||
|
taosCloseQueue(queue);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
taosAddIntoQset(pWorker->qset, queue, pVnode);
|
taosAddIntoQset(pWorker->qset, queue, pVnode);
|
||||||
pWorker->qall = taosAllocateQall();
|
pWorker->qall = taosAllocateQall();
|
||||||
|
|
|
@ -96,8 +96,12 @@ void shellParseArgument(int argc, char *argv[], struct arguments *arguments) {
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
} else if (strcmp(argv[i], "-c") == 0) {
|
} else if (strcmp(argv[i], "-c") == 0) {
|
||||||
if (i < argc - 1) {
|
if (i < argc - 1) {
|
||||||
strcpy(configDir, argv[++i]);
|
if (strlen(argv[++i]) > TSDB_FILENAME_LEN - 1) {
|
||||||
|
fprintf(stderr, "config file path: %s overflow max len %d\n", argv[i], TSDB_FILENAME_LEN - 1);
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
|
}
|
||||||
|
strcpy(configDir, argv[i]);
|
||||||
} else {
|
} else {
|
||||||
fprintf(stderr, "Option -c requires an argument\n");
|
fprintf(stderr, "Option -c requires an argument\n");
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
|
|
|
@ -80,6 +80,11 @@ static error_t parse_opt(int key, char *arg, struct argp_state *state) {
|
||||||
if (wordexp(arg, &full_path, 0) != 0) {
|
if (wordexp(arg, &full_path, 0) != 0) {
|
||||||
fprintf(stderr, "Invalid path %s\n", arg);
|
fprintf(stderr, "Invalid path %s\n", arg);
|
||||||
return -1;
|
return -1;
|
||||||
|
}
|
||||||
|
if (strlen(full_path.we_wordv[0]) > TSDB_FILENAME_LEN - 1) {
|
||||||
|
fprintf(stderr, "config file path: %s overflow max len %d\n", full_path.we_wordv[0], TSDB_FILENAME_LEN - 1);
|
||||||
|
wordfree(&full_path);
|
||||||
|
return -1;
|
||||||
}
|
}
|
||||||
strcpy(configDir, full_path.we_wordv[0]);
|
strcpy(configDir, full_path.we_wordv[0]);
|
||||||
wordfree(&full_path);
|
wordfree(&full_path);
|
||||||
|
|
|
@ -76,8 +76,12 @@ void shellParseArgument(int argc, char *argv[], struct arguments *arguments) {
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
} else if (strcmp(argv[i], "-c") == 0) {
|
} else if (strcmp(argv[i], "-c") == 0) {
|
||||||
if (i < argc - 1) {
|
if (i < argc - 1) {
|
||||||
strcpy(configDir, argv[++i]);
|
if (strlen(argv[++i]) > TSDB_FILENAME_LEN - 1) {
|
||||||
|
fprintf(stderr, "config file path: %s overflow max len %d\n", argv[i], TSDB_FILENAME_LEN - 1);
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
|
}
|
||||||
|
strcpy(configDir, argv[i]);
|
||||||
} else {
|
} else {
|
||||||
fprintf(stderr, "Option -c requires an argument\n");
|
fprintf(stderr, "Option -c requires an argument\n");
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
|
|
|
@ -132,6 +132,7 @@ static int32_t mnodeProcessShowMsg(SMnodeMsg *pMsg) {
|
||||||
int32_t size = sizeof(SCMShowRsp) + sizeof(SSchema) * TSDB_MAX_COLUMNS + TSDB_EXTRA_PAYLOAD_SIZE;
|
int32_t size = sizeof(SCMShowRsp) + sizeof(SSchema) * TSDB_MAX_COLUMNS + TSDB_EXTRA_PAYLOAD_SIZE;
|
||||||
SCMShowRsp *pShowRsp = rpcMallocCont(size);
|
SCMShowRsp *pShowRsp = rpcMallocCont(size);
|
||||||
if (pShowRsp == NULL) {
|
if (pShowRsp == NULL) {
|
||||||
|
mnodeFreeShowObj(pShow);
|
||||||
return TSDB_CODE_SERV_OUT_OF_MEMORY;
|
return TSDB_CODE_SERV_OUT_OF_MEMORY;
|
||||||
}
|
}
|
||||||
pShowRsp->qhandle = htobe64((uint64_t) pShow);
|
pShowRsp->qhandle = htobe64((uint64_t) pShow);
|
||||||
|
|
|
@ -484,7 +484,10 @@ static int32_t mnodeSuperTableActionDecode(SSdbOper *pOper) {
|
||||||
if (pStable == NULL) return TSDB_CODE_SERV_OUT_OF_MEMORY;
|
if (pStable == NULL) return TSDB_CODE_SERV_OUT_OF_MEMORY;
|
||||||
|
|
||||||
int32_t len = strlen(pOper->rowData);
|
int32_t len = strlen(pOper->rowData);
|
||||||
if (len > TSDB_TABLE_ID_LEN) return TSDB_CODE_INVALID_TABLE_ID;
|
if (len > TSDB_TABLE_ID_LEN){
|
||||||
|
free(pStable);
|
||||||
|
return TSDB_CODE_INVALID_TABLE_ID;
|
||||||
|
}
|
||||||
pStable->info.tableId = strdup(pOper->rowData);
|
pStable->info.tableId = strdup(pOper->rowData);
|
||||||
len++;
|
len++;
|
||||||
|
|
||||||
|
@ -2356,4 +2359,4 @@ static int32_t mnodeRetrieveStreams(SShowObj *pShow, char *data, int32_t rows, v
|
||||||
mnodeDecDbRef(pDb);
|
mnodeDecDbRef(pDb);
|
||||||
|
|
||||||
return numOfRows;
|
return numOfRows;
|
||||||
}
|
}
|
||||||
|
|
|
@ -281,7 +281,7 @@ int tgReadSchema(char *fileName) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void tgInitHandle(HttpServer *pServer) {
|
void tgInitHandle(HttpServer *pServer) {
|
||||||
char fileName[256] = {0};
|
char fileName[TSDB_FILENAME_LEN*2] = {0};
|
||||||
sprintf(fileName, "%s/taos.telegraf.cfg", configDir);
|
sprintf(fileName, "%s/taos.telegraf.cfg", configDir);
|
||||||
if (tgReadSchema(fileName) <= 0) {
|
if (tgReadSchema(fileName) <= 0) {
|
||||||
tgFreeSchemas();
|
tgFreeSchemas();
|
||||||
|
|
|
@ -241,7 +241,12 @@ void taosReadGlobalLogCfg() {
|
||||||
|
|
||||||
wordexp_t full_path;
|
wordexp_t full_path;
|
||||||
wordexp(configDir, &full_path, 0);
|
wordexp(configDir, &full_path, 0);
|
||||||
if (full_path.we_wordv != NULL && full_path.we_wordv[0] != NULL) {
|
if (full_path.we_wordv != NULL && full_path.we_wordv[0] != NULL) {
|
||||||
|
if (strlen(full_path.we_wordv[0]) > TSDB_FILENAME_LEN - 1) {
|
||||||
|
printf("\nconfig file: %s path overflow max len %d, all variables are set to default\n", full_path.we_wordv[0], TSDB_FILENAME_LEN - 1);
|
||||||
|
wordfree(&full_path);
|
||||||
|
return;
|
||||||
|
}
|
||||||
strcpy(configDir, full_path.we_wordv[0]);
|
strcpy(configDir, full_path.we_wordv[0]);
|
||||||
} else {
|
} else {
|
||||||
printf("configDir:%s not there, use default value: /etc/taos", configDir);
|
printf("configDir:%s not there, use default value: /etc/taos", configDir);
|
||||||
|
|
Loading…
Reference in New Issue