TDengine/source/dnode/mgmt/mgmt_vnode/src/vmFile.c

394 lines
12 KiB
C
Raw Normal View History

2022-03-16 02:48:22 +00:00
/*
* Copyright (c) 2019 TAOS Data, Inc. <jhtao@taosdata.com>
*
* This program is free software: you can use, redistribute, and/or modify
* it under the terms of the GNU Affero General Public License, version 3
* or later ("AGPL"), as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http:www.gnu.org/licenses/>.
*/
#define _DEFAULT_SOURCE
#include "tjson.h"
2023-01-11 02:44:07 +00:00
#include "vmInt.h"
2022-03-16 02:48:22 +00:00
#define MAX_CONTENT_LEN 2 * 1024 * 1024
2022-06-02 09:43:03 +00:00
2024-10-25 02:53:48 +00:00
int32_t vmGetAllVnodeListFromHash(SVnodeMgmt *pMgmt, int32_t *numOfVnodes, SVnodeObj ***ppVnodes) {
(void)taosThreadRwlockRdlock(&pMgmt->hashLock);
2024-10-25 02:53:48 +00:00
int32_t num = 0;
int32_t size = taosHashGetSize(pMgmt->runngingHash);
2024-10-25 02:53:48 +00:00
int32_t closedSize = taosHashGetSize(pMgmt->closedHash);
size += closedSize;
SVnodeObj **pVnodes = taosMemoryCalloc(size, sizeof(SVnodeObj *));
if (pVnodes == NULL) {
(void)taosThreadRwlockUnlock(&pMgmt->hashLock);
2024-10-25 02:53:48 +00:00
return terrno;
}
void *pIter = taosHashIterate(pMgmt->runngingHash, NULL);
2024-10-25 02:53:48 +00:00
while (pIter) {
SVnodeObj **ppVnode = pIter;
SVnodeObj *pVnode = *ppVnode;
if (pVnode && num < size) {
int32_t refCount = atomic_add_fetch_32(&pVnode->refCount, 1);
dTrace("vgId:%d,acquire vnode, vnode:%p, ref:%d", pVnode->vgId, pVnode, refCount);
2024-10-25 02:53:48 +00:00
pVnodes[num++] = (*ppVnode);
pIter = taosHashIterate(pMgmt->runngingHash, pIter);
2024-10-25 02:53:48 +00:00
} else {
taosHashCancelIterate(pMgmt->runngingHash, pIter);
2024-10-25 02:53:48 +00:00
}
}
pIter = taosHashIterate(pMgmt->closedHash, NULL);
while (pIter) {
SVnodeObj **ppVnode = pIter;
SVnodeObj *pVnode = *ppVnode;
if (pVnode && num < size) {
int32_t refCount = atomic_add_fetch_32(&pVnode->refCount, 1);
dTrace("vgId:%d, acquire vnode, vnode:%p, ref:%d", pVnode->vgId, pVnode, refCount);
2024-10-25 02:53:48 +00:00
pVnodes[num++] = (*ppVnode);
pIter = taosHashIterate(pMgmt->closedHash, pIter);
} else {
taosHashCancelIterate(pMgmt->closedHash, pIter);
}
}
(void)taosThreadRwlockUnlock(&pMgmt->hashLock);
2024-10-25 02:53:48 +00:00
*numOfVnodes = num;
*ppVnodes = pVnodes;
return 0;
}
2024-11-13 04:37:09 +00:00
int32_t vmGetAllVnodeListFromHashWithCreating(SVnodeMgmt *pMgmt, int32_t *numOfVnodes, SVnodeObj ***ppVnodes) {
(void)taosThreadRwlockRdlock(&pMgmt->hashLock);
2024-11-13 04:37:09 +00:00
int32_t num = 0;
int32_t size = taosHashGetSize(pMgmt->runngingHash);
2024-11-13 04:37:09 +00:00
int32_t creatingSize = taosHashGetSize(pMgmt->creatingHash);
size += creatingSize;
SVnodeObj **pVnodes = taosMemoryCalloc(size, sizeof(SVnodeObj *));
if (pVnodes == NULL) {
(void)taosThreadRwlockUnlock(&pMgmt->hashLock);
2024-11-13 04:37:09 +00:00
return terrno;
}
void *pIter = taosHashIterate(pMgmt->runngingHash, NULL);
2024-11-13 04:37:09 +00:00
while (pIter) {
SVnodeObj **ppVnode = pIter;
SVnodeObj *pVnode = *ppVnode;
if (pVnode && num < size) {
int32_t refCount = atomic_add_fetch_32(&pVnode->refCount, 1);
dTrace("vgId:%d,acquire vnode, vnode:%p, ref:%d", pVnode->vgId, pVnode, refCount);
pVnodes[num++] = (*ppVnode);
pIter = taosHashIterate(pMgmt->runngingHash, pIter);
2024-11-13 04:37:09 +00:00
} else {
taosHashCancelIterate(pMgmt->runngingHash, pIter);
2024-11-13 04:37:09 +00:00
}
}
pIter = taosHashIterate(pMgmt->creatingHash, NULL);
while (pIter) {
SVnodeObj **ppVnode = pIter;
SVnodeObj *pVnode = *ppVnode;
if (pVnode && num < size) {
int32_t refCount = atomic_add_fetch_32(&pVnode->refCount, 1);
dTrace("vgId:%d, acquire vnode, vnode:%p, ref:%d", pVnode->vgId, pVnode, refCount);
pVnodes[num++] = (*ppVnode);
pIter = taosHashIterate(pMgmt->creatingHash, pIter);
} else {
taosHashCancelIterate(pMgmt->creatingHash, pIter);
}
}
(void)taosThreadRwlockUnlock(&pMgmt->hashLock);
2024-11-13 04:37:09 +00:00
*numOfVnodes = num;
*ppVnodes = pVnodes;
return 0;
}
2024-07-16 10:01:09 +00:00
int32_t vmGetVnodeListFromHash(SVnodeMgmt *pMgmt, int32_t *numOfVnodes, SVnodeObj ***ppVnodes) {
(void)taosThreadRwlockRdlock(&pMgmt->hashLock);
2022-03-16 02:48:22 +00:00
int32_t num = 0;
int32_t size = taosHashGetSize(pMgmt->runngingHash);
2022-03-25 16:29:53 +00:00
SVnodeObj **pVnodes = taosMemoryCalloc(size, sizeof(SVnodeObj *));
2024-07-16 10:01:09 +00:00
if (pVnodes == NULL) {
(void)taosThreadRwlockUnlock(&pMgmt->hashLock);
return terrno;
2024-07-16 10:01:09 +00:00
}
2022-03-16 02:48:22 +00:00
void *pIter = taosHashIterate(pMgmt->runngingHash, NULL);
2022-03-16 02:48:22 +00:00
while (pIter) {
SVnodeObj **ppVnode = pIter;
SVnodeObj *pVnode = *ppVnode;
if (pVnode && num < size) {
int32_t refCount = atomic_add_fetch_32(&pVnode->refCount, 1);
dTrace("vgId:%d, acquire vnode, vnode:%p, ref:%d", pVnode->vgId, pVnode, refCount);
2022-07-05 09:38:21 +00:00
pVnodes[num++] = (*ppVnode);
pIter = taosHashIterate(pMgmt->runngingHash, pIter);
2022-03-16 02:48:22 +00:00
} else {
taosHashCancelIterate(pMgmt->runngingHash, pIter);
2022-03-16 02:48:22 +00:00
}
}
(void)taosThreadRwlockUnlock(&pMgmt->hashLock);
2022-03-16 02:48:22 +00:00
*numOfVnodes = num;
2024-07-16 10:01:09 +00:00
*ppVnodes = pVnodes;
2022-03-16 02:48:22 +00:00
2024-07-16 10:01:09 +00:00
return 0;
2022-03-16 02:48:22 +00:00
}
2023-01-11 02:44:07 +00:00
static int32_t vmDecodeVnodeList(SJson *pJson, SVnodeMgmt *pMgmt, SWrapperCfg **ppCfgs, int32_t *numOfVnodes) {
int32_t code = -1;
SWrapperCfg *pCfgs = NULL;
2023-01-11 04:24:44 +00:00
*ppCfgs = NULL;
2023-01-11 02:44:07 +00:00
SJson *vnodes = tjsonGetObjectItem(pJson, "vnodes");
2024-07-16 10:01:09 +00:00
if (vnodes == NULL) return TSDB_CODE_INVALID_JSON_FORMAT;
2023-01-11 02:44:07 +00:00
int32_t vnodesNum = cJSON_GetArraySize(vnodes);
if (vnodesNum > 0) {
pCfgs = taosMemoryCalloc(vnodesNum, sizeof(SWrapperCfg));
if (pCfgs == NULL) return terrno;
2023-01-11 02:44:07 +00:00
}
for (int32_t i = 0; i < vnodesNum; ++i) {
SJson *vnode = tjsonGetArrayItem(vnodes, i);
2024-07-16 10:01:09 +00:00
if (vnode == NULL) {
code = TSDB_CODE_INVALID_JSON_FORMAT;
goto _OVER;
}
2023-01-11 02:44:07 +00:00
SWrapperCfg *pCfg = &pCfgs[i];
2023-01-11 04:24:44 +00:00
tjsonGetInt32ValueFromDouble(vnode, "vgId", pCfg->vgId, code);
2024-07-16 10:01:09 +00:00
if (code != 0) goto _OVER;
2023-01-11 02:44:07 +00:00
tjsonGetInt32ValueFromDouble(vnode, "dropped", pCfg->dropped, code);
2024-07-16 10:01:09 +00:00
if (code != 0) goto _OVER;
2023-01-11 02:44:07 +00:00
tjsonGetInt32ValueFromDouble(vnode, "vgVersion", pCfg->vgVersion, code);
2024-07-16 10:01:09 +00:00
if (code != 0) goto _OVER;
tjsonGetInt32ValueFromDouble(vnode, "diskPrimary", pCfg->diskPrimary, code);
2024-07-16 10:01:09 +00:00
if (code != 0) goto _OVER;
tjsonGetInt32ValueFromDouble(vnode, "toVgId", pCfg->toVgId, code);
2024-07-16 10:01:09 +00:00
if (code != 0) goto _OVER;
2023-01-11 02:44:07 +00:00
snprintf(pCfg->path, sizeof(pCfg->path), "%s%svnode%d", pMgmt->path, TD_DIRSEP, pCfg->vgId);
}
code = 0;
*ppCfgs = pCfgs;
*numOfVnodes = vnodesNum;
_OVER:
if (*ppCfgs == NULL) taosMemoryFree(pCfgs);
return code;
}
2022-05-11 10:23:08 +00:00
int32_t vmGetVnodeListFromFile(SVnodeMgmt *pMgmt, SWrapperCfg **ppCfgs, int32_t *numOfVnodes) {
2023-01-11 02:44:07 +00:00
int32_t code = -1;
TdFilePtr pFile = NULL;
char *pData = NULL;
SJson *pJson = NULL;
2022-05-08 14:20:53 +00:00
char file[PATH_MAX] = {0};
2022-03-16 02:48:22 +00:00
SWrapperCfg *pCfgs = NULL;
snprintf(file, sizeof(file), "%s%svnodes.json", pMgmt->path, TD_DIRSEP);
2023-08-07 07:59:37 +00:00
if (taosStatFile(file, NULL, NULL, NULL) < 0) {
2024-09-10 09:40:19 +00:00
code = terrno;
2024-07-16 10:01:09 +00:00
dInfo("vnode file:%s not exist, reason:%s", file, tstrerror(code));
code = 0;
return code;
2023-01-11 02:44:07 +00:00
}
2022-03-16 02:48:22 +00:00
pFile = taosOpenFile(file, TD_FILE_READ);
if (pFile == NULL) {
2024-09-10 09:40:19 +00:00
code = terrno;
2024-07-16 10:01:09 +00:00
dError("failed to open vnode file:%s since %s", file, tstrerror(code));
2022-05-08 14:20:53 +00:00
goto _OVER;
2022-03-16 02:48:22 +00:00
}
2023-01-11 02:44:07 +00:00
int64_t size = 0;
2024-09-10 06:55:14 +00:00
code = taosFStatFile(pFile, &size, NULL);
if (code != 0) {
2024-07-16 10:01:09 +00:00
dError("failed to fstat mnode file:%s since %s", file, tstrerror(code));
2022-05-08 14:20:53 +00:00
goto _OVER;
2022-03-16 02:48:22 +00:00
}
2023-01-11 02:44:07 +00:00
pData = taosMemoryMalloc(size + 1);
if (pData == NULL) {
2024-09-12 12:57:36 +00:00
code = terrno;
2022-05-08 14:20:53 +00:00
goto _OVER;
2022-03-16 02:48:22 +00:00
}
2023-01-11 02:44:07 +00:00
if (taosReadFile(pFile, pData, size) != size) {
2024-09-10 03:29:50 +00:00
code = terrno;
2024-07-16 10:01:09 +00:00
dError("failed to read vnode file:%s since %s", file, tstrerror(code));
2022-05-08 14:20:53 +00:00
goto _OVER;
2022-03-16 02:48:22 +00:00
}
2023-01-11 02:44:07 +00:00
pData[size] = '\0';
2022-03-16 02:48:22 +00:00
2023-01-11 02:44:07 +00:00
pJson = tjsonParse(pData);
if (pJson == NULL) {
2024-07-16 10:01:09 +00:00
code = TSDB_CODE_INVALID_JSON_FORMAT;
2023-01-11 02:44:07 +00:00
goto _OVER;
}
2022-03-16 02:48:22 +00:00
2023-01-11 02:44:07 +00:00
if (vmDecodeVnodeList(pJson, pMgmt, ppCfgs, numOfVnodes) < 0) {
2024-07-16 10:01:09 +00:00
code = TSDB_CODE_INVALID_JSON_FORMAT;
2023-01-11 02:44:07 +00:00
goto _OVER;
2022-03-16 02:48:22 +00:00
}
code = 0;
2023-01-11 02:44:07 +00:00
dInfo("succceed to read vnode file %s", file);
2022-03-16 02:48:22 +00:00
2022-05-08 14:20:53 +00:00
_OVER:
2023-01-11 02:44:07 +00:00
if (pData != NULL) taosMemoryFree(pData);
if (pJson != NULL) cJSON_Delete(pJson);
2022-03-16 02:48:22 +00:00
if (pFile != NULL) taosCloseFile(&pFile);
2023-01-11 02:44:07 +00:00
if (code != 0) {
2024-07-16 10:01:09 +00:00
dError("failed to read vnode file:%s since %s", file, tstrerror(code));
2023-01-11 02:44:07 +00:00
}
2022-03-16 02:48:22 +00:00
return code;
}
static int32_t vmEncodeVnodeList(SJson *pJson, SVnodeObj **ppVnodes, int32_t numOfVnodes) {
2024-07-16 10:01:09 +00:00
int32_t code = 0;
SJson *vnodes = tjsonCreateArray();
if (vnodes == NULL) {
2024-09-12 12:57:36 +00:00
return terrno;
2024-07-16 10:01:09 +00:00
}
if ((code = tjsonAddItemToObject(pJson, "vnodes", vnodes)) < 0) {
tjsonDelete(vnodes);
return code;
};
for (int32_t i = 0; i < numOfVnodes; ++i) {
SVnodeObj *pVnode = ppVnodes[i];
if (pVnode == NULL) continue;
SJson *vnode = tjsonCreateObject();
2024-09-12 12:57:36 +00:00
if (vnode == NULL) return terrno;
2024-07-16 10:01:09 +00:00
if ((code = tjsonAddDoubleToObject(vnode, "vgId", pVnode->vgId)) < 0) return code;
if ((code = tjsonAddDoubleToObject(vnode, "dropped", pVnode->dropped)) < 0) return code;
if ((code = tjsonAddDoubleToObject(vnode, "vgVersion", pVnode->vgVersion)) < 0) return code;
if ((code = tjsonAddDoubleToObject(vnode, "diskPrimary", pVnode->diskPrimary)) < 0) return code;
if (pVnode->toVgId) {
if ((code = tjsonAddDoubleToObject(vnode, "toVgId", pVnode->toVgId)) < 0) return code;
}
if ((code = tjsonAddItemToArray(vnodes, vnode)) < 0) return code;
}
return 0;
}
2022-05-11 10:23:08 +00:00
int32_t vmWriteVnodeListToFile(SVnodeMgmt *pMgmt) {
int32_t code = -1;
char *buffer = NULL;
SJson *pJson = NULL;
TdFilePtr pFile = NULL;
SVnodeObj **ppVnodes = NULL;
char file[PATH_MAX] = {0};
char realfile[PATH_MAX] = {0};
2024-10-24 10:08:11 +00:00
int32_t lino = 0;
int32_t ret = -1;
2024-07-16 10:01:09 +00:00
int32_t nBytes = snprintf(file, sizeof(file), "%s%svnodes_tmp.json", pMgmt->path, TD_DIRSEP);
if (nBytes <= 0 || nBytes >= sizeof(file)) {
return TSDB_CODE_OUT_OF_RANGE;
}
nBytes = snprintf(realfile, sizeof(realfile), "%s%svnodes.json", pMgmt->path, TD_DIRSEP);
if (nBytes <= 0 || nBytes >= sizeof(realfile)) {
return TSDB_CODE_OUT_OF_RANGE;
}
2022-03-16 02:48:22 +00:00
int32_t numOfVnodes = 0;
2024-10-25 02:53:48 +00:00
TAOS_CHECK_GOTO(vmGetAllVnodeListFromHash(pMgmt, &numOfVnodes, &ppVnodes), &lino, _OVER);
2022-03-16 02:48:22 +00:00
2024-07-16 10:01:09 +00:00
// terrno = TSDB_CODE_OUT_OF_MEMORY;
pJson = tjsonCreateObject();
2024-07-16 10:01:09 +00:00
if (pJson == NULL) {
2024-09-12 12:57:36 +00:00
code = terrno;
2024-07-16 10:01:09 +00:00
goto _OVER;
}
2024-10-24 10:08:11 +00:00
TAOS_CHECK_GOTO(vmEncodeVnodeList(pJson, ppVnodes, numOfVnodes), &lino, _OVER);
2024-07-16 10:01:09 +00:00
buffer = tjsonToString(pJson);
2024-07-16 10:01:09 +00:00
if (buffer == NULL) {
code = TSDB_CODE_INVALID_JSON_FORMAT;
2024-10-24 10:08:11 +00:00
lino = __LINE__;
2024-07-16 10:01:09 +00:00
goto _OVER;
}
2024-10-25 10:10:00 +00:00
code = taosThreadMutexLock(&pMgmt->fileLock);
if (code != 0) {
lino = __LINE__;
goto _OVER;
}
2023-11-21 08:31:31 +00:00
pFile = taosOpenFile(file, TD_FILE_CREATE | TD_FILE_WRITE | TD_FILE_TRUNC | TD_FILE_WRITE_THROUGH);
2024-07-16 10:01:09 +00:00
if (pFile == NULL) {
2024-09-10 09:40:19 +00:00
code = terrno;
2024-10-24 10:08:11 +00:00
lino = __LINE__;
2024-10-25 10:10:00 +00:00
goto _OVER1;
2024-07-16 10:01:09 +00:00
}
2022-09-27 08:02:40 +00:00
int32_t len = strlen(buffer);
2024-07-16 10:01:09 +00:00
if (taosWriteFile(pFile, buffer, len) <= 0) {
2024-09-10 06:55:14 +00:00
code = terrno;
2024-10-24 10:08:11 +00:00
lino = __LINE__;
2024-10-25 10:10:00 +00:00
goto _OVER1;
2024-07-16 10:01:09 +00:00
}
if (taosFsyncFile(pFile) < 0) {
feat: support customized taos/taosd (#29736) * feat: support TDAcoreOS * chore: cmake options for TD_ACORE * chore: disable lemon for TD_ACORE * chore: add lzma2 and msvcregex * chore: cmake for lzma2 * chore: adapt for TD_ACORE * chore: adapt strcasecmp for TD_ACORE * chore: adapt for geos/threadName * chore: build adapt for TD_ACORE * chore: build adapt for TD_ACORE * chore: build adapt for TD_ACORE * chore: build adapt for TD_ACORE * chore: build adapt for TD_ACORE termio * chore: refact transComm.h for TD_ACORE * chore: refact transportInt.h for TD_ACORE * chore: refact trans.c for TD_ACORE * chore: refact trpc.h for TD_ACORE * chore: refact transCli.c/transComm.c/transSvr.c for TD_ACORE * chore: refact uv.h for TD_ACORE * chore: refact geosWrapper.h for TD_ACORE * chore: refact token/builtins/udf for TD_ACORE * chore: refact rocks for TD_ACORE * chore: refact tsdbCache.c for TD_ACORE, use LRU cache for last/last_row, not use rocksdb * chore: refact FAIL to _ERR to solve conflicts for TD_ACORE * chore: restore lemon.c/lempar.c * chore: support build lemon for TD_ACORE * chore: refact trpc and siginfo_t for TD_ACORE * chore: refact timezone for TD_ACORE * chore: refact lz4 for TD_ACORE * chore: refact TD_ACORE to make compile pass * chore: code optimization for TD_ASTRA * feat: support run taos with taosd integrated * feat: support invoke taos shell * feat: support invoke taos shell * feat: support invoke taos shell * chore: code optimization * chore: fix undefined reference problem os TD_ASTRA * chore: resolve compile problem for TD_ASTRA * chore: fix undefined reference problem os TD_ASTRA * chore: fix undefined reference problem os TD_ASTRA * chore: fix undefined reference problem os TD_ASTRA * chore: fix undefined reference problem os TD_ASTRA * chore: fix undefined reference problem os TD_ASTRA * chore: fix undefined reference problem os TD_ASTRA * chore: fix undefined reference problem os TD_ASTRA * chore: fix undefined reference problem os TD_ASTRA * chore: fix undefined reference problem os TD_ASTRA * chore: fix undefined reference problem os TD_ASTRA * chore: fix undefined reference problem os TD_ASTRA * chore: fix undefined reference problem os TD_ASTRA * chore: fix undefined reference problem os TD_ASTRA * chore: fix undefined reference problem os TD_ASTRA * chore: fix undefined reference problem os TD_ASTRA * chore: fix undefined reference problem os TD_ASTRA * chore: fix undefined reference problem os TD_ASTRA * chore: fix undefined reference problem os TD_ASTRA * chore: fix getpid * chore: fix typo * chore: set stack size and ajust min pack size for TD_ASTRA * chore: fix pthread create parameters * chore: chmod adapt for TD_ASTRA * chore: fix trans compile problem * chore: adapt chmod for TD_ASTRA * chore: byte alignment for TD_ASTRA * chore: more code for adaption of TD_ASTRA * chore: more code for adaption of TD_ASTRA * chore: more code for adaption of TD_ASTRA * chore: byte alignment for TD_ASTRA * chore: conditional compile option * chore: adapt for TD_ASTRA * chore: adjust taosPId and msvcregex for TD_ASTRA * chore: log dir separator for wal build name * chore: fix type of pointer parameter * chore: fix compile problem of tsdbGetS3Size * enh: get last ver from wal log for TD_ASTRA * enh: refact wal meta ver * enh: refact wal meta ver * fix: typo of taosUcs4Compare * enh: process return value of CI * chore: more code for TD_ASTRA adaption * chore: return value of taosCloseFile in walMeta.c * chore: fix compile problem * chore: fix compile problem of TD_ASTRA * fix: update macro for tq and stream task * chore: code optimization for TD_ASTRA * chore: restore create log and init cfg interface * chore: restore strncasecmp and strcasecmp * fix: adjust the field position of SDataBlockInfo * fix: pragma pack min size * fix: pragma pack min size * chore: more code for TD_ASTRA adaption * fix: type of parameters * chore: adapt strncasecmp and strcasecmp for TD_ASTRA * chore: restore interface of init log * enh: pack push optimization * fix: taos init cfg * add astra support * fix: fetch the value of suid * chore: switch of build with udf * add temp code * chore: more code for TD_ASTRA adaption * chore: add macro ERRNO to replace errno * chore: bytes align for TD_ASTRA * fix: remove obsolete codes * enh: support USE_UDF macro * fix compile error * fix: resolve redefinition problem * fix: compile problem of log.cpp * fix: compile problem of osTimezone * fix: resolve compile problem of udf * fix: pragma definition on windows * fix: ucs4 and stpncpy for TD_ASTRA * fix: memory align problem for TD_ASTRA * enh: solve memory leak for TD_ASTRA_RPC * fix: compile problem of taosSetInt64Aligned * fix: restore mndSubscribe.c * fix: scalar for udf * chore: code adaption for TD_ASTRA * chore: code optimization for TD_ASTRA * fix: typo of add definition * fix: typo of macro in tudf.h * chore: remove void to make CI pass * enh: move macro from cmake.platform to cmake.options * enh: byte align for hash node and error code * chore: restore the size for lru cache * enh: restore some code about pack push * chore: restore the pack push in tmsg.h * fix: add macro of pack pop for windows --------- Co-authored-by: yihaoDeng <luomoxyz@126.com>
2025-03-14 05:32:13 +00:00
code = TAOS_SYSTEM_ERROR(ERRNO);
2024-10-24 10:08:11 +00:00
lino = __LINE__;
2024-10-25 10:10:00 +00:00
goto _OVER1;
2024-07-16 10:01:09 +00:00
}
2022-03-16 02:48:22 +00:00
2024-07-16 10:01:09 +00:00
code = taosCloseFile(&pFile);
if (code != 0) {
feat: support customized taos/taosd (#29736) * feat: support TDAcoreOS * chore: cmake options for TD_ACORE * chore: disable lemon for TD_ACORE * chore: add lzma2 and msvcregex * chore: cmake for lzma2 * chore: adapt for TD_ACORE * chore: adapt strcasecmp for TD_ACORE * chore: adapt for geos/threadName * chore: build adapt for TD_ACORE * chore: build adapt for TD_ACORE * chore: build adapt for TD_ACORE * chore: build adapt for TD_ACORE * chore: build adapt for TD_ACORE termio * chore: refact transComm.h for TD_ACORE * chore: refact transportInt.h for TD_ACORE * chore: refact trans.c for TD_ACORE * chore: refact trpc.h for TD_ACORE * chore: refact transCli.c/transComm.c/transSvr.c for TD_ACORE * chore: refact uv.h for TD_ACORE * chore: refact geosWrapper.h for TD_ACORE * chore: refact token/builtins/udf for TD_ACORE * chore: refact rocks for TD_ACORE * chore: refact tsdbCache.c for TD_ACORE, use LRU cache for last/last_row, not use rocksdb * chore: refact FAIL to _ERR to solve conflicts for TD_ACORE * chore: restore lemon.c/lempar.c * chore: support build lemon for TD_ACORE * chore: refact trpc and siginfo_t for TD_ACORE * chore: refact timezone for TD_ACORE * chore: refact lz4 for TD_ACORE * chore: refact TD_ACORE to make compile pass * chore: code optimization for TD_ASTRA * feat: support run taos with taosd integrated * feat: support invoke taos shell * feat: support invoke taos shell * feat: support invoke taos shell * chore: code optimization * chore: fix undefined reference problem os TD_ASTRA * chore: resolve compile problem for TD_ASTRA * chore: fix undefined reference problem os TD_ASTRA * chore: fix undefined reference problem os TD_ASTRA * chore: fix undefined reference problem os TD_ASTRA * chore: fix undefined reference problem os TD_ASTRA * chore: fix undefined reference problem os TD_ASTRA * chore: fix undefined reference problem os TD_ASTRA * chore: fix undefined reference problem os TD_ASTRA * chore: fix undefined reference problem os TD_ASTRA * chore: fix undefined reference problem os TD_ASTRA * chore: fix undefined reference problem os TD_ASTRA * chore: fix undefined reference problem os TD_ASTRA * chore: fix undefined reference problem os TD_ASTRA * chore: fix undefined reference problem os TD_ASTRA * chore: fix undefined reference problem os TD_ASTRA * chore: fix undefined reference problem os TD_ASTRA * chore: fix undefined reference problem os TD_ASTRA * chore: fix undefined reference problem os TD_ASTRA * chore: fix undefined reference problem os TD_ASTRA * chore: fix getpid * chore: fix typo * chore: set stack size and ajust min pack size for TD_ASTRA * chore: fix pthread create parameters * chore: chmod adapt for TD_ASTRA * chore: fix trans compile problem * chore: adapt chmod for TD_ASTRA * chore: byte alignment for TD_ASTRA * chore: more code for adaption of TD_ASTRA * chore: more code for adaption of TD_ASTRA * chore: more code for adaption of TD_ASTRA * chore: byte alignment for TD_ASTRA * chore: conditional compile option * chore: adapt for TD_ASTRA * chore: adjust taosPId and msvcregex for TD_ASTRA * chore: log dir separator for wal build name * chore: fix type of pointer parameter * chore: fix compile problem of tsdbGetS3Size * enh: get last ver from wal log for TD_ASTRA * enh: refact wal meta ver * enh: refact wal meta ver * fix: typo of taosUcs4Compare * enh: process return value of CI * chore: more code for TD_ASTRA adaption * chore: return value of taosCloseFile in walMeta.c * chore: fix compile problem * chore: fix compile problem of TD_ASTRA * fix: update macro for tq and stream task * chore: code optimization for TD_ASTRA * chore: restore create log and init cfg interface * chore: restore strncasecmp and strcasecmp * fix: adjust the field position of SDataBlockInfo * fix: pragma pack min size * fix: pragma pack min size * chore: more code for TD_ASTRA adaption * fix: type of parameters * chore: adapt strncasecmp and strcasecmp for TD_ASTRA * chore: restore interface of init log * enh: pack push optimization * fix: taos init cfg * add astra support * fix: fetch the value of suid * chore: switch of build with udf * add temp code * chore: more code for TD_ASTRA adaption * chore: add macro ERRNO to replace errno * chore: bytes align for TD_ASTRA * fix: remove obsolete codes * enh: support USE_UDF macro * fix compile error * fix: resolve redefinition problem * fix: compile problem of log.cpp * fix: compile problem of osTimezone * fix: resolve compile problem of udf * fix: pragma definition on windows * fix: ucs4 and stpncpy for TD_ASTRA * fix: memory align problem for TD_ASTRA * enh: solve memory leak for TD_ASTRA_RPC * fix: compile problem of taosSetInt64Aligned * fix: restore mndSubscribe.c * fix: scalar for udf * chore: code adaption for TD_ASTRA * chore: code optimization for TD_ASTRA * fix: typo of add definition * fix: typo of macro in tudf.h * chore: remove void to make CI pass * enh: move macro from cmake.platform to cmake.options * enh: byte align for hash node and error code * chore: restore the size for lru cache * enh: restore some code about pack push * chore: restore the pack push in tmsg.h * fix: add macro of pack pop for windows --------- Co-authored-by: yihaoDeng <luomoxyz@126.com>
2025-03-14 05:32:13 +00:00
code = TAOS_SYSTEM_ERROR(ERRNO);
2024-10-24 10:08:11 +00:00
lino = __LINE__;
2024-10-25 10:10:00 +00:00
goto _OVER1;
2024-07-16 10:01:09 +00:00
}
2024-10-25 10:10:00 +00:00
TAOS_CHECK_GOTO(taosRenameFile(file, realfile), &lino, _OVER1);
dInfo("succeed to write vnodes file:%s, vnodes:%d", realfile, numOfVnodes);
2024-10-25 10:10:00 +00:00
_OVER1:
ret = taosThreadMutexUnlock(&pMgmt->fileLock);
2024-10-25 10:10:00 +00:00
if (ret != 0) {
dError("failed to unlock since %s", tstrerror(ret));
}
_OVER:
if (pJson != NULL) tjsonDelete(pJson);
if (buffer != NULL) taosMemoryFree(buffer);
if (pFile != NULL) taosCloseFile(&pFile);
2022-10-10 02:51:16 +00:00
if (ppVnodes != NULL) {
2022-10-11 01:23:47 +00:00
for (int32_t i = 0; i < numOfVnodes; ++i) {
SVnodeObj *pVnode = ppVnodes[i];
if (pVnode != NULL) {
vmReleaseVnode(pMgmt, pVnode);
}
}
2022-10-10 02:51:16 +00:00
taosMemoryFree(ppVnodes);
2022-03-16 02:48:22 +00:00
}
if (code != 0) {
2024-10-24 10:08:11 +00:00
dError("failed to write vnodes file:%s at line:%d since %s, vnodes:%d", realfile, lino, tstrerror(code),
numOfVnodes);
}
return code;
}