Merge pull request #13410 from taosdata/fix/mnode
enh: adjust vnode replica and some logs
This commit is contained in:
commit
0bade86534
|
@ -216,7 +216,7 @@ int main(int argc, char const *argv[]) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
dInfo("start to run dnode");
|
dInfo("start to open dnode");
|
||||||
dmSetSignalHandle();
|
dmSetSignalHandle();
|
||||||
int32_t code = dmRun();
|
int32_t code = dmRun();
|
||||||
dInfo("shutting down the service");
|
dInfo("shutting down the service");
|
||||||
|
|
|
@ -277,6 +277,8 @@ _OVER:
|
||||||
if (code != 0) {
|
if (code != 0) {
|
||||||
vnodeClose(pImpl);
|
vnodeClose(pImpl);
|
||||||
vnodeDestroy(path, pMgmt->pTfs);
|
vnodeDestroy(path, pMgmt->pTfs);
|
||||||
|
} else {
|
||||||
|
dInfo("vgId:%d, vnode is created", createReq.vgId);
|
||||||
}
|
}
|
||||||
|
|
||||||
tFreeSCreateVnodeReq(&createReq);
|
tFreeSCreateVnodeReq(&createReq);
|
||||||
|
|
|
@ -91,51 +91,52 @@ static void vmProcessFetchQueue(SQueueInfo *pInfo, SRpcMsg *pMsg) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static void vmProcessWriteQueue(SQueueInfo *pInfo, STaosQall *qall, int32_t numOfMsgs) {
|
static void vmProcessWriteQueue(SQueueInfo *pInfo, STaosQall *qall, int32_t numOfMsgs) {
|
||||||
|
int32_t code = 0;
|
||||||
|
SRpcMsg *pMsg = NULL;
|
||||||
SVnodeObj *pVnode = pInfo->ahandle;
|
SVnodeObj *pVnode = pInfo->ahandle;
|
||||||
SArray *pArray = taosArrayInit(numOfMsgs, sizeof(SRpcMsg *));
|
int64_t sync = vnodeGetSyncHandle(pVnode->pImpl);
|
||||||
if (pArray == NULL) {
|
SArray *pArray = taosArrayInit(numOfMsgs, sizeof(SRpcMsg **));
|
||||||
dError("failed to process %d msgs in write-queue since %s", numOfMsgs, terrstr());
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (int32_t i = 0; i < numOfMsgs; ++i) {
|
for (int32_t m = 0; m < numOfMsgs; m++) {
|
||||||
SRpcMsg *pMsg = NULL;
|
|
||||||
if (taosGetQitem(qall, (void **)&pMsg) == 0) continue;
|
if (taosGetQitem(qall, (void **)&pMsg) == 0) continue;
|
||||||
|
dTrace("vgId:%d, get msg:%p from vnode-write queue, type:%s", pVnode->vgId, pMsg, TMSG_INFO(pMsg->msgType));
|
||||||
|
|
||||||
dTrace("msg:%p, get from vnode-write queue", pMsg);
|
|
||||||
if (taosArrayPush(pArray, &pMsg) == NULL) {
|
if (taosArrayPush(pArray, &pMsg) == NULL) {
|
||||||
dTrace("msg:%p, failed to push to array since %s", pMsg, terrstr());
|
dError("vgId:%d, failed to push msg:%p to vnode-write array", pVnode->vgId, pMsg);
|
||||||
vmSendRsp(pMsg, TSDB_CODE_OUT_OF_MEMORY);
|
vmSendRsp(pMsg, TSDB_CODE_OUT_OF_MEMORY);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < taosArrayGetSize(pArray); i++) {
|
for (int32_t m = 0; m < taosArrayGetSize(pArray); m++) {
|
||||||
SRpcMsg *pMsg = *(SRpcMsg **)taosArrayGet(pArray, i);
|
pMsg = *(SRpcMsg **)taosArrayGet(pArray, m);
|
||||||
SRpcMsg rsp = {.info = pMsg->info};
|
code = vnodePreprocessReq(pVnode->pImpl, pMsg);
|
||||||
|
|
||||||
vnodePreprocessReq(pVnode->pImpl, pMsg);
|
if (code == TSDB_CODE_ACTION_IN_PROGRESS) continue;
|
||||||
|
if (code != 0) {
|
||||||
|
dError("vgId:%d, msg:%p failed to process since %s", pVnode->vgId, pMsg, tstrerror(code));
|
||||||
|
vmSendRsp(pMsg, code);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
int32_t ret = syncPropose(vnodeGetSyncHandle(pVnode->pImpl), pMsg, false);
|
code = syncPropose(sync, pMsg, false);
|
||||||
if (ret == TAOS_SYNC_PROPOSE_NOT_LEADER) {
|
if (code == TAOS_SYNC_PROPOSE_SUCCESS) {
|
||||||
dTrace("msg:%p, is redirect since not leader, vgId:%d ", pMsg, pVnode->vgId);
|
continue;
|
||||||
rsp.code = TSDB_CODE_RPC_REDIRECT;
|
} else if (code == TAOS_SYNC_PROPOSE_NOT_LEADER) {
|
||||||
SEpSet newEpSet;
|
dTrace("vgId:%d, msg:%p is redirect since not leader", pVnode->vgId, pMsg);
|
||||||
syncGetEpSet(vnodeGetSyncHandle(pVnode->pImpl), &newEpSet);
|
SEpSet newEpSet = {0};
|
||||||
|
syncGetEpSet(sync, &newEpSet);
|
||||||
newEpSet.inUse = (newEpSet.inUse + 1) % newEpSet.numOfEps;
|
newEpSet.inUse = (newEpSet.inUse + 1) % newEpSet.numOfEps;
|
||||||
|
SRpcMsg rsp = {.code = TSDB_CODE_RPC_REDIRECT, .info = pMsg->info};
|
||||||
tmsgSendRedirectRsp(&rsp, &newEpSet);
|
tmsgSendRedirectRsp(&rsp, &newEpSet);
|
||||||
} else if (ret == TAOS_SYNC_PROPOSE_OTHER_ERROR) {
|
|
||||||
rsp.code = TSDB_CODE_SYN_INTERNAL_ERROR;
|
|
||||||
tmsgSendRsp(&rsp);
|
|
||||||
} else if (ret == TAOS_SYNC_PROPOSE_SUCCESS) {
|
|
||||||
// send response in applyQ
|
|
||||||
} else {
|
} else {
|
||||||
assert(0);
|
dError("vgId:%d, msg:%p failed to process since %s", pVnode->vgId, pMsg, tstrerror(code));
|
||||||
|
vmSendRsp(pMsg, code);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int32_t i = 0; i < numOfMsgs; i++) {
|
for (int32_t i = 0; i < numOfMsgs; i++) {
|
||||||
SRpcMsg *pMsg = *(SRpcMsg **)taosArrayGet(pArray, i);
|
pMsg = *(SRpcMsg **)taosArrayGet(pArray, i);
|
||||||
dTrace("msg:%p, is freed", pMsg);
|
dTrace("vgId:%d, msg:%p, is freed", pVnode->vgId, pMsg);
|
||||||
rpcFreeCont(pMsg->pCont);
|
rpcFreeCont(pMsg->pCont);
|
||||||
taosFreeQitem(pMsg);
|
taosFreeQitem(pMsg);
|
||||||
}
|
}
|
||||||
|
|
|
@ -50,26 +50,26 @@ static int32_t dmInitMonitor() {
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t dmInit(int8_t rtype) {
|
int32_t dmInit(int8_t rtype) {
|
||||||
dInfo("start to init env");
|
dInfo("start to init dnode env");
|
||||||
if (dmCheckRepeatInit(dmInstance()) != 0) return -1;
|
if (dmCheckRepeatInit(dmInstance()) != 0) return -1;
|
||||||
if (dmInitSystem() != 0) return -1;
|
if (dmInitSystem() != 0) return -1;
|
||||||
if (dmInitMonitor() != 0) return -1;
|
if (dmInitMonitor() != 0) return -1;
|
||||||
if (dmInitDnode(dmInstance(), rtype) != 0) return -1;
|
if (dmInitDnode(dmInstance(), rtype) != 0) return -1;
|
||||||
|
|
||||||
dInfo("env is initialized");
|
dInfo("dnode env is initialized");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32_t dmCheckRepeatCleanup(SDnode *pDnode) {
|
static int32_t dmCheckRepeatCleanup(SDnode *pDnode) {
|
||||||
if (atomic_val_compare_exchange_8(&pDnode->once, DND_ENV_READY, DND_ENV_CLEANUP) != DND_ENV_READY) {
|
if (atomic_val_compare_exchange_8(&pDnode->once, DND_ENV_READY, DND_ENV_CLEANUP) != DND_ENV_READY) {
|
||||||
dError("env is already cleaned up");
|
dError("dnode env is already cleaned up");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void dmCleanup() {
|
void dmCleanup() {
|
||||||
dDebug("start to cleanup env");
|
dDebug("start to cleanup dnode env");
|
||||||
SDnode *pDnode = dmInstance();
|
SDnode *pDnode = dmInstance();
|
||||||
if (dmCheckRepeatCleanup(pDnode) != 0) return;
|
if (dmCheckRepeatCleanup(pDnode) != 0) return;
|
||||||
dmCleanupDnode(pDnode);
|
dmCleanupDnode(pDnode);
|
||||||
|
@ -79,7 +79,7 @@ void dmCleanup() {
|
||||||
udfcClose();
|
udfcClose();
|
||||||
udfStopUdfd();
|
udfStopUdfd();
|
||||||
taosStopCacheRefreshWorker();
|
taosStopCacheRefreshWorker();
|
||||||
dInfo("env is cleaned up");
|
dInfo("dnode env is cleaned up");
|
||||||
|
|
||||||
taosCloseLog();
|
taosCloseLog();
|
||||||
taosCleanupCfg();
|
taosCleanupCfg();
|
||||||
|
|
|
@ -148,7 +148,6 @@ int32_t dmReadEps(SDnodeData *pData) {
|
||||||
|
|
||||||
code = 0;
|
code = 0;
|
||||||
dDebug("succcessed to read file %s", file);
|
dDebug("succcessed to read file %s", file);
|
||||||
dmPrintEps(pData);
|
|
||||||
|
|
||||||
_OVER:
|
_OVER:
|
||||||
if (content != NULL) taosMemoryFree(content);
|
if (content != NULL) taosMemoryFree(content);
|
||||||
|
@ -162,6 +161,7 @@ _OVER:
|
||||||
taosArrayPush(pData->dnodeEps, &dnodeEp);
|
taosArrayPush(pData->dnodeEps, &dnodeEp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
dDebug("reset dnode list on startup");
|
||||||
dmResetEps(pData, pData->dnodeEps);
|
dmResetEps(pData, pData->dnodeEps);
|
||||||
|
|
||||||
if (dmIsEpChanged(pData, pData->dnodeId, tsLocalEp)) {
|
if (dmIsEpChanged(pData, pData->dnodeId, tsLocalEp)) {
|
||||||
|
@ -236,11 +236,13 @@ void dmUpdateEps(SDnodeData *pData, SArray *eps) {
|
||||||
|
|
||||||
int32_t numOfEpsOld = (int32_t)taosArrayGetSize(pData->dnodeEps);
|
int32_t numOfEpsOld = (int32_t)taosArrayGetSize(pData->dnodeEps);
|
||||||
if (numOfEps != numOfEpsOld) {
|
if (numOfEps != numOfEpsOld) {
|
||||||
|
dDebug("new dnode list get from mnode");
|
||||||
dmResetEps(pData, eps);
|
dmResetEps(pData, eps);
|
||||||
dmWriteEps(pData);
|
dmWriteEps(pData);
|
||||||
} else {
|
} else {
|
||||||
int32_t size = numOfEps * sizeof(SDnodeEp);
|
int32_t size = numOfEps * sizeof(SDnodeEp);
|
||||||
if (memcmp(pData->dnodeEps->pData, eps->pData, size) != 0) {
|
if (memcmp(pData->dnodeEps->pData, eps->pData, size) != 0) {
|
||||||
|
dDebug("new dnode list get from mnode");
|
||||||
dmResetEps(pData, eps);
|
dmResetEps(pData, eps);
|
||||||
dmWriteEps(pData);
|
dmWriteEps(pData);
|
||||||
}
|
}
|
||||||
|
@ -282,7 +284,7 @@ static void dmResetEps(SDnodeData *pData, SArray *dnodeEps) {
|
||||||
|
|
||||||
static void dmPrintEps(SDnodeData *pData) {
|
static void dmPrintEps(SDnodeData *pData) {
|
||||||
int32_t numOfEps = (int32_t)taosArrayGetSize(pData->dnodeEps);
|
int32_t numOfEps = (int32_t)taosArrayGetSize(pData->dnodeEps);
|
||||||
dDebug("print dnode ep list, num:%d", numOfEps);
|
dDebug("print dnode list, num:%d", numOfEps);
|
||||||
for (int32_t i = 0; i < numOfEps; i++) {
|
for (int32_t i = 0; i < numOfEps; i++) {
|
||||||
SDnodeEp *pEp = taosArrayGet(pData->dnodeEps, i);
|
SDnodeEp *pEp = taosArrayGet(pData->dnodeEps, i);
|
||||||
dDebug("dnode:%d, fqdn:%s port:%u is_mnode:%d", pEp->id, pEp->ep.fqdn, pEp->ep.port, pEp->isMnode);
|
dDebug("dnode:%d, fqdn:%s port:%u is_mnode:%d", pEp->id, pEp->ep.fqdn, pEp->ep.port, pEp->isMnode);
|
||||||
|
|
|
@ -135,7 +135,7 @@ TdFilePtr dmCheckRunning(const char *dataDir) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
dDebug("file:%s is locked", filepath);
|
dDebug("lock file:%s to prevent repeated starts", filepath);
|
||||||
return pFile;
|
return pFile;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -655,7 +655,7 @@ static int32_t mndRetrieveMnodes(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pB
|
||||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||||
colDataAppend(pColInfo, numOfRows, b1, false);
|
colDataAppend(pColInfo, numOfRows, b1, false);
|
||||||
|
|
||||||
const char *roles = "OFFLINE";
|
const char *roles = "offline";
|
||||||
if (pObj->id == pMnode->selfDnodeId) {
|
if (pObj->id == pMnode->selfDnodeId) {
|
||||||
roles = syncStr(TAOS_SYNC_STATE_LEADER);
|
roles = syncStr(TAOS_SYNC_STATE_LEADER);
|
||||||
}
|
}
|
||||||
|
@ -667,9 +667,9 @@ static int32_t mndRetrieveMnodes(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pB
|
||||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||||
colDataAppend(pColInfo, numOfRows, (const char *)b2, false);
|
colDataAppend(pColInfo, numOfRows, (const char *)b2, false);
|
||||||
|
|
||||||
const char *status = "READY";
|
const char *status = "ready";
|
||||||
if (objStatus == SDB_STATUS_CREATING) status = "CREATING";
|
if (objStatus == SDB_STATUS_CREATING) status = "creating";
|
||||||
if (objStatus == SDB_STATUS_DROPPING) status = "DROPPING";
|
if (objStatus == SDB_STATUS_DROPPING) status = "dropping";
|
||||||
char b3[9 + VARSTR_HEADER_SIZE] = {0};
|
char b3[9 + VARSTR_HEADER_SIZE] = {0};
|
||||||
STR_WITH_MAXSIZE_TO_VARSTR(b3, status, pShow->pMeta->pSchemas[cols].bytes);
|
STR_WITH_MAXSIZE_TO_VARSTR(b3, status, pShow->pMeta->pSchemas[cols].bytes);
|
||||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||||
|
|
|
@ -390,7 +390,7 @@ static int32_t mndDoRebalance(SMnode *pMnode, const SMqRebInputObj *pInput, SMqR
|
||||||
mInfo("rebalance calculation completed, rebalanced vg:");
|
mInfo("rebalance calculation completed, rebalanced vg:");
|
||||||
for (int32_t i = 0; i < taosArrayGetSize(pOutput->rebVgs); i++) {
|
for (int32_t i = 0; i < taosArrayGetSize(pOutput->rebVgs); i++) {
|
||||||
SMqRebOutputVg *pOutputRebVg = taosArrayGet(pOutput->rebVgs, i);
|
SMqRebOutputVg *pOutputRebVg = taosArrayGet(pOutput->rebVgs, i);
|
||||||
mInfo("vgId:%d moved from consumer %" PRId64 " to consumer %" PRId64, pOutputRebVg->pVgEp->vgId,
|
mInfo("vgId:%d, moved from consumer %" PRId64 " to consumer %" PRId64, pOutputRebVg->pVgEp->vgId,
|
||||||
pOutputRebVg->oldConsumerId, pOutputRebVg->newConsumerId);
|
pOutputRebVg->oldConsumerId, pOutputRebVg->newConsumerId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -705,7 +705,7 @@ static int32_t mndRetrieveVgroups(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *p
|
||||||
}
|
}
|
||||||
|
|
||||||
char buf1[20] = {0};
|
char buf1[20] = {0};
|
||||||
const char *role = online ? syncStr(pVgroup->vnodeGid[i].role) : "OFFLINE";
|
const char *role = online ? syncStr(pVgroup->vnodeGid[i].role) : "offline";
|
||||||
STR_WITH_MAXSIZE_TO_VARSTR(buf1, role, pShow->pMeta->pSchemas[cols].bytes);
|
STR_WITH_MAXSIZE_TO_VARSTR(buf1, role, pShow->pMeta->pSchemas[cols].bytes);
|
||||||
|
|
||||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||||
|
|
|
@ -28,12 +28,12 @@ typedef struct SMetaDB SMetaDB;
|
||||||
|
|
||||||
// metaDebug ==================
|
// metaDebug ==================
|
||||||
// clang-format off
|
// clang-format off
|
||||||
#define metaFatal(...) do { if (metaDebugFlag & DEBUG_FATAL) { taosPrintLog("META FATAL ", DEBUG_FATAL, 255, __VA_ARGS__); }} while(0)
|
#define metaFatal(...) do { if (metaDebugFlag & DEBUG_FATAL) { taosPrintLog("MTA FATAL ", DEBUG_FATAL, 255, __VA_ARGS__); }} while(0)
|
||||||
#define metaError(...) do { if (metaDebugFlag & DEBUG_ERROR) { taosPrintLog("META ERROR ", DEBUG_ERROR, 255, __VA_ARGS__); }} while(0)
|
#define metaError(...) do { if (metaDebugFlag & DEBUG_ERROR) { taosPrintLog("MTA ERROR ", DEBUG_ERROR, 255, __VA_ARGS__); }} while(0)
|
||||||
#define metaWarn(...) do { if (metaDebugFlag & DEBUG_WARN) { taosPrintLog("META WARN ", DEBUG_WARN, 255, __VA_ARGS__); }} while(0)
|
#define metaWarn(...) do { if (metaDebugFlag & DEBUG_WARN) { taosPrintLog("MTA WARN ", DEBUG_WARN, 255, __VA_ARGS__); }} while(0)
|
||||||
#define metaInfo(...) do { if (metaDebugFlag & DEBUG_INFO) { taosPrintLog("META ", DEBUG_INFO, 255, __VA_ARGS__); }} while(0)
|
#define metaInfo(...) do { if (metaDebugFlag & DEBUG_INFO) { taosPrintLog("MTA ", DEBUG_INFO, 255, __VA_ARGS__); }} while(0)
|
||||||
#define metaDebug(...) do { if (metaDebugFlag & DEBUG_DEBUG) { taosPrintLog("META ", DEBUG_DEBUG, metaDebugFlag, __VA_ARGS__); }} while(0)
|
#define metaDebug(...) do { if (metaDebugFlag & DEBUG_DEBUG) { taosPrintLog("MTA ", DEBUG_DEBUG, metaDebugFlag, __VA_ARGS__); }} while(0)
|
||||||
#define metaTrace(...) do { if (metaDebugFlag & DEBUG_TRACE) { taosPrintLog("META ", DEBUG_TRACE, metaDebugFlag, __VA_ARGS__); }} while(0)
|
#define metaTrace(...) do { if (metaDebugFlag & DEBUG_TRACE) { taosPrintLog("MTA ", DEBUG_TRACE, metaDebugFlag, __VA_ARGS__); }} while(0)
|
||||||
// clang-format on
|
// clang-format on
|
||||||
|
|
||||||
// metaOpen ==================
|
// metaOpen ==================
|
||||||
|
|
|
@ -84,7 +84,7 @@ int32_t vnodeAsyncCommit(SVnode* pVnode);
|
||||||
int32_t vnodeSyncOpen(SVnode* pVnode, char* path);
|
int32_t vnodeSyncOpen(SVnode* pVnode, char* path);
|
||||||
void vnodeSyncStart(SVnode* pVnode);
|
void vnodeSyncStart(SVnode* pVnode);
|
||||||
void vnodeSyncClose(SVnode* pVnode);
|
void vnodeSyncClose(SVnode* pVnode);
|
||||||
void vnodeSyncAlter(SVnode* pVnode, SRpcMsg* pMsg);
|
int32_t vnodeSyncAlter(SVnode* pVnode, SRpcMsg* pMsg);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
|
|
@ -53,42 +53,42 @@ int metaOpen(SVnode *pVnode, SMeta **ppMeta) {
|
||||||
// open env
|
// open env
|
||||||
ret = tdbOpen(pMeta->path, pVnode->config.szPage, pVnode->config.szCache, &pMeta->pEnv);
|
ret = tdbOpen(pMeta->path, pVnode->config.szPage, pVnode->config.szCache, &pMeta->pEnv);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
metaError("vgId:%d failed to open meta env since %s", TD_VID(pVnode), tstrerror(terrno));
|
metaError("vgId:%d, failed to open meta env since %s", TD_VID(pVnode), tstrerror(terrno));
|
||||||
goto _err;
|
goto _err;
|
||||||
}
|
}
|
||||||
|
|
||||||
// open pTbDb
|
// open pTbDb
|
||||||
ret = tdbTbOpen("table.db", sizeof(STbDbKey), -1, tbDbKeyCmpr, pMeta->pEnv, &pMeta->pTbDb);
|
ret = tdbTbOpen("table.db", sizeof(STbDbKey), -1, tbDbKeyCmpr, pMeta->pEnv, &pMeta->pTbDb);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
metaError("vgId:%d failed to open meta table db since %s", TD_VID(pVnode), tstrerror(terrno));
|
metaError("vgId:%d, failed to open meta table db since %s", TD_VID(pVnode), tstrerror(terrno));
|
||||||
goto _err;
|
goto _err;
|
||||||
}
|
}
|
||||||
|
|
||||||
// open pSkmDb
|
// open pSkmDb
|
||||||
ret = tdbTbOpen("schema.db", sizeof(SSkmDbKey), -1, skmDbKeyCmpr, pMeta->pEnv, &pMeta->pSkmDb);
|
ret = tdbTbOpen("schema.db", sizeof(SSkmDbKey), -1, skmDbKeyCmpr, pMeta->pEnv, &pMeta->pSkmDb);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
metaError("vgId:%d failed to open meta schema db since %s", TD_VID(pVnode), tstrerror(terrno));
|
metaError("vgId:%d, failed to open meta schema db since %s", TD_VID(pVnode), tstrerror(terrno));
|
||||||
goto _err;
|
goto _err;
|
||||||
}
|
}
|
||||||
|
|
||||||
// open pUidIdx
|
// open pUidIdx
|
||||||
ret = tdbTbOpen("uid.idx", sizeof(tb_uid_t), sizeof(int64_t), uidIdxKeyCmpr, pMeta->pEnv, &pMeta->pUidIdx);
|
ret = tdbTbOpen("uid.idx", sizeof(tb_uid_t), sizeof(int64_t), uidIdxKeyCmpr, pMeta->pEnv, &pMeta->pUidIdx);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
metaError("vgId:%d failed to open meta uid idx since %s", TD_VID(pVnode), tstrerror(terrno));
|
metaError("vgId:%d, failed to open meta uid idx since %s", TD_VID(pVnode), tstrerror(terrno));
|
||||||
goto _err;
|
goto _err;
|
||||||
}
|
}
|
||||||
|
|
||||||
// open pNameIdx
|
// open pNameIdx
|
||||||
ret = tdbTbOpen("name.idx", -1, sizeof(tb_uid_t), NULL, pMeta->pEnv, &pMeta->pNameIdx);
|
ret = tdbTbOpen("name.idx", -1, sizeof(tb_uid_t), NULL, pMeta->pEnv, &pMeta->pNameIdx);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
metaError("vgId:%d failed to open meta name index since %s", TD_VID(pVnode), tstrerror(terrno));
|
metaError("vgId:%d, failed to open meta name index since %s", TD_VID(pVnode), tstrerror(terrno));
|
||||||
goto _err;
|
goto _err;
|
||||||
}
|
}
|
||||||
|
|
||||||
// open pCtbIdx
|
// open pCtbIdx
|
||||||
ret = tdbTbOpen("ctb.idx", sizeof(SCtbIdxKey), 0, ctbIdxKeyCmpr, pMeta->pEnv, &pMeta->pCtbIdx);
|
ret = tdbTbOpen("ctb.idx", sizeof(SCtbIdxKey), 0, ctbIdxKeyCmpr, pMeta->pEnv, &pMeta->pCtbIdx);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
metaError("vgId:%d failed to open meta child table index since %s", TD_VID(pVnode), tstrerror(terrno));
|
metaError("vgId:%d, failed to open meta child table index since %s", TD_VID(pVnode), tstrerror(terrno));
|
||||||
goto _err;
|
goto _err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -100,14 +100,14 @@ int metaOpen(SVnode *pVnode, SMeta **ppMeta) {
|
||||||
taosMkDir(indexFullPath);
|
taosMkDir(indexFullPath);
|
||||||
ret = indexOpen(indexOptsCreate(), indexFullPath, (SIndex **)&pMeta->pTagIvtIdx);
|
ret = indexOpen(indexOptsCreate(), indexFullPath, (SIndex **)&pMeta->pTagIvtIdx);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
metaError("vgId:%d failed to open meta tag index since %s", TD_VID(pVnode), tstrerror(terrno));
|
metaError("vgId:%d, failed to open meta tag index since %s", TD_VID(pVnode), tstrerror(terrno));
|
||||||
goto _err;
|
goto _err;
|
||||||
}
|
}
|
||||||
|
|
||||||
#else
|
#else
|
||||||
ret = tdbTbOpen("tag.idx", -1, 0, tagIdxKeyCmpr, pMeta->pEnv, &pMeta->pTagIdx);
|
ret = tdbTbOpen("tag.idx", -1, 0, tagIdxKeyCmpr, pMeta->pEnv, &pMeta->pTagIdx);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
metaError("vgId:%d failed to open meta tag index since %s", TD_VID(pVnode), tstrerror(terrno));
|
metaError("vgId:%d, failed to open meta tag index since %s", TD_VID(pVnode), tstrerror(terrno));
|
||||||
goto _err;
|
goto _err;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -115,24 +115,24 @@ int metaOpen(SVnode *pVnode, SMeta **ppMeta) {
|
||||||
// open pTtlIdx
|
// open pTtlIdx
|
||||||
ret = tdbTbOpen("ttl.idx", sizeof(STtlIdxKey), 0, ttlIdxKeyCmpr, pMeta->pEnv, &pMeta->pTtlIdx);
|
ret = tdbTbOpen("ttl.idx", sizeof(STtlIdxKey), 0, ttlIdxKeyCmpr, pMeta->pEnv, &pMeta->pTtlIdx);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
metaError("vgId:%d failed to open meta ttl index since %s", TD_VID(pVnode), tstrerror(terrno));
|
metaError("vgId:%d, failed to open meta ttl index since %s", TD_VID(pVnode), tstrerror(terrno));
|
||||||
goto _err;
|
goto _err;
|
||||||
}
|
}
|
||||||
|
|
||||||
// open pSmaIdx
|
// open pSmaIdx
|
||||||
ret = tdbTbOpen("sma.idx", sizeof(SSmaIdxKey), 0, smaIdxKeyCmpr, pMeta->pEnv, &pMeta->pSmaIdx);
|
ret = tdbTbOpen("sma.idx", sizeof(SSmaIdxKey), 0, smaIdxKeyCmpr, pMeta->pEnv, &pMeta->pSmaIdx);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
metaError("vgId:%d failed to open meta sma index since %s", TD_VID(pVnode), tstrerror(terrno));
|
metaError("vgId:%d, failed to open meta sma index since %s", TD_VID(pVnode), tstrerror(terrno));
|
||||||
goto _err;
|
goto _err;
|
||||||
}
|
}
|
||||||
|
|
||||||
// open index
|
// open index
|
||||||
if (metaOpenIdx(pMeta) < 0) {
|
if (metaOpenIdx(pMeta) < 0) {
|
||||||
metaError("vgId:%d failed to open meta index since %s", TD_VID(pVnode), tstrerror(terrno));
|
metaError("vgId:%d, failed to open meta index since %s", TD_VID(pVnode), tstrerror(terrno));
|
||||||
goto _err;
|
goto _err;
|
||||||
}
|
}
|
||||||
|
|
||||||
metaDebug("vgId:%d meta is opened", TD_VID(pVnode));
|
metaDebug("vgId:%d, meta is opened", TD_VID(pVnode));
|
||||||
|
|
||||||
*ppMeta = pMeta;
|
*ppMeta = pMeta;
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -425,7 +425,7 @@ STSmaWrapper *metaGetSmaInfoByTable(SMeta *pMeta, tb_uid_t uid, bool deepCopy) {
|
||||||
for (int i = 0; i < pSW->number; ++i) {
|
for (int i = 0; i < pSW->number; ++i) {
|
||||||
smaId = *(tb_uid_t *)taosArrayGet(pSmaIds, i);
|
smaId = *(tb_uid_t *)taosArrayGet(pSmaIds, i);
|
||||||
if (metaGetTableEntryByUid(&mr, smaId) < 0) {
|
if (metaGetTableEntryByUid(&mr, smaId) < 0) {
|
||||||
metaWarn("vgId:%d no entry for tbId: %" PRIi64 ", smaId: %" PRIi64, TD_VID(pMeta->pVnode), uid, smaId);
|
metaWarn("vgId:%d, no entry for tbId: %" PRIi64 ", smaId: %" PRIi64, TD_VID(pMeta->pVnode), uid, smaId);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
pTSma = pSW->tSma + smaIdx;
|
pTSma = pSW->tSma + smaIdx;
|
||||||
|
@ -473,7 +473,7 @@ STSma *metaGetSmaInfoByIndex(SMeta *pMeta, int64_t indexUid) {
|
||||||
SMetaReader mr = {0};
|
SMetaReader mr = {0};
|
||||||
metaReaderInit(&mr, pMeta, 0);
|
metaReaderInit(&mr, pMeta, 0);
|
||||||
if (metaGetTableEntryByUid(&mr, indexUid) < 0) {
|
if (metaGetTableEntryByUid(&mr, indexUid) < 0) {
|
||||||
metaWarn("vgId:%d failed to get table entry for smaId: %" PRIi64, TD_VID(pMeta->pVnode), indexUid);
|
metaWarn("vgId:%d, failed to get table entry for smaId: %" PRIi64, TD_VID(pMeta->pVnode), indexUid);
|
||||||
metaReaderClear(&mr);
|
metaReaderClear(&mr);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
|
@ -57,12 +57,12 @@ int32_t metaCreateTSma(SMeta *pMeta, int64_t version, SSmaCfg *pCfg) {
|
||||||
|
|
||||||
if (metaHandleSmaEntry(pMeta, &me) < 0) goto _err;
|
if (metaHandleSmaEntry(pMeta, &me) < 0) goto _err;
|
||||||
|
|
||||||
metaDebug("vgId:%d tsma is created, name:%s uid: %" PRId64, TD_VID(pMeta->pVnode), pCfg->indexName, pCfg->indexUid);
|
metaDebug("vgId:%d, tsma is created, name:%s uid: %" PRId64, TD_VID(pMeta->pVnode), pCfg->indexName, pCfg->indexUid);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
_err:
|
_err:
|
||||||
metaError("vgId:%d failed to create tsma: %s uid: %" PRId64 " since %s", TD_VID(pMeta->pVnode), pCfg->indexName,
|
metaError("vgId:%d, failed to create tsma: %s uid: %" PRId64 " since %s", TD_VID(pMeta->pVnode), pCfg->indexName,
|
||||||
pCfg->indexUid, tstrerror(terrno));
|
pCfg->indexUid, tstrerror(terrno));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -79,12 +79,12 @@ int metaCreateSTable(SMeta *pMeta, int64_t version, SVCreateStbReq *pReq) {
|
||||||
|
|
||||||
if (metaHandleEntry(pMeta, &me) < 0) goto _err;
|
if (metaHandleEntry(pMeta, &me) < 0) goto _err;
|
||||||
|
|
||||||
metaDebug("vgId:%d super table is created, name:%s uid: %" PRId64, TD_VID(pMeta->pVnode), pReq->name, pReq->suid);
|
metaDebug("vgId:%d, super table is created, name:%s uid: %" PRId64, TD_VID(pMeta->pVnode), pReq->name, pReq->suid);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
_err:
|
_err:
|
||||||
metaError("vgId:%d failed to create super table: %s uid: %" PRId64 " since %s", TD_VID(pMeta->pVnode), pReq->name,
|
metaError("vgId:%d, failed to create super table: %s uid: %" PRId64 " since %s", TD_VID(pMeta->pVnode), pReq->name,
|
||||||
pReq->suid, tstrerror(terrno));
|
pReq->suid, tstrerror(terrno));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@ -153,7 +153,7 @@ _drop_super_table:
|
||||||
_exit:
|
_exit:
|
||||||
tdbFree(pKey);
|
tdbFree(pKey);
|
||||||
tdbFree(pData);
|
tdbFree(pData);
|
||||||
metaDebug("vgId:%d super table %s uid:%" PRId64 " is dropped", TD_VID(pMeta->pVnode), pReq->name, pReq->suid);
|
metaDebug("vgId:%d, super table %s uid:%" PRId64 " is dropped", TD_VID(pMeta->pVnode), pReq->name, pReq->suid);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -269,12 +269,12 @@ int metaCreateTable(SMeta *pMeta, int64_t version, SVCreateTbReq *pReq) {
|
||||||
|
|
||||||
if (metaHandleEntry(pMeta, &me) < 0) goto _err;
|
if (metaHandleEntry(pMeta, &me) < 0) goto _err;
|
||||||
|
|
||||||
metaDebug("vgId:%d table %s uid %" PRId64 " is created, type:%" PRId8, TD_VID(pMeta->pVnode), pReq->name, pReq->uid,
|
metaDebug("vgId:%d, table %s uid %" PRId64 " is created, type:%" PRId8, TD_VID(pMeta->pVnode), pReq->name, pReq->uid,
|
||||||
pReq->type);
|
pReq->type);
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
_err:
|
_err:
|
||||||
metaError("vgId:%d failed to create table:%s type:%s since %s", TD_VID(pMeta->pVnode), pReq->name,
|
metaError("vgId:%d, failed to create table:%s type:%s since %s", TD_VID(pMeta->pVnode), pReq->name,
|
||||||
pReq->type == TSDB_CHILD_TABLE ? "child table" : "normal table", tstrerror(terrno));
|
pReq->type == TSDB_CHILD_TABLE ? "child table" : "normal table", tstrerror(terrno));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,7 +20,7 @@ int32_t tdProcessTSmaInsert(SSma* pSma, int64_t indexUid, const char* msg) {
|
||||||
int32_t code = TSDB_CODE_SUCCESS;
|
int32_t code = TSDB_CODE_SUCCESS;
|
||||||
|
|
||||||
if ((code = tdProcessTSmaInsertImpl(pSma, indexUid, msg)) < 0) {
|
if ((code = tdProcessTSmaInsertImpl(pSma, indexUid, msg)) < 0) {
|
||||||
smaWarn("vgId:%d insert tsma data failed since %s", SMA_VID(pSma), tstrerror(terrno));
|
smaWarn("vgId:%d, insert tsma data failed since %s", SMA_VID(pSma), tstrerror(terrno));
|
||||||
}
|
}
|
||||||
// TODO: destroy SSDataBlocks(msg)
|
// TODO: destroy SSDataBlocks(msg)
|
||||||
return code;
|
return code;
|
||||||
|
@ -30,7 +30,7 @@ int32_t tdProcessTSmaCreate(SSma* pSma, int64_t version, const char* msg) {
|
||||||
int32_t code = TSDB_CODE_SUCCESS;
|
int32_t code = TSDB_CODE_SUCCESS;
|
||||||
|
|
||||||
if ((code = tdProcessTSmaCreateImpl(pSma, version, msg)) < 0) {
|
if ((code = tdProcessTSmaCreateImpl(pSma, version, msg)) < 0) {
|
||||||
smaWarn("vgId:%d create tsma failed since %s", SMA_VID(pSma), tstrerror(terrno));
|
smaWarn("vgId:%d, create tsma failed since %s", SMA_VID(pSma), tstrerror(terrno));
|
||||||
}
|
}
|
||||||
// TODO: destroy SSDataBlocks(msg)
|
// TODO: destroy SSDataBlocks(msg)
|
||||||
return code;
|
return code;
|
||||||
|
@ -39,7 +39,7 @@ int32_t tdProcessTSmaCreate(SSma* pSma, int64_t version, const char* msg) {
|
||||||
int32_t tdUpdateExpireWindow(SSma* pSma, const SSubmitReq* pMsg, int64_t version) {
|
int32_t tdUpdateExpireWindow(SSma* pSma, const SSubmitReq* pMsg, int64_t version) {
|
||||||
int32_t code = TSDB_CODE_SUCCESS;
|
int32_t code = TSDB_CODE_SUCCESS;
|
||||||
if ((code = tdUpdateExpiredWindowImpl(pSma, pMsg, version)) < 0) {
|
if ((code = tdUpdateExpiredWindowImpl(pSma, pMsg, version)) < 0) {
|
||||||
smaWarn("vgId:%d update expired sma window failed since %s", SMA_VID(pSma), tstrerror(terrno));
|
smaWarn("vgId:%d, update expired sma window failed since %s", SMA_VID(pSma), tstrerror(terrno));
|
||||||
}
|
}
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
@ -47,7 +47,7 @@ int32_t tdUpdateExpireWindow(SSma* pSma, const SSubmitReq* pMsg, int64_t version
|
||||||
int32_t tdGetTSmaData(SSma* pSma, char* pData, int64_t indexUid, TSKEY querySKey, int32_t nMaxResult) {
|
int32_t tdGetTSmaData(SSma* pSma, char* pData, int64_t indexUid, TSKEY querySKey, int32_t nMaxResult) {
|
||||||
int32_t code = TSDB_CODE_SUCCESS;
|
int32_t code = TSDB_CODE_SUCCESS;
|
||||||
if ((code = tdGetTSmaDataImpl(pSma, pData, indexUid, querySKey, nMaxResult)) < 0) {
|
if ((code = tdGetTSmaDataImpl(pSma, pData, indexUid, querySKey, nMaxResult)) < 0) {
|
||||||
smaWarn("vgId:%d get tSma data failed since %s", SMA_VID(pSma), tstrerror(terrno));
|
smaWarn("vgId:%d, get tSma data failed since %s", SMA_VID(pSma), tstrerror(terrno));
|
||||||
}
|
}
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
|
|
@ -222,7 +222,7 @@ int32_t tdRefSmaStat(SSma *pSma, SSmaStat *pStat) {
|
||||||
if (!pStat) return 0;
|
if (!pStat) return 0;
|
||||||
|
|
||||||
int ref = T_REF_INC(pStat);
|
int ref = T_REF_INC(pStat);
|
||||||
smaDebug("vgId:%d ref sma stat:%p, val:%d", SMA_VID(pSma), pStat, ref);
|
smaDebug("vgId:%d, ref sma stat:%p, val:%d", SMA_VID(pSma), pStat, ref);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -230,7 +230,7 @@ int32_t tdUnRefSmaStat(SSma *pSma, SSmaStat *pStat) {
|
||||||
if (!pStat) return 0;
|
if (!pStat) return 0;
|
||||||
|
|
||||||
int ref = T_REF_DEC(pStat);
|
int ref = T_REF_DEC(pStat);
|
||||||
smaDebug("vgId:%d unref sma stat:%p, val:%d", SMA_VID(pSma), pStat, ref);
|
smaDebug("vgId:%d, unref sma stat:%p, val:%d", SMA_VID(pSma), pStat, ref);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -321,7 +321,7 @@ int32_t tdDestroySmaState(SSmaStat *pSmaStat, int8_t smaType) {
|
||||||
int32_t tdLockSma(SSma *pSma) {
|
int32_t tdLockSma(SSma *pSma) {
|
||||||
int code = taosThreadMutexLock(&pSma->mutex);
|
int code = taosThreadMutexLock(&pSma->mutex);
|
||||||
if (code != 0) {
|
if (code != 0) {
|
||||||
smaError("vgId:%d failed to lock td since %s", SMA_VID(pSma), strerror(errno));
|
smaError("vgId:%d, failed to lock td since %s", SMA_VID(pSma), strerror(errno));
|
||||||
terrno = TAOS_SYSTEM_ERROR(code);
|
terrno = TAOS_SYSTEM_ERROR(code);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@ -334,7 +334,7 @@ int32_t tdUnLockSma(SSma *pSma) {
|
||||||
pSma->locked = false;
|
pSma->locked = false;
|
||||||
int code = taosThreadMutexUnlock(&pSma->mutex);
|
int code = taosThreadMutexUnlock(&pSma->mutex);
|
||||||
if (code != 0) {
|
if (code != 0) {
|
||||||
smaError("vgId:%d failed to unlock td since %s", SMA_VID(pSma), strerror(errno));
|
smaError("vgId:%d, failed to unlock td since %s", SMA_VID(pSma), strerror(errno));
|
||||||
terrno = TAOS_SYSTEM_ERROR(code);
|
terrno = TAOS_SYSTEM_ERROR(code);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@ -376,7 +376,7 @@ int32_t tdCheckAndInitSmaEnv(SSma *pSma, int8_t smaType) {
|
||||||
|
|
||||||
if (did.level < 0 || did.id < 0) {
|
if (did.level < 0 || did.id < 0) {
|
||||||
tdUnLockSma(pSma);
|
tdUnLockSma(pSma);
|
||||||
smaError("vgId:%d init sma env failed since invalid did(%d,%d)", SMA_VID(pSma), did.level, did.id);
|
smaError("vgId:%d, init sma env failed since invalid did(%d,%d)", SMA_VID(pSma), did.level, did.id);
|
||||||
return TSDB_CODE_FAILED;
|
return TSDB_CODE_FAILED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -58,30 +58,30 @@ static FORCE_INLINE int32_t tdUpdateTbUidListImpl(SSma *pSma, tb_uid_t *suid, SA
|
||||||
|
|
||||||
if (!suid || !tbUids) {
|
if (!suid || !tbUids) {
|
||||||
terrno = TSDB_CODE_INVALID_PTR;
|
terrno = TSDB_CODE_INVALID_PTR;
|
||||||
smaError("vgId:%d failed to get rsma info for uid:%" PRIi64 " since %s", SMA_VID(pSma), *suid, terrstr(terrno));
|
smaError("vgId:%d, failed to get rsma info for uid:%" PRIi64 " since %s", SMA_VID(pSma), *suid, terrstr(terrno));
|
||||||
return TSDB_CODE_FAILED;
|
return TSDB_CODE_FAILED;
|
||||||
}
|
}
|
||||||
|
|
||||||
pRSmaInfo = taosHashGet(SMA_STAT_INFO_HASH(pStat), suid, sizeof(tb_uid_t));
|
pRSmaInfo = taosHashGet(SMA_STAT_INFO_HASH(pStat), suid, sizeof(tb_uid_t));
|
||||||
if (!pRSmaInfo || !(pRSmaInfo = *(SRSmaInfo **)pRSmaInfo)) {
|
if (!pRSmaInfo || !(pRSmaInfo = *(SRSmaInfo **)pRSmaInfo)) {
|
||||||
smaError("vgId:%d failed to get rsma info for uid:%" PRIi64, SMA_VID(pSma), *suid);
|
smaError("vgId:%d, failed to get rsma info for uid:%" PRIi64, SMA_VID(pSma), *suid);
|
||||||
terrno = TSDB_CODE_TDB_INVALID_SMA_STAT;
|
terrno = TSDB_CODE_TDB_INVALID_SMA_STAT;
|
||||||
return TSDB_CODE_FAILED;
|
return TSDB_CODE_FAILED;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pRSmaInfo->taskInfo[0] && (qUpdateQualifiedTableId(pRSmaInfo->taskInfo[0], tbUids, true) != 0)) {
|
if (pRSmaInfo->taskInfo[0] && (qUpdateQualifiedTableId(pRSmaInfo->taskInfo[0], tbUids, true) != 0)) {
|
||||||
smaError("vgId:%d update tbUidList failed for uid:%" PRIi64 " since %s", SMA_VID(pSma), *suid, terrstr(terrno));
|
smaError("vgId:%d, update tbUidList failed for uid:%" PRIi64 " since %s", SMA_VID(pSma), *suid, terrstr(terrno));
|
||||||
return TSDB_CODE_FAILED;
|
return TSDB_CODE_FAILED;
|
||||||
} else {
|
} else {
|
||||||
smaDebug("vgId:%d update tbUidList succeed for qTaskInfo:%p with suid:%" PRIi64 ", uid:%" PRIi64, SMA_VID(pSma),
|
smaDebug("vgId:%d, update tbUidList succeed for qTaskInfo:%p with suid:%" PRIi64 ", uid:%" PRIi64, SMA_VID(pSma),
|
||||||
pRSmaInfo->taskInfo[0], *suid, *(int64_t *)taosArrayGet(tbUids, 0));
|
pRSmaInfo->taskInfo[0], *suid, *(int64_t *)taosArrayGet(tbUids, 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pRSmaInfo->taskInfo[1] && (qUpdateQualifiedTableId(pRSmaInfo->taskInfo[1], tbUids, true) != 0)) {
|
if (pRSmaInfo->taskInfo[1] && (qUpdateQualifiedTableId(pRSmaInfo->taskInfo[1], tbUids, true) != 0)) {
|
||||||
smaError("vgId:%d update tbUidList failed for uid:%" PRIi64 " since %s", SMA_VID(pSma), *suid, terrstr(terrno));
|
smaError("vgId:%d, update tbUidList failed for uid:%" PRIi64 " since %s", SMA_VID(pSma), *suid, terrstr(terrno));
|
||||||
return TSDB_CODE_FAILED;
|
return TSDB_CODE_FAILED;
|
||||||
} else {
|
} else {
|
||||||
smaDebug("vgId:%d update tbUidList succeed for qTaskInfo:%p with suid:%" PRIi64 ", uid:%" PRIi64, SMA_VID(pSma),
|
smaDebug("vgId:%d, update tbUidList succeed for qTaskInfo:%p with suid:%" PRIi64 ", uid:%" PRIi64, SMA_VID(pSma),
|
||||||
pRSmaInfo->taskInfo[1], *suid, *(int64_t *)taosArrayGet(tbUids, 0));
|
pRSmaInfo->taskInfo[1], *suid, *(int64_t *)taosArrayGet(tbUids, 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -170,14 +170,14 @@ int32_t tdProcessRSmaCreate(SVnode *pVnode, SVCreateStbReq *pReq) {
|
||||||
SMeta *pMeta = pVnode->pMeta;
|
SMeta *pMeta = pVnode->pMeta;
|
||||||
SMsgCb *pMsgCb = &pVnode->msgCb;
|
SMsgCb *pMsgCb = &pVnode->msgCb;
|
||||||
if (!pReq->rollup) {
|
if (!pReq->rollup) {
|
||||||
smaTrace("vgId:%d return directly since no rollup for stable %s %" PRIi64, SMA_VID(pSma), pReq->name, pReq->suid);
|
smaTrace("vgId:%d, return directly since no rollup for stable %s %" PRIi64, SMA_VID(pSma), pReq->name, pReq->suid);
|
||||||
return TSDB_CODE_SUCCESS;
|
return TSDB_CODE_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
SRSmaParam *param = &pReq->pRSmaParam;
|
SRSmaParam *param = &pReq->pRSmaParam;
|
||||||
|
|
||||||
if ((param->qmsg1Len == 0) && (param->qmsg2Len == 0)) {
|
if ((param->qmsg1Len == 0) && (param->qmsg2Len == 0)) {
|
||||||
smaWarn("vgId:%d no qmsg1/qmsg2 for rollup stable %s %" PRIi64, SMA_VID(pSma), pReq->name, pReq->suid);
|
smaWarn("vgId:%d, no qmsg1/qmsg2 for rollup stable %s %" PRIi64, SMA_VID(pSma), pReq->name, pReq->suid);
|
||||||
return TSDB_CODE_SUCCESS;
|
return TSDB_CODE_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -192,7 +192,7 @@ int32_t tdProcessRSmaCreate(SVnode *pVnode, SVCreateStbReq *pReq) {
|
||||||
|
|
||||||
pRSmaInfo = taosHashGet(SMA_STAT_INFO_HASH(pStat), &pReq->suid, sizeof(tb_uid_t));
|
pRSmaInfo = taosHashGet(SMA_STAT_INFO_HASH(pStat), &pReq->suid, sizeof(tb_uid_t));
|
||||||
if (pRSmaInfo) {
|
if (pRSmaInfo) {
|
||||||
smaWarn("vgId:%d rsma info already exists for stb: %s, %" PRIi64, SMA_VID(pSma), pReq->name, pReq->suid);
|
smaWarn("vgId:%d, rsma info already exists for stb: %s, %" PRIi64, SMA_VID(pSma), pReq->name, pReq->suid);
|
||||||
return TSDB_CODE_SUCCESS;
|
return TSDB_CODE_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -238,7 +238,7 @@ int32_t tdProcessRSmaCreate(SVnode *pVnode, SVCreateStbReq *pReq) {
|
||||||
TSDB_CODE_SUCCESS) {
|
TSDB_CODE_SUCCESS) {
|
||||||
return TSDB_CODE_FAILED;
|
return TSDB_CODE_FAILED;
|
||||||
} else {
|
} else {
|
||||||
smaDebug("vgId:%d register rsma info succeed for suid:%" PRIi64, SMA_VID(pSma), pReq->suid);
|
smaDebug("vgId:%d, register rsma info succeed for suid:%" PRIi64, SMA_VID(pSma), pReq->suid);
|
||||||
}
|
}
|
||||||
|
|
||||||
return TSDB_CODE_SUCCESS;
|
return TSDB_CODE_SUCCESS;
|
||||||
|
@ -372,11 +372,11 @@ static FORCE_INLINE int32_t tdExecuteRSmaImpl(SSma *pSma, const void *pMsg, int3
|
||||||
SArray *pResult = NULL;
|
SArray *pResult = NULL;
|
||||||
|
|
||||||
if (!taskInfo) {
|
if (!taskInfo) {
|
||||||
smaDebug("vgId:%d no qTaskInfo to execute rsma %" PRIi8 " task for suid:%" PRIu64, SMA_VID(pSma), level, suid);
|
smaDebug("vgId:%d, no qTaskInfo to execute rsma %" PRIi8 " task for suid:%" PRIu64, SMA_VID(pSma), level, suid);
|
||||||
return TSDB_CODE_SUCCESS;
|
return TSDB_CODE_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
smaDebug("vgId:%d execute rsma %" PRIi8 " task for qTaskInfo:%p suid:%" PRIu64, SMA_VID(pSma), level, taskInfo, suid);
|
smaDebug("vgId:%d, execute rsma %" PRIi8 " task for qTaskInfo:%p suid:%" PRIu64, SMA_VID(pSma), level, taskInfo, suid);
|
||||||
|
|
||||||
qSetStreamInput(taskInfo, pMsg, inputType, true);
|
qSetStreamInput(taskInfo, pMsg, inputType, true);
|
||||||
while (1) {
|
while (1) {
|
||||||
|
@ -414,7 +414,7 @@ static FORCE_INLINE int32_t tdExecuteRSmaImpl(SSma *pSma, const void *pMsg, int3
|
||||||
}
|
}
|
||||||
taosMemoryFreeClear(pReq);
|
taosMemoryFreeClear(pReq);
|
||||||
} else {
|
} else {
|
||||||
smaDebug("vgId:%d no rsma % " PRIi8 " data generated since %s", SMA_VID(pSma), level, tstrerror(terrno));
|
smaDebug("vgId:%d, no rsma % " PRIi8 " data generated since %s", SMA_VID(pSma), level, tstrerror(terrno));
|
||||||
}
|
}
|
||||||
|
|
||||||
taosArrayDestroy(pResult);
|
taosArrayDestroy(pResult);
|
||||||
|
@ -435,11 +435,11 @@ static int32_t tdExecuteRSma(SSma *pSma, const void *pMsg, int32_t inputType, tb
|
||||||
pRSmaInfo = taosHashGet(SMA_STAT_INFO_HASH(pStat), &suid, sizeof(tb_uid_t));
|
pRSmaInfo = taosHashGet(SMA_STAT_INFO_HASH(pStat), &suid, sizeof(tb_uid_t));
|
||||||
|
|
||||||
if (!pRSmaInfo || !(pRSmaInfo = *(SRSmaInfo **)pRSmaInfo)) {
|
if (!pRSmaInfo || !(pRSmaInfo = *(SRSmaInfo **)pRSmaInfo)) {
|
||||||
smaDebug("vgId:%d no rsma info for suid:%" PRIu64, SMA_VID(pSma), suid);
|
smaDebug("vgId:%d, no rsma info for suid:%" PRIu64, SMA_VID(pSma), suid);
|
||||||
return TSDB_CODE_SUCCESS;
|
return TSDB_CODE_SUCCESS;
|
||||||
}
|
}
|
||||||
if (!pRSmaInfo->taskInfo[0]) {
|
if (!pRSmaInfo->taskInfo[0]) {
|
||||||
smaDebug("vgId:%d no rsma qTaskInfo for suid:%" PRIu64, SMA_VID(pSma), suid);
|
smaDebug("vgId:%d, no rsma qTaskInfo for suid:%" PRIu64, SMA_VID(pSma), suid);
|
||||||
return TSDB_CODE_SUCCESS;
|
return TSDB_CODE_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -326,13 +326,13 @@ int32_t tdProcessTSmaInsertImpl(SSma *pSma, int64_t indexUid, const char *msg) {
|
||||||
|
|
||||||
if (!pDataBlocks) {
|
if (!pDataBlocks) {
|
||||||
terrno = TSDB_CODE_INVALID_PTR;
|
terrno = TSDB_CODE_INVALID_PTR;
|
||||||
smaWarn("vgId:%d insert tSma data failed since pDataBlocks is NULL", SMA_VID(pSma));
|
smaWarn("vgId:%d, insert tSma data failed since pDataBlocks is NULL", SMA_VID(pSma));
|
||||||
return terrno;
|
return terrno;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (taosArrayGetSize(pDataBlocks) <= 0) {
|
if (taosArrayGetSize(pDataBlocks) <= 0) {
|
||||||
terrno = TSDB_CODE_INVALID_PARA;
|
terrno = TSDB_CODE_INVALID_PARA;
|
||||||
smaWarn("vgId:%d insert tSma data failed since pDataBlocks is empty", SMA_VID(pSma));
|
smaWarn("vgId:%d, insert tSma data failed since pDataBlocks is empty", SMA_VID(pSma));
|
||||||
return TSDB_CODE_FAILED;
|
return TSDB_CODE_FAILED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -487,11 +487,11 @@ int32_t tdProcessTSmaInsertImpl(SSma *pSma, int64_t indexUid, const char *msg) {
|
||||||
smaCloseDBF(&tSmaH.dFile);
|
smaCloseDBF(&tSmaH.dFile);
|
||||||
}
|
}
|
||||||
tdSetTSmaDataFile(&tSmaH, indexUid, fid);
|
tdSetTSmaDataFile(&tSmaH, indexUid, fid);
|
||||||
smaDebug("@@@ vgId:%d write to DBF %s, days:%d, interval:%" PRIi64 ", storageLevel:%" PRIi32
|
smaDebug("vgId:%d, write to DBF %s, days:%d, interval:%" PRIi64 ", storageLevel:%" PRIi32
|
||||||
" queryKey:%" PRIi64,
|
" queryKey:%" PRIi64,
|
||||||
SMA_VID(pSma), tSmaH.dFile.path, minutePerFile, tSmaH.interval, storageLevel, testSkey);
|
SMA_VID(pSma), tSmaH.dFile.path, minutePerFile, tSmaH.interval, storageLevel, testSkey);
|
||||||
if (smaOpenDBF(pEnv->dbEnv, &tSmaH.dFile) != 0) {
|
if (smaOpenDBF(pEnv->dbEnv, &tSmaH.dFile) != 0) {
|
||||||
smaWarn("vgId:%d open DB file %s failed since %s", SMA_VID(pSma),
|
smaWarn("vgId:%d, open DB file %s failed since %s", SMA_VID(pSma),
|
||||||
tSmaH.dFile.path ? tSmaH.dFile.path : "path is NULL", tstrerror(terrno));
|
tSmaH.dFile.path ? tSmaH.dFile.path : "path is NULL", tstrerror(terrno));
|
||||||
tdDestroyTSmaWriteH(&tSmaH);
|
tdDestroyTSmaWriteH(&tSmaH);
|
||||||
tdUnRefSmaStat(pSma, pStat);
|
tdUnRefSmaStat(pSma, pStat);
|
||||||
|
@ -501,7 +501,7 @@ int32_t tdProcessTSmaInsertImpl(SSma *pSma, int64_t indexUid, const char *msg) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tdInsertTSmaBlocks(&tSmaH, &smaKey, SMA_KEY_LEN, dataBuf, tlen, &pEnv->txn) != 0) {
|
if (tdInsertTSmaBlocks(&tSmaH, &smaKey, SMA_KEY_LEN, dataBuf, tlen, &pEnv->txn) != 0) {
|
||||||
smaWarn("vgId:%d insert tsma data blocks fail for index %" PRIi64 ", skey %" PRIi64 ", groupId %" PRIi64
|
smaWarn("vgId:%d, insert tsma data blocks fail for index %" PRIi64 ", skey %" PRIi64 ", groupId %" PRIi64
|
||||||
" since %s",
|
" since %s",
|
||||||
SMA_VID(pSma), indexUid, skey, groupId, tstrerror(terrno));
|
SMA_VID(pSma), indexUid, skey, groupId, tstrerror(terrno));
|
||||||
tdSmaEndCommit(pEnv);
|
tdSmaEndCommit(pEnv);
|
||||||
|
@ -510,14 +510,14 @@ int32_t tdProcessTSmaInsertImpl(SSma *pSma, int64_t indexUid, const char *msg) {
|
||||||
return TSDB_CODE_FAILED;
|
return TSDB_CODE_FAILED;
|
||||||
}
|
}
|
||||||
|
|
||||||
smaDebug("vgId:%d insert tsma data blocks success for index %" PRIi64 ", skey %" PRIi64 ", groupId %" PRIi64,
|
smaDebug("vgId:%d, insert tsma data blocks success for index %" PRIi64 ", skey %" PRIi64 ", groupId %" PRIi64,
|
||||||
SMA_VID(pSma), indexUid, skey, groupId);
|
SMA_VID(pSma), indexUid, skey, groupId);
|
||||||
// TODO:tsdbEndTSmaCommit();
|
// TODO:tsdbEndTSmaCommit();
|
||||||
|
|
||||||
// Step 3: reset the SSmaStat
|
// Step 3: reset the SSmaStat
|
||||||
tdResetExpiredWindow(pSma, pStat, indexUid, skey);
|
tdResetExpiredWindow(pSma, pStat, indexUid, skey);
|
||||||
} else {
|
} else {
|
||||||
smaWarn("vgId:%d invalid data skey:%" PRIi64 ", tlen %" PRIi32 " during insert tSma data for %" PRIi64,
|
smaWarn("vgId:%d, invalid data skey:%" PRIi64 ", tlen %" PRIi32 " during insert tSma data for %" PRIi64,
|
||||||
SMA_VID(pSma), skey, tlen, indexUid);
|
SMA_VID(pSma), skey, tlen, indexUid);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -532,7 +532,7 @@ int32_t tdProcessTSmaInsertImpl(SSma *pSma, int64_t indexUid, const char *msg) {
|
||||||
int32_t tdDropTSmaData(SSma *pSma, int64_t indexUid) {
|
int32_t tdDropTSmaData(SSma *pSma, int64_t indexUid) {
|
||||||
int32_t code = TSDB_CODE_SUCCESS;
|
int32_t code = TSDB_CODE_SUCCESS;
|
||||||
if ((code = tdDropTSmaDataImpl(pSma, indexUid)) < 0) {
|
if ((code = tdDropTSmaDataImpl(pSma, indexUid)) < 0) {
|
||||||
smaWarn("vgId:%d drop tSma data failed since %s", SMA_VID(pSma), tstrerror(terrno));
|
smaWarn("vgId:%d, drop tSma data failed since %s", SMA_VID(pSma), tstrerror(terrno));
|
||||||
}
|
}
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
@ -553,11 +553,11 @@ static int32_t tdInsertTSmaBlocks(STSmaWriteH *pSmaH, void *smaKey, int32_t keyL
|
||||||
|
|
||||||
// TODO: insert tsma data blocks into B+Tree(TTB)
|
// TODO: insert tsma data blocks into B+Tree(TTB)
|
||||||
if (smaSaveSmaToDB(pDBFile, smaKey, keyLen, pData, dataLen, txn) != 0) {
|
if (smaSaveSmaToDB(pDBFile, smaKey, keyLen, pData, dataLen, txn) != 0) {
|
||||||
smaWarn("vgId:%d insert tsma data blocks into %s: smaKey %" PRIx64 "-%" PRIx64 ", dataLen %" PRIu32 " fail",
|
smaWarn("vgId:%d, insert tsma data blocks into %s: smaKey %" PRIx64 "-%" PRIx64 ", dataLen %" PRIu32 " fail",
|
||||||
SMA_VID(pSmaH->pSma), pDBFile->path, *(int64_t *)smaKey, *(int64_t *)POINTER_SHIFT(smaKey, 8), dataLen);
|
SMA_VID(pSmaH->pSma), pDBFile->path, *(int64_t *)smaKey, *(int64_t *)POINTER_SHIFT(smaKey, 8), dataLen);
|
||||||
return TSDB_CODE_FAILED;
|
return TSDB_CODE_FAILED;
|
||||||
}
|
}
|
||||||
smaDebug("vgId:%d insert tsma data blocks into %s: smaKey %" PRIx64 "-%" PRIx64 ", dataLen %" PRIu32 " succeed",
|
smaDebug("vgId:%d, insert tsma data blocks into %s: smaKey %" PRIx64 "-%" PRIx64 ", dataLen %" PRIu32 " succeed",
|
||||||
SMA_VID(pSmaH->pSma), pDBFile->path, *(int64_t *)smaKey, *(int64_t *)POINTER_SHIFT(smaKey, 8), dataLen);
|
SMA_VID(pSmaH->pSma), pDBFile->path, *(int64_t *)smaKey, *(int64_t *)POINTER_SHIFT(smaKey, 8), dataLen);
|
||||||
|
|
||||||
#ifdef _TEST_SMA_PRINT_DEBUG_LOG_
|
#ifdef _TEST_SMA_PRINT_DEBUG_LOG_
|
||||||
|
@ -565,7 +565,7 @@ static int32_t tdInsertTSmaBlocks(STSmaWriteH *pSmaH, void *smaKey, int32_t keyL
|
||||||
void *data = tdGetSmaDataByKey(pDBFile, smaKey, keyLen, &valueSize);
|
void *data = tdGetSmaDataByKey(pDBFile, smaKey, keyLen, &valueSize);
|
||||||
ASSERT(data != NULL);
|
ASSERT(data != NULL);
|
||||||
for (uint32_t v = 0; v < valueSize; v += 8) {
|
for (uint32_t v = 0; v < valueSize; v += 8) {
|
||||||
smaWarn("vgId:%d insert sma data val[%d] %" PRIi64, REPO_ID(pSmaH->pTsdb), v, *(int64_t *)POINTER_SHIFT(data, v));
|
smaWarn("vgId:%d, insert sma data val[%d] %" PRIi64, REPO_ID(pSmaH->pTsdb), v, *(int64_t *)POINTER_SHIFT(data, v));
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
return TSDB_CODE_SUCCESS;
|
return TSDB_CODE_SUCCESS;
|
||||||
|
@ -594,11 +594,11 @@ static int32_t tdResetExpiredWindow(SSma *pSma, SSmaStat *pStat, int64_t indexUi
|
||||||
if (taosHashRemove(pItem->expiredWindows, &skey, sizeof(TSKEY)) != 0) {
|
if (taosHashRemove(pItem->expiredWindows, &skey, sizeof(TSKEY)) != 0) {
|
||||||
// error handling
|
// error handling
|
||||||
tdUnRefSmaStat(pSma, pStat);
|
tdUnRefSmaStat(pSma, pStat);
|
||||||
smaWarn("vgId:%d remove skey %" PRIi64 " from expired window for sma index %" PRIi64 " fail", SMA_VID(pSma), skey,
|
smaWarn("vgId:%d, remove skey %" PRIi64 " from expired window for sma index %" PRIi64 " fail", SMA_VID(pSma), skey,
|
||||||
indexUid);
|
indexUid);
|
||||||
return TSDB_CODE_FAILED;
|
return TSDB_CODE_FAILED;
|
||||||
}
|
}
|
||||||
smaDebug("vgId:%d remove skey %" PRIi64 " from expired window for sma index %" PRIi64 " succeed", SMA_VID(pSma),
|
smaDebug("vgId:%d, remove skey %" PRIi64 " from expired window for sma index %" PRIi64 " succeed", SMA_VID(pSma),
|
||||||
skey, indexUid);
|
skey, indexUid);
|
||||||
// TODO: use a standalone interface to received state upate notification from stream computing module.
|
// TODO: use a standalone interface to received state upate notification from stream computing module.
|
||||||
/**
|
/**
|
||||||
|
@ -612,7 +612,7 @@ static int32_t tdResetExpiredWindow(SSma *pSma, SSmaStat *pStat, int64_t indexUi
|
||||||
} else {
|
} else {
|
||||||
// error handling
|
// error handling
|
||||||
tdUnRefSmaStat(pSma, pStat);
|
tdUnRefSmaStat(pSma, pStat);
|
||||||
smaWarn("vgId:%d expired window %" PRIi64 " not exists for sma index %" PRIi64, SMA_VID(pSma), skey, indexUid);
|
smaWarn("vgId:%d, expired window %" PRIi64 " not exists for sma index %" PRIi64, SMA_VID(pSma), skey, indexUid);
|
||||||
return TSDB_CODE_FAILED;
|
return TSDB_CODE_FAILED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -632,19 +632,19 @@ static int32_t tdDropTSmaDataImpl(SSma *pSma, int64_t indexUid) {
|
||||||
|
|
||||||
// clear local cache
|
// clear local cache
|
||||||
if (pEnv) {
|
if (pEnv) {
|
||||||
smaDebug("vgId:%d drop tSma local cache for %" PRIi64, SMA_VID(pSma), indexUid);
|
smaDebug("vgId:%d, drop tSma local cache for %" PRIi64, SMA_VID(pSma), indexUid);
|
||||||
|
|
||||||
SSmaStatItem *pItem = taosHashGet(SMA_ENV_STAT_ITEMS(pEnv), &indexUid, sizeof(indexUid));
|
SSmaStatItem *pItem = taosHashGet(SMA_ENV_STAT_ITEMS(pEnv), &indexUid, sizeof(indexUid));
|
||||||
if ((pItem) || ((pItem = *(SSmaStatItem **)pItem))) {
|
if ((pItem) || ((pItem = *(SSmaStatItem **)pItem))) {
|
||||||
if (tdSmaStatIsDropped(pItem)) {
|
if (tdSmaStatIsDropped(pItem)) {
|
||||||
smaDebug("vgId:%d tSma stat is already dropped for %" PRIi64, SMA_VID(pSma), indexUid);
|
smaDebug("vgId:%d, tSma stat is already dropped for %" PRIi64, SMA_VID(pSma), indexUid);
|
||||||
return TSDB_CODE_TDB_INVALID_ACTION; // TODO: duplicate drop msg would be intercepted by mnode
|
return TSDB_CODE_TDB_INVALID_ACTION; // TODO: duplicate drop msg would be intercepted by mnode
|
||||||
}
|
}
|
||||||
|
|
||||||
tdWLockSmaEnv(pEnv);
|
tdWLockSmaEnv(pEnv);
|
||||||
if (tdSmaStatIsDropped(pItem)) {
|
if (tdSmaStatIsDropped(pItem)) {
|
||||||
tdUnLockSmaEnv(pEnv);
|
tdUnLockSmaEnv(pEnv);
|
||||||
smaDebug("vgId:%d tSma stat is already dropped for %" PRIi64, SMA_VID(pSma), indexUid);
|
smaDebug("vgId:%d, tSma stat is already dropped for %" PRIi64, SMA_VID(pSma), indexUid);
|
||||||
return TSDB_CODE_TDB_INVALID_ACTION; // TODO: duplicate drop msg would be intercepted by mnode
|
return TSDB_CODE_TDB_INVALID_ACTION; // TODO: duplicate drop msg would be intercepted by mnode
|
||||||
}
|
}
|
||||||
tdSmaStatSetDropped(pItem);
|
tdSmaStatSetDropped(pItem);
|
||||||
|
@ -654,19 +654,19 @@ static int32_t tdDropTSmaDataImpl(SSma *pSma, int64_t indexUid) {
|
||||||
int32_t refVal = INT32_MAX;
|
int32_t refVal = INT32_MAX;
|
||||||
while (true) {
|
while (true) {
|
||||||
if ((refVal = T_REF_VAL_GET(SMA_ENV_STAT(pEnv))) <= 0) {
|
if ((refVal = T_REF_VAL_GET(SMA_ENV_STAT(pEnv))) <= 0) {
|
||||||
smaDebug("vgId:%d drop index %" PRIi64 " since refVal=%d", SMA_VID(pSma), indexUid, refVal);
|
smaDebug("vgId:%d, drop index %" PRIi64 " since refVal=%d", SMA_VID(pSma), indexUid, refVal);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
smaDebug("vgId:%d wait 1s to drop index %" PRIi64 " since refVal=%d", SMA_VID(pSma), indexUid, refVal);
|
smaDebug("vgId:%d, wait 1s to drop index %" PRIi64 " since refVal=%d", SMA_VID(pSma), indexUid, refVal);
|
||||||
taosSsleep(1);
|
taosSsleep(1);
|
||||||
if (++nSleep > SMA_DROP_EXPIRED_TIME) {
|
if (++nSleep > SMA_DROP_EXPIRED_TIME) {
|
||||||
smaDebug("vgId:%d drop index %" PRIi64 " after wait %d (refVal=%d)", SMA_VID(pSma), indexUid, nSleep, refVal);
|
smaDebug("vgId:%d, drop index %" PRIi64 " after wait %d (refVal=%d)", SMA_VID(pSma), indexUid, nSleep, refVal);
|
||||||
break;
|
break;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
tdFreeSmaStatItem(pItem);
|
tdFreeSmaStatItem(pItem);
|
||||||
smaDebug("vgId:%d getTSmaDataImpl failed since no index %" PRIi64 " in local cache", SMA_VID(pSma), indexUid);
|
smaDebug("vgId:%d, getTSmaDataImpl failed since no index %" PRIi64 " in local cache", SMA_VID(pSma), indexUid);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// clear sma data files
|
// clear sma data files
|
||||||
|
@ -690,7 +690,7 @@ int32_t tdGetTSmaDataImpl(SSma *pSma, char *pData, int64_t indexUid, TSKEY query
|
||||||
|
|
||||||
if (!pEnv) {
|
if (!pEnv) {
|
||||||
terrno = TSDB_CODE_INVALID_PTR;
|
terrno = TSDB_CODE_INVALID_PTR;
|
||||||
smaWarn("vgId:%d getTSmaDataImpl failed since pTSmaEnv is NULL", SMA_VID(pSma));
|
smaWarn("vgId:%d, getTSmaDataImpl failed since pTSmaEnv is NULL", SMA_VID(pSma));
|
||||||
return TSDB_CODE_FAILED;
|
return TSDB_CODE_FAILED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -703,7 +703,7 @@ int32_t tdGetTSmaDataImpl(SSma *pSma, char *pData, int64_t indexUid, TSKEY query
|
||||||
// it's NULL.
|
// it's NULL.
|
||||||
tdUnRefSmaStat(pSma, pStat);
|
tdUnRefSmaStat(pSma, pStat);
|
||||||
terrno = TSDB_CODE_TDB_INVALID_ACTION;
|
terrno = TSDB_CODE_TDB_INVALID_ACTION;
|
||||||
smaDebug("vgId:%d getTSmaDataImpl failed since no index %" PRIi64, SMA_VID(pSma), indexUid);
|
smaDebug("vgId:%d, getTSmaDataImpl failed since no index %" PRIi64, SMA_VID(pSma), indexUid);
|
||||||
return TSDB_CODE_FAILED;
|
return TSDB_CODE_FAILED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -722,17 +722,17 @@ int32_t tdGetTSmaDataImpl(SSma *pSma, char *pData, int64_t indexUid, TSKEY query
|
||||||
if (!tdSmaStatIsOK(pItem, &smaStat)) { // TODO: multiple check for large scale sma query
|
if (!tdSmaStatIsOK(pItem, &smaStat)) { // TODO: multiple check for large scale sma query
|
||||||
tdUnRefSmaStat(pSma, pStat);
|
tdUnRefSmaStat(pSma, pStat);
|
||||||
terrno = TSDB_CODE_TDB_INVALID_SMA_STAT;
|
terrno = TSDB_CODE_TDB_INVALID_SMA_STAT;
|
||||||
smaWarn("vgId:%d getTSmaDataImpl failed from index %" PRIi64 " since %s %" PRIi8, SMA_VID(pSma), indexUid,
|
smaWarn("vgId:%d, getTSmaDataImpl failed from index %" PRIi64 " since %s %" PRIi8, SMA_VID(pSma), indexUid,
|
||||||
tstrerror(terrno), smaStat);
|
tstrerror(terrno), smaStat);
|
||||||
return TSDB_CODE_FAILED;
|
return TSDB_CODE_FAILED;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (taosHashGet(pItem->expiredWindows, &querySKey, sizeof(TSKEY))) {
|
if (taosHashGet(pItem->expiredWindows, &querySKey, sizeof(TSKEY))) {
|
||||||
// TODO: mark this window as expired.
|
// TODO: mark this window as expired.
|
||||||
smaDebug("vgId:%d skey %" PRIi64 " of window exists in expired window for index %" PRIi64, SMA_VID(pSma), querySKey,
|
smaDebug("vgId:%d, skey %" PRIi64 " of window exists in expired window for index %" PRIi64, SMA_VID(pSma), querySKey,
|
||||||
indexUid);
|
indexUid);
|
||||||
} else {
|
} else {
|
||||||
smaDebug("vgId:%d skey %" PRIi64 " of window not in expired window for index %" PRIi64, SMA_VID(pSma), querySKey,
|
smaDebug("vgId:%d, skey %" PRIi64 " of window not in expired window for index %" PRIi64, SMA_VID(pSma), querySKey,
|
||||||
indexUid);
|
indexUid);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -750,7 +750,7 @@ int32_t tdGetTSmaDataImpl(SSma *pSma, char *pData, int64_t indexUid, TSKEY query
|
||||||
smaDebug("### vgId:%d read from DBF %s days:%d, interval:%" PRIi64 ", storageLevel:%" PRIi8 " queryKey:%" PRIi64,
|
smaDebug("### vgId:%d read from DBF %s days:%d, interval:%" PRIi64 ", storageLevel:%" PRIi8 " queryKey:%" PRIi64,
|
||||||
SMA_VID(pSma), tReadH.dFile.path, tReadH.days, tReadH.interval, tReadH.storageLevel, querySKey);
|
SMA_VID(pSma), tReadH.dFile.path, tReadH.days, tReadH.interval, tReadH.storageLevel, querySKey);
|
||||||
if (smaOpenDBF(pEnv->dbEnv, &tReadH.dFile) != 0) {
|
if (smaOpenDBF(pEnv->dbEnv, &tReadH.dFile) != 0) {
|
||||||
smaWarn("vgId:%d open DBF %s failed since %s", SMA_VID(pSma), tReadH.dFile.path, tstrerror(terrno));
|
smaWarn("vgId:%d, open DBF %s failed since %s", SMA_VID(pSma), tReadH.dFile.path, tstrerror(terrno));
|
||||||
return TSDB_CODE_FAILED;
|
return TSDB_CODE_FAILED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -759,13 +759,13 @@ int32_t tdGetTSmaDataImpl(SSma *pSma, char *pData, int64_t indexUid, TSKEY query
|
||||||
int64_t queryGroupId = 0;
|
int64_t queryGroupId = 0;
|
||||||
tdEncodeTSmaKey(queryGroupId, querySKey, (void **)&pSmaKey);
|
tdEncodeTSmaKey(queryGroupId, querySKey, (void **)&pSmaKey);
|
||||||
|
|
||||||
smaDebug("vgId:%d get sma data from %s: smaKey %" PRIx64 "-%" PRIx64 ", keyLen %d", SMA_VID(pSma), tReadH.dFile.path,
|
smaDebug("vgId:%d, get sma data from %s: smaKey %" PRIx64 "-%" PRIx64 ", keyLen %d", SMA_VID(pSma), tReadH.dFile.path,
|
||||||
*(int64_t *)smaKey, *(int64_t *)POINTER_SHIFT(smaKey, 8), SMA_KEY_LEN);
|
*(int64_t *)smaKey, *(int64_t *)POINTER_SHIFT(smaKey, 8), SMA_KEY_LEN);
|
||||||
|
|
||||||
void *result = NULL;
|
void *result = NULL;
|
||||||
int32_t valueSize = 0;
|
int32_t valueSize = 0;
|
||||||
if (!(result = smaGetSmaDataByKey(&tReadH.dFile, smaKey, SMA_KEY_LEN, &valueSize))) {
|
if (!(result = smaGetSmaDataByKey(&tReadH.dFile, smaKey, SMA_KEY_LEN, &valueSize))) {
|
||||||
smaWarn("vgId:%d get sma data failed from smaIndex %" PRIi64 ", smaKey %" PRIx64 "-%" PRIx64 " since %s",
|
smaWarn("vgId:%d, get sma data failed from smaIndex %" PRIi64 ", smaKey %" PRIx64 "-%" PRIx64 " since %s",
|
||||||
SMA_VID(pSma), indexUid, *(int64_t *)smaKey, *(int64_t *)POINTER_SHIFT(smaKey, 8), tstrerror(terrno));
|
SMA_VID(pSma), indexUid, *(int64_t *)smaKey, *(int64_t *)POINTER_SHIFT(smaKey, 8), tstrerror(terrno));
|
||||||
smaCloseDBF(&tReadH.dFile);
|
smaCloseDBF(&tReadH.dFile);
|
||||||
return TSDB_CODE_FAILED;
|
return TSDB_CODE_FAILED;
|
||||||
|
@ -774,7 +774,7 @@ int32_t tdGetTSmaDataImpl(SSma *pSma, char *pData, int64_t indexUid, TSKEY query
|
||||||
|
|
||||||
#ifdef _TEST_SMA_PRINT_DEBUG_LOG_
|
#ifdef _TEST_SMA_PRINT_DEBUG_LOG_
|
||||||
for (uint32_t v = 0; v < valueSize; v += 8) {
|
for (uint32_t v = 0; v < valueSize; v += 8) {
|
||||||
smaWarn("vgId:%d get sma data v[%d]=%" PRIi64, SMA_VID(pSma), v, *(int64_t *)POINTER_SHIFT(result, v));
|
smaWarn("vgId:%d, get sma data v[%d]=%" PRIi64, SMA_VID(pSma), v, *(int64_t *)POINTER_SHIFT(result, v));
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
taosMemoryFreeClear(result); // TODO: fill the result to output
|
taosMemoryFreeClear(result); // TODO: fill the result to output
|
||||||
|
@ -888,7 +888,7 @@ static int32_t tdSetExpiredWindow(SSma *pSma, SHashObj *pItemsHash, int64_t inde
|
||||||
terrno = TSDB_CODE_TDB_NO_SMA_INDEX_IN_META;
|
terrno = TSDB_CODE_TDB_NO_SMA_INDEX_IN_META;
|
||||||
taosHashCleanup(pItem->expiredWindows);
|
taosHashCleanup(pItem->expiredWindows);
|
||||||
taosMemoryFree(pItem);
|
taosMemoryFree(pItem);
|
||||||
smaWarn("vgId:%d set expire window, get tsma meta failed for smaIndex %" PRIi64 " since %s", SMA_VID(pSma),
|
smaWarn("vgId:%d, set expire window, get tsma meta failed for smaIndex %" PRIi64 " since %s", SMA_VID(pSma),
|
||||||
indexUid, tstrerror(terrno));
|
indexUid, tstrerror(terrno));
|
||||||
return TSDB_CODE_FAILED;
|
return TSDB_CODE_FAILED;
|
||||||
}
|
}
|
||||||
|
@ -915,12 +915,12 @@ static int32_t tdSetExpiredWindow(SSma *pSma, SHashObj *pItemsHash, int64_t inde
|
||||||
taosHashCleanup(pItem->expiredWindows);
|
taosHashCleanup(pItem->expiredWindows);
|
||||||
taosMemoryFreeClear(pItem->pTSma);
|
taosMemoryFreeClear(pItem->pTSma);
|
||||||
taosHashRemove(pItemsHash, &indexUid, sizeof(indexUid));
|
taosHashRemove(pItemsHash, &indexUid, sizeof(indexUid));
|
||||||
smaWarn("vgId:%d smaIndex %" PRIi64 ", put skey %" PRIi64 " to expire window fail", SMA_VID(pSma), indexUid,
|
smaWarn("vgId:%d, smaIndex %" PRIi64 ", put skey %" PRIi64 " to expire window fail", SMA_VID(pSma), indexUid,
|
||||||
winSKey);
|
winSKey);
|
||||||
return TSDB_CODE_FAILED;
|
return TSDB_CODE_FAILED;
|
||||||
}
|
}
|
||||||
|
|
||||||
smaDebug("vgId:%d smaIndex %" PRIi64 ", put skey %" PRIi64 " to expire window succeed", SMA_VID(pSma), indexUid,
|
smaDebug("vgId:%d, smaIndex %" PRIi64 ", put skey %" PRIi64 " to expire window succeed", SMA_VID(pSma), indexUid,
|
||||||
winSKey);
|
winSKey);
|
||||||
return TSDB_CODE_SUCCESS;
|
return TSDB_CODE_SUCCESS;
|
||||||
}
|
}
|
||||||
|
@ -935,18 +935,18 @@ static int32_t tdSetExpiredWindow(SSma *pSma, SHashObj *pItemsHash, int64_t inde
|
||||||
int32_t tdUpdateExpiredWindowImpl(SSma *pSma, const SSubmitReq *pMsg, int64_t version) {
|
int32_t tdUpdateExpiredWindowImpl(SSma *pSma, const SSubmitReq *pMsg, int64_t version) {
|
||||||
// no time-range-sma, just return success
|
// no time-range-sma, just return success
|
||||||
if (atomic_load_16(&SMA_TSMA_NUM(pSma)) <= 0) {
|
if (atomic_load_16(&SMA_TSMA_NUM(pSma)) <= 0) {
|
||||||
smaTrace("vgId:%d not update expire window since no tSma", SMA_VID(pSma));
|
smaTrace("vgId:%d, not update expire window since no tSma", SMA_VID(pSma));
|
||||||
return TSDB_CODE_SUCCESS;
|
return TSDB_CODE_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!SMA_META(pSma)) {
|
if (!SMA_META(pSma)) {
|
||||||
terrno = TSDB_CODE_INVALID_PTR;
|
terrno = TSDB_CODE_INVALID_PTR;
|
||||||
smaError("vgId:%d update expire window failed since no meta ptr", SMA_VID(pSma));
|
smaError("vgId:%d, update expire window failed since no meta ptr", SMA_VID(pSma));
|
||||||
return TSDB_CODE_FAILED;
|
return TSDB_CODE_FAILED;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tdCheckAndInitSmaEnv(pSma, TSDB_SMA_TYPE_TIME_RANGE) < 0) {
|
if (tdCheckAndInitSmaEnv(pSma, TSDB_SMA_TYPE_TIME_RANGE) < 0) {
|
||||||
smaError("vgId:%d init sma env failed since %s", SMA_VID(pSma), terrstr(terrno));
|
smaError("vgId:%d, init sma env failed since %s", SMA_VID(pSma), terrstr(terrno));
|
||||||
terrno = TSDB_CODE_TDB_INIT_FAILED;
|
terrno = TSDB_CODE_TDB_INIT_FAILED;
|
||||||
return TSDB_CODE_FAILED;
|
return TSDB_CODE_FAILED;
|
||||||
}
|
}
|
||||||
|
@ -1025,7 +1025,7 @@ int32_t tdUpdateExpiredWindowImpl(SSma *pSma, const SSubmitReq *pMsg, int64_t ve
|
||||||
return TSDB_CODE_FAILED;
|
return TSDB_CODE_FAILED;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
smaDebug("vgId:%d smaIndex %" PRIi64 ", put skey %" PRIi64 " to expire window ignore as duplicated",
|
smaDebug("vgId:%d, smaIndex %" PRIi64 ", put skey %" PRIi64 " to expire window ignore as duplicated",
|
||||||
SMA_VID(pSma), pTSma->indexUid, winSKey);
|
SMA_VID(pSma), pTSma->indexUid, winSKey);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -108,7 +108,7 @@ int tsdbApplyRtnOnFSet(STsdb *pRepo, SDFileSet *pSet, SRtn *pRtn) {
|
||||||
tsdbInitDFileSet(pRepo, &nSet, did, pSet->fid, FS_TXN_VERSION(pfs));
|
tsdbInitDFileSet(pRepo, &nSet, did, pSet->fid, FS_TXN_VERSION(pfs));
|
||||||
|
|
||||||
if (tsdbCopyDFileSet(pSet, &nSet) < 0) {
|
if (tsdbCopyDFileSet(pSet, &nSet) < 0) {
|
||||||
tsdbError("vgId:%d failed to copy FSET %d from level %d to level %d since %s", REPO_ID(pRepo), pSet->fid,
|
tsdbError("vgId:%d, failed to copy FSET %d from level %d to level %d since %s", REPO_ID(pRepo), pSet->fid,
|
||||||
TSDB_FSET_LEVEL(pSet), did.level, tstrerror(terrno));
|
TSDB_FSET_LEVEL(pSet), did.level, tstrerror(terrno));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@ -117,7 +117,7 @@ int tsdbApplyRtnOnFSet(STsdb *pRepo, SDFileSet *pSet, SRtn *pRtn) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
tsdbInfo("vgId:%d FSET %d is copied from level %d disk id %d to level %d disk id %d", REPO_ID(pRepo), pSet->fid,
|
tsdbInfo("vgId:%d, FSET %d is copied from level %d disk id %d to level %d disk id %d", REPO_ID(pRepo), pSet->fid,
|
||||||
TSDB_FSET_LEVEL(pSet), TSDB_FSET_ID(pSet), did.level, did.id);
|
TSDB_FSET_LEVEL(pSet), TSDB_FSET_ID(pSet), did.level, did.id);
|
||||||
} else {
|
} else {
|
||||||
// On a correct level
|
// On a correct level
|
||||||
|
@ -158,7 +158,7 @@ int tsdbCommit(STsdb *pRepo) {
|
||||||
tsdbSeekCommitIter(&commith, commith.rtn.minKey);
|
tsdbSeekCommitIter(&commith, commith.rtn.minKey);
|
||||||
while ((pSet = tsdbFSIterNext(&(commith.fsIter)))) {
|
while ((pSet = tsdbFSIterNext(&(commith.fsIter)))) {
|
||||||
if (pSet->fid < commith.rtn.minFid) {
|
if (pSet->fid < commith.rtn.minFid) {
|
||||||
tsdbInfo("vgId:%d FSET %d on level %d disk id %d expires, remove it", REPO_ID(pRepo), pSet->fid,
|
tsdbInfo("vgId:%d, FSET %d on level %d disk id %d expires, remove it", REPO_ID(pRepo), pSet->fid,
|
||||||
TSDB_FSET_LEVEL(pSet), TSDB_FSET_ID(pSet));
|
TSDB_FSET_LEVEL(pSet), TSDB_FSET_ID(pSet));
|
||||||
} else {
|
} else {
|
||||||
break;
|
break;
|
||||||
|
@ -224,14 +224,14 @@ void tsdbGetRtnSnap(STsdb *pRepo, SRtn *pRtn) {
|
||||||
pRtn->minFid = (int)(TSDB_KEY_FID(minKey, pCfg->days, pCfg->precision));
|
pRtn->minFid = (int)(TSDB_KEY_FID(minKey, pCfg->days, pCfg->precision));
|
||||||
pRtn->midFid = (int)(TSDB_KEY_FID(midKey, pCfg->days, pCfg->precision));
|
pRtn->midFid = (int)(TSDB_KEY_FID(midKey, pCfg->days, pCfg->precision));
|
||||||
pRtn->maxFid = (int)(TSDB_KEY_FID(maxKey, pCfg->days, pCfg->precision));
|
pRtn->maxFid = (int)(TSDB_KEY_FID(maxKey, pCfg->days, pCfg->precision));
|
||||||
tsdbDebug("vgId:%d now:%" PRId64 " minKey:%" PRId64 " minFid:%d, midFid:%d, maxFid:%d", REPO_ID(pRepo), now, minKey,
|
tsdbDebug("vgId:%d, now:%" PRId64 " minKey:%" PRId64 " minFid:%d, midFid:%d, maxFid:%d", REPO_ID(pRepo), now, minKey,
|
||||||
pRtn->minFid, pRtn->midFid, pRtn->maxFid);
|
pRtn->minFid, pRtn->midFid, pRtn->maxFid);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void tsdbStartCommit(STsdb *pRepo) {
|
static void tsdbStartCommit(STsdb *pRepo) {
|
||||||
STsdbMemTable *pMem = pRepo->imem;
|
STsdbMemTable *pMem = pRepo->imem;
|
||||||
|
|
||||||
tsdbInfo("vgId:%d start to commit", REPO_ID(pRepo));
|
tsdbInfo("vgId:%d, start to commit", REPO_ID(pRepo));
|
||||||
|
|
||||||
tsdbStartFSTxn(pRepo, 0, 0);
|
tsdbStartFSTxn(pRepo, 0, 0);
|
||||||
}
|
}
|
||||||
|
@ -240,7 +240,7 @@ static void tsdbEndCommit(STsdb *pTsdb, int eno) {
|
||||||
tsdbEndFSTxn(pTsdb);
|
tsdbEndFSTxn(pTsdb);
|
||||||
tsdbMemTableDestroy(pTsdb->imem);
|
tsdbMemTableDestroy(pTsdb->imem);
|
||||||
pTsdb->imem = NULL;
|
pTsdb->imem = NULL;
|
||||||
tsdbInfo("vgId:%d commit over, %s", REPO_ID(pTsdb), (eno == TSDB_CODE_SUCCESS) ? "succeed" : "failed");
|
tsdbInfo("vgId:%d, commit over, %s", REPO_ID(pTsdb), (eno == TSDB_CODE_SUCCESS) ? "succeed" : "failed");
|
||||||
}
|
}
|
||||||
|
|
||||||
static int tsdbInitCommitH(SCommitH *pCommith, STsdb *pRepo) {
|
static int tsdbInitCommitH(SCommitH *pCommith, STsdb *pRepo) {
|
||||||
|
@ -413,7 +413,7 @@ static int tsdbCommitToFile(SCommitH *pCommith, SDFileSet *pSet, int fid) {
|
||||||
|
|
||||||
if (tsdbWriteBlockIdx(TSDB_COMMIT_HEAD_FILE(pCommith), pCommith->aBlkIdx, (void **)(&(TSDB_COMMIT_BUF(pCommith)))) <
|
if (tsdbWriteBlockIdx(TSDB_COMMIT_HEAD_FILE(pCommith), pCommith->aBlkIdx, (void **)(&(TSDB_COMMIT_BUF(pCommith)))) <
|
||||||
0) {
|
0) {
|
||||||
tsdbError("vgId:%d failed to write SBlockIdx part to FSET %d since %s", REPO_ID(pRepo), fid, tstrerror(terrno));
|
tsdbError("vgId:%d, failed to write SBlockIdx part to FSET %d since %s", REPO_ID(pRepo), fid, tstrerror(terrno));
|
||||||
tsdbCloseCommitFile(pCommith, true);
|
tsdbCloseCommitFile(pCommith, true);
|
||||||
// revert the file change
|
// revert the file change
|
||||||
tsdbApplyDFileSetChange(TSDB_COMMIT_WRITE_FSET(pCommith), pSet);
|
tsdbApplyDFileSetChange(TSDB_COMMIT_WRITE_FSET(pCommith), pSet);
|
||||||
|
@ -421,7 +421,7 @@ static int tsdbCommitToFile(SCommitH *pCommith, SDFileSet *pSet, int fid) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tsdbUpdateDFileSetHeader(&(pCommith->wSet)) < 0) {
|
if (tsdbUpdateDFileSetHeader(&(pCommith->wSet)) < 0) {
|
||||||
tsdbError("vgId:%d failed to update FSET %d header since %s", REPO_ID(pRepo), fid, tstrerror(terrno));
|
tsdbError("vgId:%d, failed to update FSET %d header since %s", REPO_ID(pRepo), fid, tstrerror(terrno));
|
||||||
tsdbCloseCommitFile(pCommith, true);
|
tsdbCloseCommitFile(pCommith, true);
|
||||||
// revert the file change
|
// revert the file change
|
||||||
tsdbApplyDFileSetChange(TSDB_COMMIT_WRITE_FSET(pCommith), pSet);
|
tsdbApplyDFileSetChange(TSDB_COMMIT_WRITE_FSET(pCommith), pSet);
|
||||||
|
@ -531,7 +531,7 @@ static int tsdbSetAndOpenCommitFile(SCommitH *pCommith, SDFileSet *pSet, int fid
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
tsdbDebug("vgId:%d FSET %d at level %d disk id %d is opened to read to commit", REPO_ID(pRepo), TSDB_FSET_FID(pSet),
|
tsdbDebug("vgId:%d, FSET %d at level %d disk id %d is opened to read to commit", REPO_ID(pRepo), TSDB_FSET_FID(pSet),
|
||||||
TSDB_FSET_LEVEL(pSet), TSDB_FSET_ID(pSet));
|
TSDB_FSET_LEVEL(pSet), TSDB_FSET_ID(pSet));
|
||||||
} else {
|
} else {
|
||||||
pCommith->isRFileSet = false;
|
pCommith->isRFileSet = false;
|
||||||
|
@ -543,7 +543,7 @@ static int tsdbSetAndOpenCommitFile(SCommitH *pCommith, SDFileSet *pSet, int fid
|
||||||
tsdbInitDFileSet(pRepo, pWSet, did, fid, FS_TXN_VERSION(REPO_FS(pRepo)));
|
tsdbInitDFileSet(pRepo, pWSet, did, fid, FS_TXN_VERSION(REPO_FS(pRepo)));
|
||||||
|
|
||||||
if (tsdbCreateDFileSet(pRepo, pWSet, true) < 0) {
|
if (tsdbCreateDFileSet(pRepo, pWSet, true) < 0) {
|
||||||
tsdbError("vgId:%d failed to create FSET %d at level %d disk id %d since %s", REPO_ID(pRepo),
|
tsdbError("vgId:%d, failed to create FSET %d at level %d disk id %d since %s", REPO_ID(pRepo),
|
||||||
TSDB_FSET_FID(pWSet), TSDB_FSET_LEVEL(pWSet), TSDB_FSET_ID(pWSet), tstrerror(terrno));
|
TSDB_FSET_FID(pWSet), TSDB_FSET_LEVEL(pWSet), TSDB_FSET_ID(pWSet), tstrerror(terrno));
|
||||||
if (pCommith->isRFileSet) {
|
if (pCommith->isRFileSet) {
|
||||||
tsdbCloseAndUnsetFSet(&(pCommith->readh));
|
tsdbCloseAndUnsetFSet(&(pCommith->readh));
|
||||||
|
@ -554,7 +554,7 @@ static int tsdbSetAndOpenCommitFile(SCommitH *pCommith, SDFileSet *pSet, int fid
|
||||||
pCommith->isDFileSame = false;
|
pCommith->isDFileSame = false;
|
||||||
pCommith->isLFileSame = false;
|
pCommith->isLFileSame = false;
|
||||||
|
|
||||||
tsdbDebug("vgId:%d FSET %d at level %d disk id %d is created to commit", REPO_ID(pRepo), TSDB_FSET_FID(pWSet),
|
tsdbDebug("vgId:%d, FSET %d at level %d disk id %d is created to commit", REPO_ID(pRepo), TSDB_FSET_FID(pWSet),
|
||||||
TSDB_FSET_LEVEL(pWSet), TSDB_FSET_ID(pWSet));
|
TSDB_FSET_LEVEL(pWSet), TSDB_FSET_ID(pWSet));
|
||||||
} else {
|
} else {
|
||||||
did.level = TSDB_FSET_LEVEL(pSet);
|
did.level = TSDB_FSET_LEVEL(pSet);
|
||||||
|
@ -567,7 +567,7 @@ static int tsdbSetAndOpenCommitFile(SCommitH *pCommith, SDFileSet *pSet, int fid
|
||||||
SDFile *pWHeadf = TSDB_COMMIT_HEAD_FILE(pCommith);
|
SDFile *pWHeadf = TSDB_COMMIT_HEAD_FILE(pCommith);
|
||||||
tsdbInitDFile(pRepo, pWHeadf, did, fid, FS_TXN_VERSION(REPO_FS(pRepo)), TSDB_FILE_HEAD);
|
tsdbInitDFile(pRepo, pWHeadf, did, fid, FS_TXN_VERSION(REPO_FS(pRepo)), TSDB_FILE_HEAD);
|
||||||
if (tsdbCreateDFile(pRepo, pWHeadf, true, TSDB_FILE_HEAD) < 0) {
|
if (tsdbCreateDFile(pRepo, pWHeadf, true, TSDB_FILE_HEAD) < 0) {
|
||||||
tsdbError("vgId:%d failed to create file %s to commit since %s", REPO_ID(pRepo), TSDB_FILE_FULL_NAME(pWHeadf),
|
tsdbError("vgId:%d, failed to create file %s to commit since %s", REPO_ID(pRepo), TSDB_FILE_FULL_NAME(pWHeadf),
|
||||||
tstrerror(terrno));
|
tstrerror(terrno));
|
||||||
|
|
||||||
if (pCommith->isRFileSet) {
|
if (pCommith->isRFileSet) {
|
||||||
|
@ -582,7 +582,7 @@ static int tsdbSetAndOpenCommitFile(SCommitH *pCommith, SDFileSet *pSet, int fid
|
||||||
tsdbInitDFileEx(pWDataf, pRDataf);
|
tsdbInitDFileEx(pWDataf, pRDataf);
|
||||||
// if (tsdbOpenDFile(pWDataf, O_WRONLY) < 0) {
|
// if (tsdbOpenDFile(pWDataf, O_WRONLY) < 0) {
|
||||||
if (tsdbOpenDFile(pWDataf, TD_FILE_WRITE) < 0) {
|
if (tsdbOpenDFile(pWDataf, TD_FILE_WRITE) < 0) {
|
||||||
tsdbError("vgId:%d failed to open file %s to commit since %s", REPO_ID(pRepo), TSDB_FILE_FULL_NAME(pWDataf),
|
tsdbError("vgId:%d, failed to open file %s to commit since %s", REPO_ID(pRepo), TSDB_FILE_FULL_NAME(pWDataf),
|
||||||
tstrerror(terrno));
|
tstrerror(terrno));
|
||||||
|
|
||||||
tsdbCloseDFileSet(pWSet);
|
tsdbCloseDFileSet(pWSet);
|
||||||
|
@ -603,7 +603,7 @@ static int tsdbSetAndOpenCommitFile(SCommitH *pCommith, SDFileSet *pSet, int fid
|
||||||
|
|
||||||
// if (tsdbOpenDFile(pWLastf, O_WRONLY) < 0) {
|
// if (tsdbOpenDFile(pWLastf, O_WRONLY) < 0) {
|
||||||
if (tsdbOpenDFile(pWLastf, TD_FILE_WRITE) < 0) {
|
if (tsdbOpenDFile(pWLastf, TD_FILE_WRITE) < 0) {
|
||||||
tsdbError("vgId:%d failed to open file %s to commit since %s", REPO_ID(pRepo), TSDB_FILE_FULL_NAME(pWLastf),
|
tsdbError("vgId:%d, failed to open file %s to commit since %s", REPO_ID(pRepo), TSDB_FILE_FULL_NAME(pWLastf),
|
||||||
tstrerror(terrno));
|
tstrerror(terrno));
|
||||||
|
|
||||||
tsdbCloseDFileSet(pWSet);
|
tsdbCloseDFileSet(pWSet);
|
||||||
|
@ -618,7 +618,7 @@ static int tsdbSetAndOpenCommitFile(SCommitH *pCommith, SDFileSet *pSet, int fid
|
||||||
pCommith->isLFileSame = false;
|
pCommith->isLFileSame = false;
|
||||||
|
|
||||||
if (tsdbCreateDFile(pRepo, pWLastf, true, TSDB_FILE_LAST) < 0) {
|
if (tsdbCreateDFile(pRepo, pWLastf, true, TSDB_FILE_LAST) < 0) {
|
||||||
tsdbError("vgId:%d failed to create file %s to commit since %s", REPO_ID(pRepo), TSDB_FILE_FULL_NAME(pWLastf),
|
tsdbError("vgId:%d, failed to create file %s to commit since %s", REPO_ID(pRepo), TSDB_FILE_FULL_NAME(pWLastf),
|
||||||
tstrerror(terrno));
|
tstrerror(terrno));
|
||||||
|
|
||||||
tsdbCloseDFileSet(pWSet);
|
tsdbCloseDFileSet(pWSet);
|
||||||
|
@ -635,11 +635,11 @@ static int tsdbSetAndOpenCommitFile(SCommitH *pCommith, SDFileSet *pSet, int fid
|
||||||
SDFile *pWSmadF = TSDB_COMMIT_SMAD_FILE(pCommith);
|
SDFile *pWSmadF = TSDB_COMMIT_SMAD_FILE(pCommith);
|
||||||
|
|
||||||
if (!taosCheckExistFile(TSDB_FILE_FULL_NAME(pRSmadF))) {
|
if (!taosCheckExistFile(TSDB_FILE_FULL_NAME(pRSmadF))) {
|
||||||
tsdbDebug("vgId:%d create data file %s as not exist", REPO_ID(pRepo), TSDB_FILE_FULL_NAME(pRSmadF));
|
tsdbDebug("vgId:%d, create data file %s as not exist", REPO_ID(pRepo), TSDB_FILE_FULL_NAME(pRSmadF));
|
||||||
tsdbInitDFile(pRepo, pWSmadF, did, fid, FS_TXN_VERSION(REPO_FS(pRepo)), TSDB_FILE_SMAD);
|
tsdbInitDFile(pRepo, pWSmadF, did, fid, FS_TXN_VERSION(REPO_FS(pRepo)), TSDB_FILE_SMAD);
|
||||||
|
|
||||||
if (tsdbCreateDFile(pRepo, pWSmadF, true, TSDB_FILE_SMAD) < 0) {
|
if (tsdbCreateDFile(pRepo, pWSmadF, true, TSDB_FILE_SMAD) < 0) {
|
||||||
tsdbError("vgId:%d failed to create file %s to commit since %s", REPO_ID(pRepo), TSDB_FILE_FULL_NAME(pWSmadF),
|
tsdbError("vgId:%d, failed to create file %s to commit since %s", REPO_ID(pRepo), TSDB_FILE_FULL_NAME(pWSmadF),
|
||||||
tstrerror(terrno));
|
tstrerror(terrno));
|
||||||
|
|
||||||
tsdbCloseDFileSet(pWSet);
|
tsdbCloseDFileSet(pWSet);
|
||||||
|
@ -652,7 +652,7 @@ static int tsdbSetAndOpenCommitFile(SCommitH *pCommith, SDFileSet *pSet, int fid
|
||||||
} else {
|
} else {
|
||||||
tsdbInitDFileEx(pWSmadF, pRSmadF);
|
tsdbInitDFileEx(pWSmadF, pRSmadF);
|
||||||
if (tsdbOpenDFile(pWSmadF, O_RDWR) < 0) {
|
if (tsdbOpenDFile(pWSmadF, O_RDWR) < 0) {
|
||||||
tsdbError("vgId:%d failed to open file %s to commit since %s", REPO_ID(pRepo), TSDB_FILE_FULL_NAME(pWSmadF),
|
tsdbError("vgId:%d, failed to open file %s to commit since %s", REPO_ID(pRepo), TSDB_FILE_FULL_NAME(pWSmadF),
|
||||||
tstrerror(terrno));
|
tstrerror(terrno));
|
||||||
|
|
||||||
tsdbCloseDFileSet(pWSet);
|
tsdbCloseDFileSet(pWSet);
|
||||||
|
@ -671,7 +671,7 @@ static int tsdbSetAndOpenCommitFile(SCommitH *pCommith, SDFileSet *pSet, int fid
|
||||||
if ((pCommith->isLFileSame) && taosCheckExistFile(TSDB_FILE_FULL_NAME(pRSmalF))) {
|
if ((pCommith->isLFileSame) && taosCheckExistFile(TSDB_FILE_FULL_NAME(pRSmalF))) {
|
||||||
tsdbInitDFileEx(pWSmalF, pRSmalF);
|
tsdbInitDFileEx(pWSmalF, pRSmalF);
|
||||||
if (tsdbOpenDFile(pWSmalF, O_RDWR) < 0) {
|
if (tsdbOpenDFile(pWSmalF, O_RDWR) < 0) {
|
||||||
tsdbError("vgId:%d failed to open file %s to commit since %s", REPO_ID(pRepo), TSDB_FILE_FULL_NAME(pWSmalF),
|
tsdbError("vgId:%d, failed to open file %s to commit since %s", REPO_ID(pRepo), TSDB_FILE_FULL_NAME(pWSmalF),
|
||||||
tstrerror(terrno));
|
tstrerror(terrno));
|
||||||
|
|
||||||
tsdbCloseDFileSet(pWSet);
|
tsdbCloseDFileSet(pWSet);
|
||||||
|
@ -682,11 +682,11 @@ static int tsdbSetAndOpenCommitFile(SCommitH *pCommith, SDFileSet *pSet, int fid
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
tsdbDebug("vgId:%d create data file %s as not exist", REPO_ID(pRepo), TSDB_FILE_FULL_NAME(pRSmalF));
|
tsdbDebug("vgId:%d, create data file %s as not exist", REPO_ID(pRepo), TSDB_FILE_FULL_NAME(pRSmalF));
|
||||||
tsdbInitDFile(pRepo, pWSmalF, did, fid, FS_TXN_VERSION(REPO_FS(pRepo)), TSDB_FILE_SMAL);
|
tsdbInitDFile(pRepo, pWSmalF, did, fid, FS_TXN_VERSION(REPO_FS(pRepo)), TSDB_FILE_SMAL);
|
||||||
|
|
||||||
if (tsdbCreateDFile(pRepo, pWSmalF, true, TSDB_FILE_SMAL) < 0) {
|
if (tsdbCreateDFile(pRepo, pWSmalF, true, TSDB_FILE_SMAL) < 0) {
|
||||||
tsdbError("vgId:%d failed to create file %s to commit since %s", REPO_ID(pRepo), TSDB_FILE_FULL_NAME(pWSmalF),
|
tsdbError("vgId:%d, failed to create file %s to commit since %s", REPO_ID(pRepo), TSDB_FILE_FULL_NAME(pWSmalF),
|
||||||
tstrerror(terrno));
|
tstrerror(terrno));
|
||||||
|
|
||||||
tsdbCloseDFileSet(pWSet);
|
tsdbCloseDFileSet(pWSet);
|
||||||
|
@ -887,7 +887,7 @@ static int tsdbCommitToTable(SCommitH *pCommith, int tid) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tsdbWriteBlockInfo(pCommith) < 0) {
|
if (tsdbWriteBlockInfo(pCommith) < 0) {
|
||||||
tsdbError("vgId:%d failed to write SBlockInfo part into file %s since %s", TSDB_COMMIT_REPO_ID(pCommith),
|
tsdbError("vgId:%d, failed to write SBlockInfo part into file %s since %s", TSDB_COMMIT_REPO_ID(pCommith),
|
||||||
TSDB_FILE_FULL_NAME(TSDB_COMMIT_HEAD_FILE(pCommith)), tstrerror(terrno));
|
TSDB_FILE_FULL_NAME(TSDB_COMMIT_HEAD_FILE(pCommith)), tstrerror(terrno));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@ -929,7 +929,7 @@ static int tsdbMoveBlkIdx(SCommitH *pCommith, SBlockIdx *pIdx) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tsdbMoveBlock(pCommith, bidx) < 0) {
|
if (tsdbMoveBlock(pCommith, bidx) < 0) {
|
||||||
tsdbError("vgId:%d failed to move block into file %s since %s", TSDB_COMMIT_REPO_ID(pCommith),
|
tsdbError("vgId:%d, failed to move block into file %s since %s", TSDB_COMMIT_REPO_ID(pCommith),
|
||||||
TSDB_FILE_FULL_NAME(TSDB_COMMIT_HEAD_FILE(pCommith)), tstrerror(terrno));
|
TSDB_FILE_FULL_NAME(TSDB_COMMIT_HEAD_FILE(pCommith)), tstrerror(terrno));
|
||||||
taosMemoryFreeClear(pTSchema);
|
taosMemoryFreeClear(pTSchema);
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -939,7 +939,7 @@ static int tsdbMoveBlkIdx(SCommitH *pCommith, SBlockIdx *pIdx) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tsdbWriteBlockInfo(pCommith) < 0) {
|
if (tsdbWriteBlockInfo(pCommith) < 0) {
|
||||||
tsdbError("vgId:%d failed to write SBlockInfo part into file %s since %s", TSDB_COMMIT_REPO_ID(pCommith),
|
tsdbError("vgId:%d, failed to write SBlockInfo part into file %s since %s", TSDB_COMMIT_REPO_ID(pCommith),
|
||||||
TSDB_FILE_FULL_NAME(TSDB_COMMIT_HEAD_FILE(pCommith)), tstrerror(terrno));
|
TSDB_FILE_FULL_NAME(TSDB_COMMIT_HEAD_FILE(pCommith)), tstrerror(terrno));
|
||||||
taosMemoryFreeClear(pTSchema);
|
taosMemoryFreeClear(pTSchema);
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -1209,7 +1209,7 @@ int tsdbWriteBlockImpl(STsdb *pRepo, STable *pTable, SDFile *pDFile, SDFile *pDF
|
||||||
pBlock->blkVer = SBlockVerLatest;
|
pBlock->blkVer = SBlockVerLatest;
|
||||||
pBlock->aggrOffset = (uint64_t)offsetAggr;
|
pBlock->aggrOffset = (uint64_t)offsetAggr;
|
||||||
|
|
||||||
tsdbDebug("vgId:%d uid:%" PRId64 " a block of data is written to file %s, offset %" PRId64
|
tsdbDebug("vgId:%d, uid:%" PRId64 " a block of data is written to file %s, offset %" PRId64
|
||||||
" numOfRows %d len %d numOfCols %" PRId16 " keyFirst %" PRId64 " keyLast %" PRId64,
|
" numOfRows %d len %d numOfCols %" PRId16 " keyFirst %" PRId64 " keyLast %" PRId64,
|
||||||
REPO_ID(pRepo), TABLE_UID(pTable), TSDB_FILE_FULL_NAME(pDFile), offset, rowsToWrite, pBlock->len,
|
REPO_ID(pRepo), TABLE_UID(pTable), TSDB_FILE_FULL_NAME(pDFile), offset, rowsToWrite, pBlock->len,
|
||||||
pBlock->numOfCols, pBlock->keyFirst, pBlock->keyLast);
|
pBlock->numOfCols, pBlock->keyFirst, pBlock->keyLast);
|
||||||
|
|
|
@ -260,7 +260,7 @@ int tsdbOpenFS(STsdb *pRepo) {
|
||||||
tsdbGetRtnSnap(pRepo, &pRepo->rtn);
|
tsdbGetRtnSnap(pRepo, &pRepo->rtn);
|
||||||
if (taosCheckExistFile(current)) {
|
if (taosCheckExistFile(current)) {
|
||||||
if (tsdbOpenFSFromCurrent(pRepo) < 0) {
|
if (tsdbOpenFSFromCurrent(pRepo) < 0) {
|
||||||
tsdbError("vgId:%d failed to open FS since %s", REPO_ID(pRepo), tstrerror(terrno));
|
tsdbError("vgId:%d, failed to open FS since %s", REPO_ID(pRepo), tstrerror(terrno));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -271,19 +271,19 @@ int tsdbOpenFS(STsdb *pRepo) {
|
||||||
} else {
|
} else {
|
||||||
// should skip expired fileset inside of the function
|
// should skip expired fileset inside of the function
|
||||||
if (tsdbRestoreCurrent(pRepo) < 0) {
|
if (tsdbRestoreCurrent(pRepo) < 0) {
|
||||||
tsdbError("vgId:%d failed to restore current file since %s", REPO_ID(pRepo), tstrerror(terrno));
|
tsdbError("vgId:%d, failed to restore current file since %s", REPO_ID(pRepo), tstrerror(terrno));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tsdbScanAndTryFixFS(pRepo) < 0) {
|
if (tsdbScanAndTryFixFS(pRepo) < 0) {
|
||||||
tsdbError("vgId:%d failed to scan and fix FS since %s", REPO_ID(pRepo), tstrerror(terrno));
|
tsdbError("vgId:%d, failed to scan and fix FS since %s", REPO_ID(pRepo), tstrerror(terrno));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// // Load meta cache if has meta file
|
// // Load meta cache if has meta file
|
||||||
// if ((!(pRepo->state & TSDB_STATE_BAD_META)) && tsdbLoadMetaCache(pRepo, true) < 0) {
|
// if ((!(pRepo->state & TSDB_STATE_BAD_META)) && tsdbLoadMetaCache(pRepo, true) < 0) {
|
||||||
// tsdbError("vgId:%d failed to open FS while loading meta cache since %s", REPO_ID(pRepo), tstrerror(terrno));
|
// tsdbError("vgId:%d, failed to open FS while loading meta cache since %s", REPO_ID(pRepo), tstrerror(terrno));
|
||||||
// return -1;
|
// return -1;
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
@ -607,7 +607,7 @@ static int tsdbOpenFSFromCurrent(STsdb *pRepo) {
|
||||||
// current file exists, try to recover
|
// current file exists, try to recover
|
||||||
pFile = taosOpenFile(current, TD_FILE_READ);
|
pFile = taosOpenFile(current, TD_FILE_READ);
|
||||||
if (pFile == NULL) {
|
if (pFile == NULL) {
|
||||||
tsdbError("vgId:%d failed to open file %s since %s", REPO_ID(pRepo), current, strerror(errno));
|
tsdbError("vgId:%d, failed to open file %s since %s", REPO_ID(pRepo), current, strerror(errno));
|
||||||
terrno = TAOS_SYSTEM_ERROR(errno);
|
terrno = TAOS_SYSTEM_ERROR(errno);
|
||||||
goto _err;
|
goto _err;
|
||||||
}
|
}
|
||||||
|
@ -618,20 +618,20 @@ static int tsdbOpenFSFromCurrent(STsdb *pRepo) {
|
||||||
|
|
||||||
int nread = (int)taosReadFile(pFile, buffer, TSDB_FILE_HEAD_SIZE);
|
int nread = (int)taosReadFile(pFile, buffer, TSDB_FILE_HEAD_SIZE);
|
||||||
if (nread < 0) {
|
if (nread < 0) {
|
||||||
tsdbError("vgId:%d failed to read %d bytes from file %s since %s", REPO_ID(pRepo), TSDB_FILENAME_LEN, current,
|
tsdbError("vgId:%d, failed to read %d bytes from file %s since %s", REPO_ID(pRepo), TSDB_FILENAME_LEN, current,
|
||||||
strerror(errno));
|
strerror(errno));
|
||||||
terrno = TAOS_SYSTEM_ERROR(errno);
|
terrno = TAOS_SYSTEM_ERROR(errno);
|
||||||
goto _err;
|
goto _err;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (nread < TSDB_FILE_HEAD_SIZE) {
|
if (nread < TSDB_FILE_HEAD_SIZE) {
|
||||||
tsdbError("vgId:%d failed to read header of file %s, read bytes:%d", REPO_ID(pRepo), current, nread);
|
tsdbError("vgId:%d, failed to read header of file %s, read bytes:%d", REPO_ID(pRepo), current, nread);
|
||||||
terrno = TSDB_CODE_TDB_FILE_CORRUPTED;
|
terrno = TSDB_CODE_TDB_FILE_CORRUPTED;
|
||||||
goto _err;
|
goto _err;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!taosCheckChecksumWhole((uint8_t *)buffer, TSDB_FILE_HEAD_SIZE)) {
|
if (!taosCheckChecksumWhole((uint8_t *)buffer, TSDB_FILE_HEAD_SIZE)) {
|
||||||
tsdbError("vgId:%d header of file %s failed checksum check", REPO_ID(pRepo), current);
|
tsdbError("vgId:%d, header of file %s failed checksum check", REPO_ID(pRepo), current);
|
||||||
terrno = TSDB_CODE_TDB_FILE_CORRUPTED;
|
terrno = TSDB_CODE_TDB_FILE_CORRUPTED;
|
||||||
goto _err;
|
goto _err;
|
||||||
}
|
}
|
||||||
|
@ -652,19 +652,19 @@ static int tsdbOpenFSFromCurrent(STsdb *pRepo) {
|
||||||
|
|
||||||
nread = (int)taosReadFile(pFile, buffer, fsheader.len);
|
nread = (int)taosReadFile(pFile, buffer, fsheader.len);
|
||||||
if (nread < 0) {
|
if (nread < 0) {
|
||||||
tsdbError("vgId:%d failed to read file %s since %s", REPO_ID(pRepo), current, strerror(errno));
|
tsdbError("vgId:%d, failed to read file %s since %s", REPO_ID(pRepo), current, strerror(errno));
|
||||||
terrno = TAOS_SYSTEM_ERROR(errno);
|
terrno = TAOS_SYSTEM_ERROR(errno);
|
||||||
goto _err;
|
goto _err;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (nread < fsheader.len) {
|
if (nread < fsheader.len) {
|
||||||
tsdbError("vgId:%d failed to read %d bytes from file %s", REPO_ID(pRepo), fsheader.len, current);
|
tsdbError("vgId:%d, failed to read %d bytes from file %s", REPO_ID(pRepo), fsheader.len, current);
|
||||||
terrno = TSDB_CODE_TDB_FILE_CORRUPTED;
|
terrno = TSDB_CODE_TDB_FILE_CORRUPTED;
|
||||||
goto _err;
|
goto _err;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!taosCheckChecksumWhole((uint8_t *)buffer, fsheader.len)) {
|
if (!taosCheckChecksumWhole((uint8_t *)buffer, fsheader.len)) {
|
||||||
tsdbError("vgId:%d file %s is corrupted since wrong checksum", REPO_ID(pRepo), current);
|
tsdbError("vgId:%d, file %s is corrupted since wrong checksum", REPO_ID(pRepo), current);
|
||||||
terrno = TSDB_CODE_TDB_FILE_CORRUPTED;
|
terrno = TSDB_CODE_TDB_FILE_CORRUPTED;
|
||||||
goto _err;
|
goto _err;
|
||||||
}
|
}
|
||||||
|
@ -694,7 +694,7 @@ static int tsdbScanAndTryFixFS(STsdb *pRepo) {
|
||||||
SFSStatus *pStatus = pfs->cstatus;
|
SFSStatus *pStatus = pfs->cstatus;
|
||||||
|
|
||||||
// if (tsdbScanAndTryFixMFile(pRepo) < 0) {
|
// if (tsdbScanAndTryFixMFile(pRepo) < 0) {
|
||||||
// tsdbError("vgId:%d failed to fix MFile since %s", REPO_ID(pRepo), tstrerror(terrno));
|
// tsdbError("vgId:%d, failed to fix MFile since %s", REPO_ID(pRepo), tstrerror(terrno));
|
||||||
// return -1;
|
// return -1;
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
@ -704,7 +704,7 @@ static int tsdbScanAndTryFixFS(STsdb *pRepo) {
|
||||||
SDFileSet *pSet = (SDFileSet *)taosArrayGet(pStatus->df, i);
|
SDFileSet *pSet = (SDFileSet *)taosArrayGet(pStatus->df, i);
|
||||||
|
|
||||||
if (tsdbScanAndTryFixDFileSet(pRepo, pSet) < 0) {
|
if (tsdbScanAndTryFixDFileSet(pRepo, pSet) < 0) {
|
||||||
tsdbError("vgId:%d failed to fix MFile since %s", REPO_ID(pRepo), tstrerror(terrno));
|
tsdbError("vgId:%d, failed to fix MFile since %s", REPO_ID(pRepo), tstrerror(terrno));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -724,7 +724,7 @@ static int tsdbScanRootDir(STsdb *pRepo) {
|
||||||
tsdbGetRootDir(REPO_ID(pRepo), pRepo->dir, rootDir);
|
tsdbGetRootDir(REPO_ID(pRepo), pRepo->dir, rootDir);
|
||||||
STfsDir *tdir = tfsOpendir(REPO_TFS(pRepo), rootDir);
|
STfsDir *tdir = tfsOpendir(REPO_TFS(pRepo), rootDir);
|
||||||
if (tdir == NULL) {
|
if (tdir == NULL) {
|
||||||
tsdbError("vgId:%d failed to open directory %s since %s", REPO_ID(pRepo), rootDir, tstrerror(terrno));
|
tsdbError("vgId:%d, failed to open directory %s since %s", REPO_ID(pRepo), rootDir, tstrerror(terrno));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -741,7 +741,7 @@ static int tsdbScanRootDir(STsdb *pRepo) {
|
||||||
// }
|
// }
|
||||||
|
|
||||||
(void)tfsRemoveFile(pf);
|
(void)tfsRemoveFile(pf);
|
||||||
tsdbDebug("vgId:%d invalid file %s is removed", REPO_ID(pRepo), pf->aname);
|
tsdbDebug("vgId:%d, invalid file %s is removed", REPO_ID(pRepo), pf->aname);
|
||||||
}
|
}
|
||||||
|
|
||||||
tfsClosedir(tdir);
|
tfsClosedir(tdir);
|
||||||
|
@ -758,7 +758,7 @@ static int tsdbScanDataDir(STsdb *pRepo) {
|
||||||
tsdbGetDataDir(REPO_ID(pRepo), pRepo->dir, dataDir);
|
tsdbGetDataDir(REPO_ID(pRepo), pRepo->dir, dataDir);
|
||||||
STfsDir *tdir = tfsOpendir(REPO_TFS(pRepo), dataDir);
|
STfsDir *tdir = tfsOpendir(REPO_TFS(pRepo), dataDir);
|
||||||
if (tdir == NULL) {
|
if (tdir == NULL) {
|
||||||
tsdbError("vgId:%d failed to open directory %s since %s", REPO_ID(pRepo), dataDir, tstrerror(terrno));
|
tsdbError("vgId:%d, failed to open directory %s since %s", REPO_ID(pRepo), dataDir, tstrerror(terrno));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -767,7 +767,7 @@ static int tsdbScanDataDir(STsdb *pRepo) {
|
||||||
|
|
||||||
if (!tsdbIsTFileInFS(pfs, pf)) {
|
if (!tsdbIsTFileInFS(pfs, pf)) {
|
||||||
(void)tfsRemoveFile(pf);
|
(void)tfsRemoveFile(pf);
|
||||||
tsdbDebug("vgId:%d invalid file %s is removed", REPO_ID(pRepo), pf->aname);
|
tsdbDebug("vgId:%d, invalid file %s is removed", REPO_ID(pRepo), pf->aname);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -811,7 +811,7 @@ static int tsdbRestoreDFileSet(STsdb *pRepo) {
|
||||||
fArray = taosArrayInit(1024, sizeof(STfsFile));
|
fArray = taosArrayInit(1024, sizeof(STfsFile));
|
||||||
if (fArray == NULL) {
|
if (fArray == NULL) {
|
||||||
terrno = TSDB_CODE_TDB_OUT_OF_MEMORY;
|
terrno = TSDB_CODE_TDB_OUT_OF_MEMORY;
|
||||||
tsdbError("vgId:%d failed to restore DFileSet while open directory %s since %s", REPO_ID(pRepo), dataDir,
|
tsdbError("vgId:%d, failed to restore DFileSet while open directory %s since %s", REPO_ID(pRepo), dataDir,
|
||||||
tstrerror(terrno));
|
tstrerror(terrno));
|
||||||
regfree(®ex);
|
regfree(®ex);
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -819,7 +819,7 @@ static int tsdbRestoreDFileSet(STsdb *pRepo) {
|
||||||
|
|
||||||
tdir = tfsOpendir(REPO_TFS(pRepo), dataDir);
|
tdir = tfsOpendir(REPO_TFS(pRepo), dataDir);
|
||||||
if (tdir == NULL) {
|
if (tdir == NULL) {
|
||||||
tsdbError("vgId:%d failed to restore DFileSet while open directory %s since %s", REPO_ID(pRepo), dataDir,
|
tsdbError("vgId:%d, failed to restore DFileSet while open directory %s since %s", REPO_ID(pRepo), dataDir,
|
||||||
tstrerror(terrno));
|
tstrerror(terrno));
|
||||||
taosArrayDestroy(fArray);
|
taosArrayDestroy(fArray);
|
||||||
regfree(®ex);
|
regfree(®ex);
|
||||||
|
@ -840,12 +840,12 @@ static int tsdbRestoreDFileSet(STsdb *pRepo) {
|
||||||
}
|
}
|
||||||
} else if (code == REG_NOMATCH) {
|
} else if (code == REG_NOMATCH) {
|
||||||
// Not match
|
// Not match
|
||||||
tsdbInfo("vgId:%d invalid file %s exists, remove it", REPO_ID(pRepo), pf->aname);
|
tsdbInfo("vgId:%d, invalid file %s exists, remove it", REPO_ID(pRepo), pf->aname);
|
||||||
(void)tfsRemoveFile(pf);
|
(void)tfsRemoveFile(pf);
|
||||||
continue;
|
continue;
|
||||||
} else {
|
} else {
|
||||||
// Has other error
|
// Has other error
|
||||||
tsdbError("vgId:%d failed to restore DFileSet Array while run regexec since %s", REPO_ID(pRepo), strerror(code));
|
tsdbError("vgId:%d, failed to restore DFileSet Array while run regexec since %s", REPO_ID(pRepo), strerror(code));
|
||||||
terrno = TAOS_SYSTEM_ERROR(code);
|
terrno = TAOS_SYSTEM_ERROR(code);
|
||||||
tfsClosedir(tdir);
|
tfsClosedir(tdir);
|
||||||
taosArrayDestroy(fArray);
|
taosArrayDestroy(fArray);
|
||||||
|
@ -876,7 +876,7 @@ static int tsdbRestoreDFileSet(STsdb *pRepo) {
|
||||||
SDFile *pDFile = TSDB_DFILE_IN_SET(&fset, ftype);
|
SDFile *pDFile = TSDB_DFILE_IN_SET(&fset, ftype);
|
||||||
|
|
||||||
if (index >= taosArrayGetSize(fArray)) {
|
if (index >= taosArrayGetSize(fArray)) {
|
||||||
tsdbError("vgId:%d incomplete DFileSet, fid:%d", REPO_ID(pRepo), fset.fid);
|
tsdbError("vgId:%d, incomplete DFileSet, fid:%d", REPO_ID(pRepo), fset.fid);
|
||||||
taosArrayDestroy(fArray);
|
taosArrayDestroy(fArray);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@ -902,14 +902,14 @@ static int tsdbRestoreDFileSet(STsdb *pRepo) {
|
||||||
fset.fid = tfid;
|
fset.fid = tfid;
|
||||||
} else {
|
} else {
|
||||||
if (tfid != fset.fid) {
|
if (tfid != fset.fid) {
|
||||||
tsdbError("vgId:%d incomplete dFileSet, fid:%d", REPO_ID(pRepo), fset.fid);
|
tsdbError("vgId:%d, incomplete dFileSet, fid:%d", REPO_ID(pRepo), fset.fid);
|
||||||
taosArrayDestroy(fArray);
|
taosArrayDestroy(fArray);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ttype != ftype) {
|
if (ttype != ftype) {
|
||||||
tsdbError("vgId:%d incomplete dFileSet, fid:%d", REPO_ID(pRepo), fset.fid);
|
tsdbError("vgId:%d, incomplete dFileSet, fid:%d", REPO_ID(pRepo), fset.fid);
|
||||||
taosArrayDestroy(fArray);
|
taosArrayDestroy(fArray);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@ -918,14 +918,14 @@ static int tsdbRestoreDFileSet(STsdb *pRepo) {
|
||||||
|
|
||||||
// if (tsdbOpenDFile(pDFile, O_RDONLY) < 0) {
|
// if (tsdbOpenDFile(pDFile, O_RDONLY) < 0) {
|
||||||
if (tsdbOpenDFile(pDFile, TD_FILE_READ) < 0) {
|
if (tsdbOpenDFile(pDFile, TD_FILE_READ) < 0) {
|
||||||
tsdbError("vgId:%d failed to open DFile %s since %s", REPO_ID(pRepo), TSDB_FILE_FULL_NAME(pDFile),
|
tsdbError("vgId:%d, failed to open DFile %s since %s", REPO_ID(pRepo), TSDB_FILE_FULL_NAME(pDFile),
|
||||||
tstrerror(terrno));
|
tstrerror(terrno));
|
||||||
taosArrayDestroy(fArray);
|
taosArrayDestroy(fArray);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tsdbLoadDFileHeader(pDFile, &(pDFile->info)) < 0) {
|
if (tsdbLoadDFileHeader(pDFile, &(pDFile->info)) < 0) {
|
||||||
tsdbError("vgId:%d failed to load DFile %s header since %s", REPO_ID(pRepo), TSDB_FILE_FULL_NAME(pDFile),
|
tsdbError("vgId:%d, failed to load DFile %s header since %s", REPO_ID(pRepo), TSDB_FILE_FULL_NAME(pDFile),
|
||||||
tstrerror(terrno));
|
tstrerror(terrno));
|
||||||
taosArrayDestroy(fArray);
|
taosArrayDestroy(fArray);
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -943,7 +943,7 @@ static int tsdbRestoreDFileSet(STsdb *pRepo) {
|
||||||
if (pDFile->info.size != file_size) {
|
if (pDFile->info.size != file_size) {
|
||||||
int64_t tfsize = pDFile->info.size;
|
int64_t tfsize = pDFile->info.size;
|
||||||
pDFile->info.size = file_size;
|
pDFile->info.size = file_size;
|
||||||
tsdbInfo("vgId:%d file %s header size is changed from %" PRId64 " to %" PRId64, REPO_ID(pRepo),
|
tsdbInfo("vgId:%d, file %s header size is changed from %" PRId64 " to %" PRId64, REPO_ID(pRepo),
|
||||||
TSDB_FILE_FULL_NAME(pDFile), tfsize, pDFile->info.size);
|
TSDB_FILE_FULL_NAME(pDFile), tfsize, pDFile->info.size);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -952,7 +952,7 @@ static int tsdbRestoreDFileSet(STsdb *pRepo) {
|
||||||
index++;
|
index++;
|
||||||
}
|
}
|
||||||
|
|
||||||
tsdbInfo("vgId:%d FSET %d is restored", REPO_ID(pRepo), fset.fid);
|
tsdbInfo("vgId:%d, FSET %d is restored", REPO_ID(pRepo), fset.fid);
|
||||||
taosArrayPush(pfs->cstatus->df, &fset);
|
taosArrayPush(pfs->cstatus->df, &fset);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -965,18 +965,18 @@ static int tsdbRestoreDFileSet(STsdb *pRepo) {
|
||||||
static int tsdbRestoreCurrent(STsdb *pRepo) {
|
static int tsdbRestoreCurrent(STsdb *pRepo) {
|
||||||
// // Loop to recover mfile
|
// // Loop to recover mfile
|
||||||
// if (tsdbRestoreMeta(pRepo) < 0) {
|
// if (tsdbRestoreMeta(pRepo) < 0) {
|
||||||
// tsdbError("vgId:%d failed to restore current since %s", REPO_ID(pRepo), tstrerror(terrno));
|
// tsdbError("vgId:%d, failed to restore current since %s", REPO_ID(pRepo), tstrerror(terrno));
|
||||||
// return -1;
|
// return -1;
|
||||||
// }
|
// }
|
||||||
|
|
||||||
// Loop to recover dfile set
|
// Loop to recover dfile set
|
||||||
if (tsdbRestoreDFileSet(pRepo) < 0) {
|
if (tsdbRestoreDFileSet(pRepo) < 0) {
|
||||||
tsdbError("vgId:%d failed to restore DFileSet since %s", REPO_ID(pRepo), tstrerror(terrno));
|
tsdbError("vgId:%d, failed to restore DFileSet since %s", REPO_ID(pRepo), tstrerror(terrno));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tsdbSaveFSStatus(pRepo, pRepo->fs->cstatus) < 0) {
|
if (tsdbSaveFSStatus(pRepo, pRepo->fs->cstatus) < 0) {
|
||||||
tsdbError("vgId:%d failed to restore current since %s", REPO_ID(pRepo), tstrerror(terrno));
|
tsdbError("vgId:%d, failed to restore current since %s", REPO_ID(pRepo), tstrerror(terrno));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1024,11 +1024,11 @@ static void tsdbScanAndTryFixDFilesHeader(STsdb *pRepo, int32_t *nExpired) {
|
||||||
if (fset.fid < pRepo->rtn.minFid) {
|
if (fset.fid < pRepo->rtn.minFid) {
|
||||||
++*nExpired;
|
++*nExpired;
|
||||||
}
|
}
|
||||||
tsdbDebug("vgId:%d scan DFileSet %d header", REPO_ID(pRepo), fset.fid);
|
tsdbDebug("vgId:%d, scan DFileSet %d header", REPO_ID(pRepo), fset.fid);
|
||||||
|
|
||||||
// if (tsdbOpenDFileSet(&fset, O_RDWR) < 0) {
|
// if (tsdbOpenDFileSet(&fset, O_RDWR) < 0) {
|
||||||
if (tsdbOpenDFileSet(&fset, TD_FILE_WRITE | TD_FILE_READ) < 0) {
|
if (tsdbOpenDFileSet(&fset, TD_FILE_WRITE | TD_FILE_READ) < 0) {
|
||||||
tsdbError("vgId:%d failed to open DFileSet %d since %s, continue", REPO_ID(pRepo), fset.fid, tstrerror(terrno));
|
tsdbError("vgId:%d, failed to open DFileSet %d since %s, continue", REPO_ID(pRepo), fset.fid, tstrerror(terrno));
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1038,14 +1038,14 @@ static void tsdbScanAndTryFixDFilesHeader(STsdb *pRepo, int32_t *nExpired) {
|
||||||
if ((tsdbLoadDFileHeader(pDFile, &info) < 0) || pDFile->info.size != info.size ||
|
if ((tsdbLoadDFileHeader(pDFile, &info) < 0) || pDFile->info.size != info.size ||
|
||||||
pDFile->info.magic != info.magic) {
|
pDFile->info.magic != info.magic) {
|
||||||
if (tsdbUpdateDFileHeader(pDFile) < 0) {
|
if (tsdbUpdateDFileHeader(pDFile) < 0) {
|
||||||
tsdbError("vgId:%d failed to update DFile header of %s since %s, continue", REPO_ID(pRepo),
|
tsdbError("vgId:%d, failed to update DFile header of %s since %s, continue", REPO_ID(pRepo),
|
||||||
TSDB_FILE_FULL_NAME(pDFile), tstrerror(terrno));
|
TSDB_FILE_FULL_NAME(pDFile), tstrerror(terrno));
|
||||||
} else {
|
} else {
|
||||||
tsdbInfo("vgId:%d DFile header of %s is updated", REPO_ID(pRepo), TSDB_FILE_FULL_NAME(pDFile));
|
tsdbInfo("vgId:%d, DFile header of %s is updated", REPO_ID(pRepo), TSDB_FILE_FULL_NAME(pDFile));
|
||||||
TSDB_FILE_FSYNC(pDFile);
|
TSDB_FILE_FSYNC(pDFile);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
tsdbDebug("vgId:%d DFile header of %s is correct", REPO_ID(pRepo), TSDB_FILE_FULL_NAME(pDFile));
|
tsdbDebug("vgId:%d, DFile header of %s is correct", REPO_ID(pRepo), TSDB_FILE_FULL_NAME(pDFile));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -181,7 +181,7 @@ static int tsdbScanAndTryFixDFile(STsdb *pRepo, SDFile *pDFile) {
|
||||||
tsdbInitDFileEx(&df, pDFile);
|
tsdbInitDFileEx(&df, pDFile);
|
||||||
|
|
||||||
if (!taosCheckExistFile(TSDB_FILE_FULL_NAME(pDFile))) {
|
if (!taosCheckExistFile(TSDB_FILE_FULL_NAME(pDFile))) {
|
||||||
tsdbError("vgId:%d data file %s not exit, report to upper layer to fix it", REPO_ID(pRepo),
|
tsdbError("vgId:%d, data file %s not exit, report to upper layer to fix it", REPO_ID(pRepo),
|
||||||
TSDB_FILE_FULL_NAME(pDFile));
|
TSDB_FILE_FULL_NAME(pDFile));
|
||||||
// pRepo->state |= TSDB_STATE_BAD_DATA;
|
// pRepo->state |= TSDB_STATE_BAD_DATA;
|
||||||
TSDB_FILE_SET_STATE(pDFile, TSDB_FILE_STATE_BAD);
|
TSDB_FILE_SET_STATE(pDFile, TSDB_FILE_STATE_BAD);
|
||||||
|
@ -211,17 +211,17 @@ static int tsdbScanAndTryFixDFile(STsdb *pRepo, SDFile *pDFile) {
|
||||||
}
|
}
|
||||||
|
|
||||||
tsdbCloseDFile(&df);
|
tsdbCloseDFile(&df);
|
||||||
tsdbInfo("vgId:%d file %s is truncated from %" PRId64 " to %" PRId64, REPO_ID(pRepo), TSDB_FILE_FULL_NAME(pDFile),
|
tsdbInfo("vgId:%d, file %s is truncated from %" PRId64 " to %" PRId64, REPO_ID(pRepo), TSDB_FILE_FULL_NAME(pDFile),
|
||||||
file_size, pDFile->info.size);
|
file_size, pDFile->info.size);
|
||||||
} else if (pDFile->info.size > file_size) {
|
} else if (pDFile->info.size > file_size) {
|
||||||
tsdbError("vgId:%d data file %s has wrong size %" PRId64 " expected %" PRId64 ", report to upper layer to fix it",
|
tsdbError("vgId:%d, data file %s has wrong size %" PRId64 " expected %" PRId64 ", report to upper layer to fix it",
|
||||||
REPO_ID(pRepo), TSDB_FILE_FULL_NAME(pDFile), file_size, pDFile->info.size);
|
REPO_ID(pRepo), TSDB_FILE_FULL_NAME(pDFile), file_size, pDFile->info.size);
|
||||||
// pRepo->state |= TSDB_STATE_BAD_DATA;
|
// pRepo->state |= TSDB_STATE_BAD_DATA;
|
||||||
TSDB_FILE_SET_STATE(pDFile, TSDB_FILE_STATE_BAD);
|
TSDB_FILE_SET_STATE(pDFile, TSDB_FILE_STATE_BAD);
|
||||||
terrno = TSDB_CODE_TDB_FILE_CORRUPTED;
|
terrno = TSDB_CODE_TDB_FILE_CORRUPTED;
|
||||||
return 0;
|
return 0;
|
||||||
} else {
|
} else {
|
||||||
tsdbDebug("vgId:%d file %s passes the scan", REPO_ID(pRepo), TSDB_FILE_FULL_NAME(pDFile));
|
tsdbDebug("vgId:%d, file %s passes the scan", REPO_ID(pRepo), TSDB_FILE_FULL_NAME(pDFile));
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -116,7 +116,7 @@ int32_t tsdbInsertTableData2(STsdb *pTsdb, int64_t version, SVSubmitBlk *pSubmit
|
||||||
|
|
||||||
code = tsdbGetOrCreateMemData(pMemTable, pSubmitBlk->suid, pSubmitBlk->uid, &pMemData);
|
code = tsdbGetOrCreateMemData(pMemTable, pSubmitBlk->suid, pSubmitBlk->uid, &pMemData);
|
||||||
if (code) {
|
if (code) {
|
||||||
tsdbError("vgId:%d failed to create/get table data since %s", TD_VID(pTsdb->pVnode), tstrerror(code));
|
tsdbError("vgId:%d, failed to create/get table data since %s", TD_VID(pTsdb->pVnode), tstrerror(code));
|
||||||
goto _err;
|
goto _err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -199,13 +199,13 @@ int32_t tsdbDeleteTableData2(STsdb *pTsdb, int64_t version, tb_uid_t suid, tb_ui
|
||||||
// update the state of pMemTable, pMemData, last and lastrow (todo)
|
// update the state of pMemTable, pMemData, last and lastrow (todo)
|
||||||
}
|
}
|
||||||
|
|
||||||
tsdbDebug("vgId:%d delete data from table suid:%" PRId64 " uid:%" PRId64 " sKey:%" PRId64 " eKey:%" PRId64
|
tsdbDebug("vgId:%d, delete data from table suid:%" PRId64 " uid:%" PRId64 " sKey:%" PRId64 " eKey:%" PRId64
|
||||||
" since %s",
|
" since %s",
|
||||||
TD_VID(pTsdb->pVnode), suid, uid, sKey, eKey, tstrerror(code));
|
TD_VID(pTsdb->pVnode), suid, uid, sKey, eKey, tstrerror(code));
|
||||||
return code;
|
return code;
|
||||||
|
|
||||||
_err:
|
_err:
|
||||||
tsdbError("vgId:%d failed to delete data from table suid:%" PRId64 " uid:%" PRId64 " sKey:%" PRId64 " eKey:%" PRId64
|
tsdbError("vgId:%d, failed to delete data from table suid:%" PRId64 " uid:%" PRId64 " sKey:%" PRId64 " eKey:%" PRId64
|
||||||
" since %s",
|
" since %s",
|
||||||
TD_VID(pTsdb->pVnode), suid, uid, sKey, eKey, tstrerror(code));
|
TD_VID(pTsdb->pVnode), suid, uid, sKey, eKey, tstrerror(code));
|
||||||
return code;
|
return code;
|
||||||
|
|
|
@ -74,7 +74,7 @@ int tsdbOpen(SVnode *pVnode, STsdb **ppTsdb, const char *dir, STsdbKeepCfg *pKee
|
||||||
goto _err;
|
goto _err;
|
||||||
}
|
}
|
||||||
|
|
||||||
tsdbDebug("vgId:%d tsdb is opened for %s, days:%d, keep:%d,%d,%d", TD_VID(pVnode), pTsdb->path, pTsdb->keepCfg.days,
|
tsdbDebug("vgId:%d, tsdb is opened for %s, days:%d, keep:%d,%d,%d", TD_VID(pVnode), pTsdb->path, pTsdb->keepCfg.days,
|
||||||
pTsdb->keepCfg.keep0, pTsdb->keepCfg.keep1, pTsdb->keepCfg.keep2);
|
pTsdb->keepCfg.keep0, pTsdb->keepCfg.keep1, pTsdb->keepCfg.keep2);
|
||||||
|
|
||||||
*ppTsdb = pTsdb;
|
*ppTsdb = pTsdb;
|
||||||
|
@ -99,7 +99,7 @@ int tsdbClose(STsdb **pTsdb) {
|
||||||
int tsdbLockRepo(STsdb *pTsdb) {
|
int tsdbLockRepo(STsdb *pTsdb) {
|
||||||
int code = taosThreadMutexLock(&pTsdb->mutex);
|
int code = taosThreadMutexLock(&pTsdb->mutex);
|
||||||
if (code != 0) {
|
if (code != 0) {
|
||||||
tsdbError("vgId:%d failed to lock tsdb since %s", REPO_ID(pTsdb), strerror(errno));
|
tsdbError("vgId:%d, failed to lock tsdb since %s", REPO_ID(pTsdb), strerror(errno));
|
||||||
terrno = TAOS_SYSTEM_ERROR(code);
|
terrno = TAOS_SYSTEM_ERROR(code);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@ -112,7 +112,7 @@ int tsdbUnlockRepo(STsdb *pTsdb) {
|
||||||
pTsdb->repoLocked = false;
|
pTsdb->repoLocked = false;
|
||||||
int code = taosThreadMutexUnlock(&pTsdb->mutex);
|
int code = taosThreadMutexUnlock(&pTsdb->mutex);
|
||||||
if (code != 0) {
|
if (code != 0) {
|
||||||
tsdbError("vgId:%d failed to unlock tsdb since %s", REPO_ID(pTsdb), strerror(errno));
|
tsdbError("vgId:%d, failed to unlock tsdb since %s", REPO_ID(pTsdb), strerror(errno));
|
||||||
terrno = TAOS_SYSTEM_ERROR(code);
|
terrno = TAOS_SYSTEM_ERROR(code);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -352,15 +352,15 @@ static STsdb* getTsdbByRetentions(SVnode* pVnode, STsdbReadHandle* pReadHandle,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (level == TSDB_RETENTION_L0) {
|
if (level == TSDB_RETENTION_L0) {
|
||||||
tsdbDebug("vgId:%d read handle %p rsma level %d is selected to query", TD_VID(pVnode), pReadHandle,
|
tsdbDebug("vgId:%d, read handle %p rsma level %d is selected to query", TD_VID(pVnode), pReadHandle,
|
||||||
TSDB_RETENTION_L0);
|
TSDB_RETENTION_L0);
|
||||||
return VND_RSMA0(pVnode);
|
return VND_RSMA0(pVnode);
|
||||||
} else if (level == TSDB_RETENTION_L1) {
|
} else if (level == TSDB_RETENTION_L1) {
|
||||||
tsdbDebug("vgId:%d read handle %p rsma level %d is selected to query", TD_VID(pVnode), pReadHandle,
|
tsdbDebug("vgId:%d, read handle %p rsma level %d is selected to query", TD_VID(pVnode), pReadHandle,
|
||||||
TSDB_RETENTION_L1);
|
TSDB_RETENTION_L1);
|
||||||
return VND_RSMA1(pVnode);
|
return VND_RSMA1(pVnode);
|
||||||
} else {
|
} else {
|
||||||
tsdbDebug("vgId:%d read handle %p rsma level %d is selected to query", TD_VID(pVnode), pReadHandle,
|
tsdbDebug("vgId:%d, read handle %p rsma level %d is selected to query", TD_VID(pVnode), pReadHandle,
|
||||||
TSDB_RETENTION_L2);
|
TSDB_RETENTION_L2);
|
||||||
return VND_RSMA2(pVnode);
|
return VND_RSMA2(pVnode);
|
||||||
}
|
}
|
||||||
|
@ -3555,7 +3555,7 @@ int32_t tsdbRetrieveDataBlockStatisInfo(tsdbReaderT* pTsdbReadHandle, SColumnDat
|
||||||
return TSDB_CODE_SUCCESS;
|
return TSDB_CODE_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
tsdbDebug("vgId:%d succeed to load block statis part for uid %" PRIu64, REPO_ID(pHandle->pTsdb),
|
tsdbDebug("vgId:%d, succeed to load block statis part for uid %" PRIu64, REPO_ID(pHandle->pTsdb),
|
||||||
TSDB_READ_TABLE_UID(&pHandle->rhelper));
|
TSDB_READ_TABLE_UID(&pHandle->rhelper));
|
||||||
|
|
||||||
int16_t* colIds = pHandle->suppInfo.defaultLoadColumn->pData;
|
int16_t* colIds = pHandle->suppInfo.defaultLoadColumn->pData;
|
||||||
|
|
|
@ -87,7 +87,7 @@ int tsdbSetAndOpenReadFSet(SReadH *pReadh, SDFileSet *pSet) {
|
||||||
TSDB_FSET_SET_CLOSED(TSDB_READ_FSET(pReadh));
|
TSDB_FSET_SET_CLOSED(TSDB_READ_FSET(pReadh));
|
||||||
// if (tsdbOpenDFileSet(TSDB_READ_FSET(pReadh), O_RDONLY) < 0) {
|
// if (tsdbOpenDFileSet(TSDB_READ_FSET(pReadh), O_RDONLY) < 0) {
|
||||||
if (tsdbOpenDFileSet(TSDB_READ_FSET(pReadh), TD_FILE_READ) < 0) {
|
if (tsdbOpenDFileSet(TSDB_READ_FSET(pReadh), TD_FILE_READ) < 0) {
|
||||||
tsdbError("vgId:%d failed to open file set %d since %s", TSDB_READ_REPO_ID(pReadh), TSDB_FSET_FID(pSet),
|
tsdbError("vgId:%d, failed to open file set %d since %s", TSDB_READ_REPO_ID(pReadh), TSDB_FSET_FID(pSet),
|
||||||
tstrerror(terrno));
|
tstrerror(terrno));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@ -107,7 +107,7 @@ int tsdbLoadBlockIdx(SReadH *pReadh) {
|
||||||
if (pHeadf->info.offset <= 0) return 0;
|
if (pHeadf->info.offset <= 0) return 0;
|
||||||
|
|
||||||
if (tsdbSeekDFile(pHeadf, pHeadf->info.offset, SEEK_SET) < 0) {
|
if (tsdbSeekDFile(pHeadf, pHeadf->info.offset, SEEK_SET) < 0) {
|
||||||
tsdbError("vgId:%d failed to load SBlockIdx part while seek file %s since %s, offset:%u len :%u",
|
tsdbError("vgId:%d, failed to load SBlockIdx part while seek file %s since %s, offset:%u len :%u",
|
||||||
TSDB_READ_REPO_ID(pReadh), TSDB_FILE_FULL_NAME(pHeadf), tstrerror(terrno), pHeadf->info.offset,
|
TSDB_READ_REPO_ID(pReadh), TSDB_FILE_FULL_NAME(pHeadf), tstrerror(terrno), pHeadf->info.offset,
|
||||||
pHeadf->info.len);
|
pHeadf->info.len);
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -117,7 +117,7 @@ int tsdbLoadBlockIdx(SReadH *pReadh) {
|
||||||
|
|
||||||
int64_t nread = tsdbReadDFile(pHeadf, TSDB_READ_BUF(pReadh), pHeadf->info.len);
|
int64_t nread = tsdbReadDFile(pHeadf, TSDB_READ_BUF(pReadh), pHeadf->info.len);
|
||||||
if (nread < 0) {
|
if (nread < 0) {
|
||||||
tsdbError("vgId:%d failed to load SBlockIdx part while read file %s since %s, offset:%u len :%u",
|
tsdbError("vgId:%d, failed to load SBlockIdx part while read file %s since %s, offset:%u len :%u",
|
||||||
TSDB_READ_REPO_ID(pReadh), TSDB_FILE_FULL_NAME(pHeadf), tstrerror(terrno), pHeadf->info.offset,
|
TSDB_READ_REPO_ID(pReadh), TSDB_FILE_FULL_NAME(pHeadf), tstrerror(terrno), pHeadf->info.offset,
|
||||||
pHeadf->info.len);
|
pHeadf->info.len);
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -125,14 +125,14 @@ int tsdbLoadBlockIdx(SReadH *pReadh) {
|
||||||
|
|
||||||
if (nread < pHeadf->info.len) {
|
if (nread < pHeadf->info.len) {
|
||||||
terrno = TSDB_CODE_TDB_FILE_CORRUPTED;
|
terrno = TSDB_CODE_TDB_FILE_CORRUPTED;
|
||||||
tsdbError("vgId:%d SBlockIdx part in file %s is corrupted, offset:%u expected bytes:%u read bytes: %" PRId64,
|
tsdbError("vgId:%d, SBlockIdx part in file %s is corrupted, offset:%u expected bytes:%u read bytes: %" PRId64,
|
||||||
TSDB_READ_REPO_ID(pReadh), TSDB_FILE_FULL_NAME(pHeadf), pHeadf->info.offset, pHeadf->info.len, nread);
|
TSDB_READ_REPO_ID(pReadh), TSDB_FILE_FULL_NAME(pHeadf), pHeadf->info.offset, pHeadf->info.len, nread);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!taosCheckChecksumWhole((uint8_t *)TSDB_READ_BUF(pReadh), pHeadf->info.len)) {
|
if (!taosCheckChecksumWhole((uint8_t *)TSDB_READ_BUF(pReadh), pHeadf->info.len)) {
|
||||||
terrno = TSDB_CODE_TDB_FILE_CORRUPTED;
|
terrno = TSDB_CODE_TDB_FILE_CORRUPTED;
|
||||||
tsdbError("vgId:%d SBlockIdx part in file %s is corrupted since wrong checksum, offset:%u len :%u",
|
tsdbError("vgId:%d, SBlockIdx part in file %s is corrupted since wrong checksum, offset:%u len :%u",
|
||||||
TSDB_READ_REPO_ID(pReadh), TSDB_FILE_FULL_NAME(pHeadf), pHeadf->info.offset, pHeadf->info.len);
|
TSDB_READ_REPO_ID(pReadh), TSDB_FILE_FULL_NAME(pHeadf), pHeadf->info.offset, pHeadf->info.len);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@ -209,7 +209,7 @@ int tsdbLoadBlockInfo(SReadH *pReadh, void *pTarget) {
|
||||||
SBlockIdx *pBlkIdx = pReadh->pBlkIdx;
|
SBlockIdx *pBlkIdx = pReadh->pBlkIdx;
|
||||||
|
|
||||||
if (tsdbSeekDFile(pHeadf, pBlkIdx->offset, SEEK_SET) < 0) {
|
if (tsdbSeekDFile(pHeadf, pBlkIdx->offset, SEEK_SET) < 0) {
|
||||||
tsdbError("vgId:%d failed to load SBlockInfo part while seek file %s since %s, offset:%u len:%u",
|
tsdbError("vgId:%d, failed to load SBlockInfo part while seek file %s since %s, offset:%u len:%u",
|
||||||
TSDB_READ_REPO_ID(pReadh), TSDB_FILE_FULL_NAME(pHeadf), tstrerror(terrno), pBlkIdx->offset, pBlkIdx->len);
|
TSDB_READ_REPO_ID(pReadh), TSDB_FILE_FULL_NAME(pHeadf), tstrerror(terrno), pBlkIdx->offset, pBlkIdx->len);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@ -218,21 +218,21 @@ int tsdbLoadBlockInfo(SReadH *pReadh, void *pTarget) {
|
||||||
|
|
||||||
int64_t nread = tsdbReadDFile(pHeadf, (void *)(pReadh->pBlkInfo), pBlkIdx->len);
|
int64_t nread = tsdbReadDFile(pHeadf, (void *)(pReadh->pBlkInfo), pBlkIdx->len);
|
||||||
if (nread < 0) {
|
if (nread < 0) {
|
||||||
tsdbError("vgId:%d failed to load SBlockInfo part while read file %s since %s, offset:%u len :%u",
|
tsdbError("vgId:%d, failed to load SBlockInfo part while read file %s since %s, offset:%u len :%u",
|
||||||
TSDB_READ_REPO_ID(pReadh), TSDB_FILE_FULL_NAME(pHeadf), tstrerror(terrno), pBlkIdx->offset, pBlkIdx->len);
|
TSDB_READ_REPO_ID(pReadh), TSDB_FILE_FULL_NAME(pHeadf), tstrerror(terrno), pBlkIdx->offset, pBlkIdx->len);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (nread < pBlkIdx->len) {
|
if (nread < pBlkIdx->len) {
|
||||||
terrno = TSDB_CODE_TDB_FILE_CORRUPTED;
|
terrno = TSDB_CODE_TDB_FILE_CORRUPTED;
|
||||||
tsdbError("vgId:%d SBlockInfo part in file %s is corrupted, offset:%u expected bytes:%u read bytes:%" PRId64,
|
tsdbError("vgId:%d, SBlockInfo part in file %s is corrupted, offset:%u expected bytes:%u read bytes:%" PRId64,
|
||||||
TSDB_READ_REPO_ID(pReadh), TSDB_FILE_FULL_NAME(pHeadf), pBlkIdx->offset, pBlkIdx->len, nread);
|
TSDB_READ_REPO_ID(pReadh), TSDB_FILE_FULL_NAME(pHeadf), pBlkIdx->offset, pBlkIdx->len, nread);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!taosCheckChecksumWhole((uint8_t *)(pReadh->pBlkInfo), pBlkIdx->len)) {
|
if (!taosCheckChecksumWhole((uint8_t *)(pReadh->pBlkInfo), pBlkIdx->len)) {
|
||||||
terrno = TSDB_CODE_TDB_FILE_CORRUPTED;
|
terrno = TSDB_CODE_TDB_FILE_CORRUPTED;
|
||||||
tsdbError("vgId:%d SBlockInfo part in file %s is corrupted since wrong checksum, offset:%u len :%u",
|
tsdbError("vgId:%d, SBlockInfo part in file %s is corrupted since wrong checksum, offset:%u len :%u",
|
||||||
TSDB_READ_REPO_ID(pReadh), TSDB_FILE_FULL_NAME(pHeadf), pBlkIdx->offset, pBlkIdx->len);
|
TSDB_READ_REPO_ID(pReadh), TSDB_FILE_FULL_NAME(pHeadf), pBlkIdx->offset, pBlkIdx->len);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@ -467,7 +467,7 @@ int tsdbLoadBlockStatis(SReadH *pReadh, SBlock *pBlock) {
|
||||||
ASSERT(pBlock->numOfSubBlocks <= 1);
|
ASSERT(pBlock->numOfSubBlocks <= 1);
|
||||||
|
|
||||||
if (!pBlock->aggrStat) {
|
if (!pBlock->aggrStat) {
|
||||||
tsdbDebug("vgId:%d no need to load block statis part for uid %" PRIu64 " since not exist", REPO_ID(pReadh->pRepo),
|
tsdbDebug("vgId:%d, no need to load block statis part for uid %" PRIu64 " since not exist", REPO_ID(pReadh->pRepo),
|
||||||
TSDB_READ_TABLE_UID(pReadh));
|
TSDB_READ_TABLE_UID(pReadh));
|
||||||
return TSDB_STATIS_NONE;
|
return TSDB_STATIS_NONE;
|
||||||
}
|
}
|
||||||
|
@ -475,7 +475,7 @@ int tsdbLoadBlockStatis(SReadH *pReadh, SBlock *pBlock) {
|
||||||
SDFile *pDFileAggr = pBlock->last ? TSDB_READ_SMAL_FILE(pReadh) : TSDB_READ_SMAD_FILE(pReadh);
|
SDFile *pDFileAggr = pBlock->last ? TSDB_READ_SMAL_FILE(pReadh) : TSDB_READ_SMAD_FILE(pReadh);
|
||||||
|
|
||||||
if (tsdbSeekDFile(pDFileAggr, pBlock->aggrOffset, SEEK_SET) < 0) {
|
if (tsdbSeekDFile(pDFileAggr, pBlock->aggrOffset, SEEK_SET) < 0) {
|
||||||
tsdbError("vgId:%d failed to load block statis part for uid %" PRIu64 " while seek file %s to offset %" PRIu64
|
tsdbError("vgId:%d, failed to load block statis part for uid %" PRIu64 " while seek file %s to offset %" PRIu64
|
||||||
" since %s",
|
" since %s",
|
||||||
TSDB_READ_REPO_ID(pReadh), TSDB_READ_TABLE_UID(pReadh), TSDB_FILE_FULL_NAME(pDFileAggr),
|
TSDB_READ_REPO_ID(pReadh), TSDB_READ_TABLE_UID(pReadh), TSDB_FILE_FULL_NAME(pDFileAggr),
|
||||||
(uint64_t)pBlock->aggrOffset, tstrerror(terrno));
|
(uint64_t)pBlock->aggrOffset, tstrerror(terrno));
|
||||||
|
@ -487,7 +487,7 @@ int tsdbLoadBlockStatis(SReadH *pReadh, SBlock *pBlock) {
|
||||||
|
|
||||||
int64_t nreadAggr = tsdbReadDFile(pDFileAggr, (void *)(pReadh->pAggrBlkData), sizeAggr);
|
int64_t nreadAggr = tsdbReadDFile(pDFileAggr, (void *)(pReadh->pAggrBlkData), sizeAggr);
|
||||||
if (nreadAggr < 0) {
|
if (nreadAggr < 0) {
|
||||||
tsdbError("vgId:%d failed to load block statis part for uid %" PRIu64
|
tsdbError("vgId:%d, failed to load block statis part for uid %" PRIu64
|
||||||
" while read file %s since %s, offset:%" PRIu64 " len :%" PRIzu,
|
" while read file %s since %s, offset:%" PRIu64 " len :%" PRIzu,
|
||||||
TSDB_READ_REPO_ID(pReadh), TSDB_READ_TABLE_UID(pReadh), TSDB_FILE_FULL_NAME(pDFileAggr),
|
TSDB_READ_REPO_ID(pReadh), TSDB_READ_TABLE_UID(pReadh), TSDB_FILE_FULL_NAME(pDFileAggr),
|
||||||
tstrerror(terrno), (uint64_t)pBlock->aggrOffset, sizeAggr);
|
tstrerror(terrno), (uint64_t)pBlock->aggrOffset, sizeAggr);
|
||||||
|
@ -496,7 +496,7 @@ int tsdbLoadBlockStatis(SReadH *pReadh, SBlock *pBlock) {
|
||||||
|
|
||||||
if (nreadAggr < sizeAggr) {
|
if (nreadAggr < sizeAggr) {
|
||||||
terrno = TSDB_CODE_TDB_FILE_CORRUPTED;
|
terrno = TSDB_CODE_TDB_FILE_CORRUPTED;
|
||||||
tsdbError("vgId:%d block statis part for uid %" PRIu64 " in file %s is corrupted, offset:%" PRIu64
|
tsdbError("vgId:%d, block statis part for uid %" PRIu64 " in file %s is corrupted, offset:%" PRIu64
|
||||||
" expected bytes:%" PRIzu " read bytes: %" PRId64,
|
" expected bytes:%" PRIzu " read bytes: %" PRId64,
|
||||||
TSDB_READ_REPO_ID(pReadh), TSDB_READ_TABLE_UID(pReadh), TSDB_FILE_FULL_NAME(pDFileAggr),
|
TSDB_READ_REPO_ID(pReadh), TSDB_READ_TABLE_UID(pReadh), TSDB_FILE_FULL_NAME(pDFileAggr),
|
||||||
(uint64_t)pBlock->aggrOffset, sizeAggr, nreadAggr);
|
(uint64_t)pBlock->aggrOffset, sizeAggr, nreadAggr);
|
||||||
|
@ -505,7 +505,7 @@ int tsdbLoadBlockStatis(SReadH *pReadh, SBlock *pBlock) {
|
||||||
|
|
||||||
if (!taosCheckChecksumWhole((uint8_t *)(pReadh->pAggrBlkData), (uint32_t)sizeAggr)) {
|
if (!taosCheckChecksumWhole((uint8_t *)(pReadh->pAggrBlkData), (uint32_t)sizeAggr)) {
|
||||||
terrno = TSDB_CODE_TDB_FILE_CORRUPTED;
|
terrno = TSDB_CODE_TDB_FILE_CORRUPTED;
|
||||||
tsdbError("vgId:%d block statis part for uid %" PRIu64
|
tsdbError("vgId:%d, block statis part for uid %" PRIu64
|
||||||
"in file %s is corrupted since wrong checksum, offset:%" PRIu64 " len :%" PRIzu,
|
"in file %s is corrupted since wrong checksum, offset:%" PRIu64 " len :%" PRIzu,
|
||||||
TSDB_READ_REPO_ID(pReadh), TSDB_READ_TABLE_UID(pReadh), TSDB_FILE_FULL_NAME(pDFileAggr),
|
TSDB_READ_REPO_ID(pReadh), TSDB_READ_TABLE_UID(pReadh), TSDB_FILE_FULL_NAME(pDFileAggr),
|
||||||
(uint64_t)pBlock->aggrOffset, sizeAggr);
|
(uint64_t)pBlock->aggrOffset, sizeAggr);
|
||||||
|
@ -518,7 +518,7 @@ static int tsdbLoadBlockOffset(SReadH *pReadh, SBlock *pBlock) {
|
||||||
ASSERT(pBlock->numOfSubBlocks <= 1);
|
ASSERT(pBlock->numOfSubBlocks <= 1);
|
||||||
SDFile *pDFile = (pBlock->last) ? TSDB_READ_LAST_FILE(pReadh) : TSDB_READ_DATA_FILE(pReadh);
|
SDFile *pDFile = (pBlock->last) ? TSDB_READ_LAST_FILE(pReadh) : TSDB_READ_DATA_FILE(pReadh);
|
||||||
if (tsdbSeekDFile(pDFile, pBlock->offset, SEEK_SET) < 0) {
|
if (tsdbSeekDFile(pDFile, pBlock->offset, SEEK_SET) < 0) {
|
||||||
tsdbError("vgId:%d failed to load block head part while seek file %s to offset %" PRId64 " since %s",
|
tsdbError("vgId:%d, failed to load block head part while seek file %s to offset %" PRId64 " since %s",
|
||||||
TSDB_READ_REPO_ID(pReadh), TSDB_FILE_FULL_NAME(pDFile), (int64_t)pBlock->offset, tstrerror(terrno));
|
TSDB_READ_REPO_ID(pReadh), TSDB_FILE_FULL_NAME(pDFile), (int64_t)pBlock->offset, tstrerror(terrno));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@ -528,14 +528,14 @@ static int tsdbLoadBlockOffset(SReadH *pReadh, SBlock *pBlock) {
|
||||||
|
|
||||||
int64_t nread = tsdbReadDFile(pDFile, (void *)(pReadh->pBlkData), size);
|
int64_t nread = tsdbReadDFile(pDFile, (void *)(pReadh->pBlkData), size);
|
||||||
if (nread < 0) {
|
if (nread < 0) {
|
||||||
tsdbError("vgId:%d failed to load block head part while read file %s since %s, offset:%" PRId64 " len :%" PRIzu,
|
tsdbError("vgId:%d, failed to load block head part while read file %s since %s, offset:%" PRId64 " len :%" PRIzu,
|
||||||
TSDB_READ_REPO_ID(pReadh), TSDB_FILE_FULL_NAME(pDFile), tstrerror(terrno), (int64_t)pBlock->offset, size);
|
TSDB_READ_REPO_ID(pReadh), TSDB_FILE_FULL_NAME(pDFile), tstrerror(terrno), (int64_t)pBlock->offset, size);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (nread < size) {
|
if (nread < size) {
|
||||||
terrno = TSDB_CODE_TDB_FILE_CORRUPTED;
|
terrno = TSDB_CODE_TDB_FILE_CORRUPTED;
|
||||||
tsdbError("vgId:%d block head part in file %s is corrupted, offset:%" PRId64 " expected bytes:%" PRIzu
|
tsdbError("vgId:%d, block head part in file %s is corrupted, offset:%" PRId64 " expected bytes:%" PRIzu
|
||||||
" read bytes: %" PRId64,
|
" read bytes: %" PRId64,
|
||||||
TSDB_READ_REPO_ID(pReadh), TSDB_FILE_FULL_NAME(pDFile), (int64_t)pBlock->offset, size, nread);
|
TSDB_READ_REPO_ID(pReadh), TSDB_FILE_FULL_NAME(pDFile), (int64_t)pBlock->offset, size, nread);
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -543,7 +543,7 @@ static int tsdbLoadBlockOffset(SReadH *pReadh, SBlock *pBlock) {
|
||||||
|
|
||||||
if (!taosCheckChecksumWhole((uint8_t *)(pReadh->pBlkData), (uint32_t)size)) {
|
if (!taosCheckChecksumWhole((uint8_t *)(pReadh->pBlkData), (uint32_t)size)) {
|
||||||
terrno = TSDB_CODE_TDB_FILE_CORRUPTED;
|
terrno = TSDB_CODE_TDB_FILE_CORRUPTED;
|
||||||
tsdbError("vgId:%d block head part in file %s is corrupted since wrong checksum, offset:%" PRId64 " len :%" PRIzu,
|
tsdbError("vgId:%d, block head part in file %s is corrupted since wrong checksum, offset:%" PRId64 " len :%" PRIzu,
|
||||||
TSDB_READ_REPO_ID(pReadh), TSDB_FILE_FULL_NAME(pDFile), (int64_t)pBlock->offset, size);
|
TSDB_READ_REPO_ID(pReadh), TSDB_FILE_FULL_NAME(pDFile), (int64_t)pBlock->offset, size);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@ -671,14 +671,14 @@ static int tsdbLoadBlockDataImpl(SReadH *pReadh, SBlock *pBlock, SDataCols *pDat
|
||||||
SBlockData *pBlockData = (SBlockData *)TSDB_READ_BUF(pReadh);
|
SBlockData *pBlockData = (SBlockData *)TSDB_READ_BUF(pReadh);
|
||||||
|
|
||||||
if (tsdbSeekDFile(pDFile, pBlock->offset, SEEK_SET) < 0) {
|
if (tsdbSeekDFile(pDFile, pBlock->offset, SEEK_SET) < 0) {
|
||||||
tsdbError("vgId:%d failed to load block data part while seek file %s to offset %" PRId64 " since %s",
|
tsdbError("vgId:%d, failed to load block data part while seek file %s to offset %" PRId64 " since %s",
|
||||||
TSDB_READ_REPO_ID(pReadh), TSDB_FILE_FULL_NAME(pDFile), (int64_t)pBlock->offset, tstrerror(terrno));
|
TSDB_READ_REPO_ID(pReadh), TSDB_FILE_FULL_NAME(pDFile), (int64_t)pBlock->offset, tstrerror(terrno));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int64_t nread = tsdbReadDFile(pDFile, TSDB_READ_BUF(pReadh), pBlock->len);
|
int64_t nread = tsdbReadDFile(pDFile, TSDB_READ_BUF(pReadh), pBlock->len);
|
||||||
if (nread < 0) {
|
if (nread < 0) {
|
||||||
tsdbError("vgId:%d failed to load block data part while read file %s since %s, offset:%" PRId64 " len :%d",
|
tsdbError("vgId:%d, failed to load block data part while read file %s since %s, offset:%" PRId64 " len :%d",
|
||||||
TSDB_READ_REPO_ID(pReadh), TSDB_FILE_FULL_NAME(pDFile), tstrerror(terrno), (int64_t)pBlock->offset,
|
TSDB_READ_REPO_ID(pReadh), TSDB_FILE_FULL_NAME(pDFile), tstrerror(terrno), (int64_t)pBlock->offset,
|
||||||
pBlock->len);
|
pBlock->len);
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -686,7 +686,7 @@ static int tsdbLoadBlockDataImpl(SReadH *pReadh, SBlock *pBlock, SDataCols *pDat
|
||||||
|
|
||||||
if (nread < pBlock->len) {
|
if (nread < pBlock->len) {
|
||||||
terrno = TSDB_CODE_TDB_FILE_CORRUPTED;
|
terrno = TSDB_CODE_TDB_FILE_CORRUPTED;
|
||||||
tsdbError("vgId:%d block data part in file %s is corrupted, offset:%" PRId64
|
tsdbError("vgId:%d, block data part in file %s is corrupted, offset:%" PRId64
|
||||||
" expected bytes:%d read bytes: %" PRId64,
|
" expected bytes:%d read bytes: %" PRId64,
|
||||||
TSDB_READ_REPO_ID(pReadh), TSDB_FILE_FULL_NAME(pDFile), (int64_t)pBlock->offset, pBlock->len, nread);
|
TSDB_READ_REPO_ID(pReadh), TSDB_FILE_FULL_NAME(pDFile), (int64_t)pBlock->offset, pBlock->len, nread);
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -695,7 +695,7 @@ static int tsdbLoadBlockDataImpl(SReadH *pReadh, SBlock *pBlock, SDataCols *pDat
|
||||||
int32_t tsize = (int32_t)tsdbBlockStatisSize(pBlock->numOfCols, (uint32_t)pBlock->blkVer);
|
int32_t tsize = (int32_t)tsdbBlockStatisSize(pBlock->numOfCols, (uint32_t)pBlock->blkVer);
|
||||||
if (!taosCheckChecksumWhole((uint8_t *)TSDB_READ_BUF(pReadh), tsize)) {
|
if (!taosCheckChecksumWhole((uint8_t *)TSDB_READ_BUF(pReadh), tsize)) {
|
||||||
terrno = TSDB_CODE_TDB_FILE_CORRUPTED;
|
terrno = TSDB_CODE_TDB_FILE_CORRUPTED;
|
||||||
tsdbError("vgId:%d block head part in file %s is corrupted since wrong checksum, offset:%" PRId64 " len :%d",
|
tsdbError("vgId:%d, block head part in file %s is corrupted since wrong checksum, offset:%" PRId64 " len :%d",
|
||||||
TSDB_READ_REPO_ID(pReadh), TSDB_FILE_FULL_NAME(pDFile), (int64_t)pBlock->offset, tsize);
|
TSDB_READ_REPO_ID(pReadh), TSDB_FILE_FULL_NAME(pDFile), (int64_t)pBlock->offset, tsize);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@ -750,7 +750,7 @@ static int tsdbLoadBlockDataImpl(SReadH *pReadh, SBlock *pBlock, SDataCols *pDat
|
||||||
pBlockCol ? pBlockCol->blen : 0, pBlock->algorithm, pBlock->numOfRows,
|
pBlockCol ? pBlockCol->blen : 0, pBlock->algorithm, pBlock->numOfRows,
|
||||||
tLenBitmap, pDataCols->maxPoints, TSDB_READ_COMP_BUF(pReadh),
|
tLenBitmap, pDataCols->maxPoints, TSDB_READ_COMP_BUF(pReadh),
|
||||||
(int)taosTSizeof(TSDB_READ_COMP_BUF(pReadh))) < 0) {
|
(int)taosTSizeof(TSDB_READ_COMP_BUF(pReadh))) < 0) {
|
||||||
tsdbError("vgId:%d file %s is broken at column %d block offset %" PRId64 " column offset %u",
|
tsdbError("vgId:%d, file %s is broken at column %d block offset %" PRId64 " column offset %u",
|
||||||
TSDB_READ_REPO_ID(pReadh), TSDB_FILE_FULL_NAME(pDFile), tcolId, (int64_t)pBlock->offset, toffset);
|
TSDB_READ_REPO_ID(pReadh), TSDB_FILE_FULL_NAME(pDFile), tcolId, (int64_t)pBlock->offset, toffset);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@ -945,21 +945,21 @@ static int tsdbLoadColData(SReadH *pReadh, SDFile *pDFile, SBlock *pBlock, SBloc
|
||||||
int64_t offset = pBlock->offset + tsdbBlockStatisSize(pBlock->numOfCols, (uint32_t)pBlock->blkVer) +
|
int64_t offset = pBlock->offset + tsdbBlockStatisSize(pBlock->numOfCols, (uint32_t)pBlock->blkVer) +
|
||||||
tsdbGetBlockColOffset(pBlockCol);
|
tsdbGetBlockColOffset(pBlockCol);
|
||||||
if (tsdbSeekDFile(pDFile, offset, SEEK_SET) < 0) {
|
if (tsdbSeekDFile(pDFile, offset, SEEK_SET) < 0) {
|
||||||
tsdbError("vgId:%d failed to load block column data while seek file %s to offset %" PRId64 " since %s",
|
tsdbError("vgId:%d, failed to load block column data while seek file %s to offset %" PRId64 " since %s",
|
||||||
TSDB_READ_REPO_ID(pReadh), TSDB_FILE_FULL_NAME(pDFile), offset, tstrerror(terrno));
|
TSDB_READ_REPO_ID(pReadh), TSDB_FILE_FULL_NAME(pDFile), offset, tstrerror(terrno));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int64_t nread = tsdbReadDFile(pDFile, TSDB_READ_BUF(pReadh), pBlockCol->len);
|
int64_t nread = tsdbReadDFile(pDFile, TSDB_READ_BUF(pReadh), pBlockCol->len);
|
||||||
if (nread < 0) {
|
if (nread < 0) {
|
||||||
tsdbError("vgId:%d failed to load block column data while read file %s since %s, offset:%" PRId64 " len :%d",
|
tsdbError("vgId:%d, failed to load block column data while read file %s since %s, offset:%" PRId64 " len :%d",
|
||||||
TSDB_READ_REPO_ID(pReadh), TSDB_FILE_FULL_NAME(pDFile), tstrerror(terrno), offset, pBlockCol->len);
|
TSDB_READ_REPO_ID(pReadh), TSDB_FILE_FULL_NAME(pDFile), tstrerror(terrno), offset, pBlockCol->len);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (nread < pBlockCol->len) {
|
if (nread < pBlockCol->len) {
|
||||||
terrno = TSDB_CODE_TDB_FILE_CORRUPTED;
|
terrno = TSDB_CODE_TDB_FILE_CORRUPTED;
|
||||||
tsdbError("vgId:%d block column data in file %s is corrupted, offset:%" PRId64 " expected bytes:%d" PRIzu
|
tsdbError("vgId:%d, block column data in file %s is corrupted, offset:%" PRId64 " expected bytes:%d" PRIzu
|
||||||
" read bytes: %" PRId64,
|
" read bytes: %" PRId64,
|
||||||
TSDB_READ_REPO_ID(pReadh), TSDB_FILE_FULL_NAME(pDFile), offset, pBlockCol->len, nread);
|
TSDB_READ_REPO_ID(pReadh), TSDB_FILE_FULL_NAME(pDFile), offset, pBlockCol->len, nread);
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -968,7 +968,7 @@ static int tsdbLoadColData(SReadH *pReadh, SDFile *pDFile, SBlock *pBlock, SBloc
|
||||||
if (tsdbCheckAndDecodeColumnData(pDataCol, pReadh->pBuf, pBlockCol->len, pBlockCol->blen, pBlock->algorithm,
|
if (tsdbCheckAndDecodeColumnData(pDataCol, pReadh->pBuf, pBlockCol->len, pBlockCol->blen, pBlock->algorithm,
|
||||||
pBlock->numOfRows, tLenBitmap, pCfg->maxRows, pReadh->pCBuf,
|
pBlock->numOfRows, tLenBitmap, pCfg->maxRows, pReadh->pCBuf,
|
||||||
(int32_t)taosTSizeof(pReadh->pCBuf)) < 0) {
|
(int32_t)taosTSizeof(pReadh->pCBuf)) < 0) {
|
||||||
tsdbError("vgId:%d file %s is broken at column %d offset %" PRId64, REPO_ID(pRepo), TSDB_FILE_FULL_NAME(pDFile),
|
tsdbError("vgId:%d, file %s is broken at column %d offset %" PRId64, REPO_ID(pRepo), TSDB_FILE_FULL_NAME(pDFile),
|
||||||
pBlockCol->colId, offset);
|
pBlockCol->colId, offset);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,7 +28,7 @@ int tsdbInsertData(STsdb *pTsdb, int64_t version, SSubmitReq *pMsg, SSubmitRsp *
|
||||||
// scan and convert
|
// scan and convert
|
||||||
if (tsdbScanAndConvertSubmitMsg(pTsdb, pMsg) < 0) {
|
if (tsdbScanAndConvertSubmitMsg(pTsdb, pMsg) < 0) {
|
||||||
if (terrno != TSDB_CODE_TDB_TABLE_RECONFIGURE) {
|
if (terrno != TSDB_CODE_TDB_TABLE_RECONFIGURE) {
|
||||||
tsdbError("vgId:%d failed to insert data since %s", REPO_ID(pTsdb), tstrerror(terrno));
|
tsdbError("vgId:%d, failed to insert data since %s", REPO_ID(pTsdb), tstrerror(terrno));
|
||||||
}
|
}
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@ -59,7 +59,7 @@ static FORCE_INLINE int tsdbCheckRowRange(STsdb *pTsdb, STable *pTable, STSRow *
|
||||||
TSKEY now) {
|
TSKEY now) {
|
||||||
TSKEY rowKey = TD_ROW_KEY(row);
|
TSKEY rowKey = TD_ROW_KEY(row);
|
||||||
if (rowKey < minKey || rowKey > maxKey) {
|
if (rowKey < minKey || rowKey > maxKey) {
|
||||||
tsdbError("vgId:%d table %s tid %d uid %" PRIu64 " timestamp is out of range! now %" PRId64 " minKey %" PRId64
|
tsdbError("vgId:%d, table %s tid %d uid %" PRIu64 " timestamp is out of range! now %" PRId64 " minKey %" PRId64
|
||||||
" maxKey %" PRId64 " row key %" PRId64,
|
" maxKey %" PRId64 " row key %" PRId64,
|
||||||
REPO_ID(pTsdb), TABLE_CHAR_NAME(pTable), TABLE_TID(pTable), TABLE_UID(pTable), now, minKey, maxKey,
|
REPO_ID(pTsdb), TABLE_CHAR_NAME(pTable), TABLE_TID(pTable), TABLE_UID(pTable), now, minKey, maxKey,
|
||||||
rowKey);
|
rowKey);
|
||||||
|
@ -75,7 +75,7 @@ static FORCE_INLINE int tsdbCheckRowRange(STsdb *pTsdb, tb_uid_t uid, STSRow *ro
|
||||||
TSKEY now) {
|
TSKEY now) {
|
||||||
TSKEY rowKey = TD_ROW_KEY(row);
|
TSKEY rowKey = TD_ROW_KEY(row);
|
||||||
if (rowKey < minKey || rowKey > maxKey) {
|
if (rowKey < minKey || rowKey > maxKey) {
|
||||||
tsdbError("vgId:%d table uid %" PRIu64 " timestamp is out of range! now %" PRId64 " minKey %" PRId64
|
tsdbError("vgId:%d, table uid %" PRIu64 " timestamp is out of range! now %" PRId64 " minKey %" PRId64
|
||||||
" maxKey %" PRId64 " row key %" PRId64,
|
" maxKey %" PRId64 " row key %" PRId64,
|
||||||
REPO_ID(pTsdb), uid, now, minKey, maxKey, rowKey);
|
REPO_ID(pTsdb), uid, now, minKey, maxKey, rowKey);
|
||||||
terrno = TSDB_CODE_TDB_TIMESTAMP_OUT_OF_RANGE;
|
terrno = TSDB_CODE_TDB_TIMESTAMP_OUT_OF_RANGE;
|
||||||
|
@ -115,7 +115,7 @@ int tsdbScanAndConvertSubmitMsg(STsdb *pTsdb, SSubmitReq *pMsg) {
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
if (pBlock->tid <= 0 || pBlock->tid >= pMeta->maxTables) {
|
if (pBlock->tid <= 0 || pBlock->tid >= pMeta->maxTables) {
|
||||||
tsdbError("vgId:%d failed to get table to insert data, uid %" PRIu64 " tid %d", REPO_ID(pTsdb), pBlock->uid,
|
tsdbError("vgId:%d, failed to get table to insert data, uid %" PRIu64 " tid %d", REPO_ID(pTsdb), pBlock->uid,
|
||||||
pBlock->tid);
|
pBlock->tid);
|
||||||
terrno = TSDB_CODE_TDB_INVALID_TABLE_ID;
|
terrno = TSDB_CODE_TDB_INVALID_TABLE_ID;
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -123,14 +123,14 @@ int tsdbScanAndConvertSubmitMsg(STsdb *pTsdb, SSubmitReq *pMsg) {
|
||||||
|
|
||||||
STable *pTable = pMeta->tables[pBlock->tid];
|
STable *pTable = pMeta->tables[pBlock->tid];
|
||||||
if (pTable == NULL || TABLE_UID(pTable) != pBlock->uid) {
|
if (pTable == NULL || TABLE_UID(pTable) != pBlock->uid) {
|
||||||
tsdbError("vgId:%d failed to get table to insert data, uid %" PRIu64 " tid %d", REPO_ID(pTsdb), pBlock->uid,
|
tsdbError("vgId:%d, failed to get table to insert data, uid %" PRIu64 " tid %d", REPO_ID(pTsdb), pBlock->uid,
|
||||||
pBlock->tid);
|
pBlock->tid);
|
||||||
terrno = TSDB_CODE_TDB_INVALID_TABLE_ID;
|
terrno = TSDB_CODE_TDB_INVALID_TABLE_ID;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (TABLE_TYPE(pTable) == TSDB_SUPER_TABLE) {
|
if (TABLE_TYPE(pTable) == TSDB_SUPER_TABLE) {
|
||||||
tsdbError("vgId:%d invalid action trying to insert a super table %s", REPO_ID(pTsdb), TABLE_CHAR_NAME(pTable));
|
tsdbError("vgId:%d, invalid action trying to insert a super table %s", REPO_ID(pTsdb), TABLE_CHAR_NAME(pTable));
|
||||||
terrno = TSDB_CODE_TDB_INVALID_ACTION;
|
terrno = TSDB_CODE_TDB_INVALID_ACTION;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,7 +30,7 @@ int vnodeOpenBufPool(SVnode *pVnode, int64_t size) {
|
||||||
// create pool
|
// create pool
|
||||||
ret = vnodeBufPoolCreate(size, &pPool);
|
ret = vnodeBufPoolCreate(size, &pPool);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
vError("vgId:%d failed to open vnode buffer pool since %s", TD_VID(pVnode), tstrerror(terrno));
|
vError("vgId:%d, failed to open vnode buffer pool since %s", TD_VID(pVnode), tstrerror(terrno));
|
||||||
vnodeCloseBufPool(pVnode);
|
vnodeCloseBufPool(pVnode);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@ -40,7 +40,7 @@ int vnodeOpenBufPool(SVnode *pVnode, int64_t size) {
|
||||||
pVnode->pPool = pPool;
|
pVnode->pPool = pPool;
|
||||||
}
|
}
|
||||||
|
|
||||||
vDebug("vgId:%d vnode buffer pool is opened, pool size: %" PRId64, TD_VID(pVnode), size);
|
vDebug("vgId:%d, vnode buffer pool is opened, pool size: %" PRId64, TD_VID(pVnode), size);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -53,7 +53,7 @@ int vnodeCloseBufPool(SVnode *pVnode) {
|
||||||
vnodeBufPoolDestroy(pPool);
|
vnodeBufPoolDestroy(pPool);
|
||||||
}
|
}
|
||||||
|
|
||||||
vDebug("vgId:%d vnode buffer pool is closed", TD_VID(pVnode));
|
vDebug("vgId:%d, vnode buffer pool is closed", TD_VID(pVnode));
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,29 +42,29 @@ int vnodeBegin(SVnode *pVnode) {
|
||||||
|
|
||||||
// begin meta
|
// begin meta
|
||||||
if (metaBegin(pVnode->pMeta) < 0) {
|
if (metaBegin(pVnode->pMeta) < 0) {
|
||||||
vError("vgId:%d failed to begin meta since %s", TD_VID(pVnode), tstrerror(terrno));
|
vError("vgId:%d, failed to begin meta since %s", TD_VID(pVnode), tstrerror(terrno));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// begin tsdb
|
// begin tsdb
|
||||||
if (pVnode->pSma) {
|
if (pVnode->pSma) {
|
||||||
if (tsdbBegin(VND_RSMA0(pVnode)) < 0) {
|
if (tsdbBegin(VND_RSMA0(pVnode)) < 0) {
|
||||||
vError("vgId:%d failed to begin rsma0 since %s", TD_VID(pVnode), tstrerror(terrno));
|
vError("vgId:%d, failed to begin rsma0 since %s", TD_VID(pVnode), tstrerror(terrno));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tsdbBegin(VND_RSMA1(pVnode)) < 0) {
|
if (tsdbBegin(VND_RSMA1(pVnode)) < 0) {
|
||||||
vError("vgId:%d failed to begin rsma1 since %s", TD_VID(pVnode), tstrerror(terrno));
|
vError("vgId:%d, failed to begin rsma1 since %s", TD_VID(pVnode), tstrerror(terrno));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tsdbBegin(VND_RSMA2(pVnode)) < 0) {
|
if (tsdbBegin(VND_RSMA2(pVnode)) < 0) {
|
||||||
vError("vgId:%d failed to begin rsma2 since %s", TD_VID(pVnode), tstrerror(terrno));
|
vError("vgId:%d, failed to begin rsma2 since %s", TD_VID(pVnode), tstrerror(terrno));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (tsdbBegin(pVnode->pTsdb) < 0) {
|
if (tsdbBegin(pVnode->pTsdb) < 0) {
|
||||||
vError("vgId:%d failed to begin tsdb since %s", TD_VID(pVnode), tstrerror(terrno));
|
vError("vgId:%d, failed to begin tsdb since %s", TD_VID(pVnode), tstrerror(terrno));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -110,7 +110,7 @@ int vnodeSaveInfo(const char *dir, const SVnodeInfo *pInfo) {
|
||||||
// free info binary
|
// free info binary
|
||||||
taosMemoryFree(data);
|
taosMemoryFree(data);
|
||||||
|
|
||||||
vInfo("vgId:%d vnode info is saved, fname: %s", pInfo->config.vgId, fname);
|
vInfo("vgId:%d, vnode info is saved, fname: %s", pInfo->config.vgId, fname);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
@ -132,7 +132,7 @@ int vnodeCommitInfo(const char *dir, const SVnodeInfo *pInfo) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
vInfo("vgId:%d vnode info is committed", pInfo->config.vgId);
|
vInfo("vgId:%d, vnode info is committed", pInfo->config.vgId);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -210,7 +210,7 @@ int vnodeCommit(SVnode *pVnode) {
|
||||||
SVnodeInfo info = {0};
|
SVnodeInfo info = {0};
|
||||||
char dir[TSDB_FILENAME_LEN];
|
char dir[TSDB_FILENAME_LEN];
|
||||||
|
|
||||||
vInfo("vgId:%d start to commit, version: %" PRId64, TD_VID(pVnode), pVnode->state.applied);
|
vInfo("vgId:%d, start to commit, version: %" PRId64, TD_VID(pVnode), pVnode->state.applied);
|
||||||
|
|
||||||
pVnode->onCommit = pVnode->inUse;
|
pVnode->onCommit = pVnode->inUse;
|
||||||
pVnode->inUse = NULL;
|
pVnode->inUse = NULL;
|
||||||
|
@ -268,7 +268,7 @@ int vnodeCommit(SVnode *pVnode) {
|
||||||
pVnode->pPool = pVnode->onCommit;
|
pVnode->pPool = pVnode->onCommit;
|
||||||
pVnode->onCommit = NULL;
|
pVnode->onCommit = NULL;
|
||||||
|
|
||||||
vInfo("vgId:%d commit over", TD_VID(pVnode));
|
vInfo("vgId:%d, commit over", TD_VID(pVnode));
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,13 +23,13 @@ int vnodeCreate(const char *path, SVnodeCfg *pCfg, STfs *pTfs) {
|
||||||
|
|
||||||
// check config
|
// check config
|
||||||
if (vnodeCheckCfg(pCfg) < 0) {
|
if (vnodeCheckCfg(pCfg) < 0) {
|
||||||
vError("vgId:%d failed to create vnode since: %s", pCfg->vgId, tstrerror(terrno));
|
vError("vgId:%d, failed to create vnode since: %s", pCfg->vgId, tstrerror(terrno));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// create vnode env
|
// create vnode env
|
||||||
if (tfsMkdir(pTfs, path) < 0) {
|
if (tfsMkdir(pTfs, path) < 0) {
|
||||||
vError("vgId:%d failed to create vnode since: %s", pCfg->vgId, tstrerror(terrno));
|
vError("vgId:%d, failed to create vnode since: %s", pCfg->vgId, tstrerror(terrno));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -39,11 +39,11 @@ int vnodeCreate(const char *path, SVnodeCfg *pCfg, STfs *pTfs) {
|
||||||
info.state.applied = -1;
|
info.state.applied = -1;
|
||||||
|
|
||||||
if (vnodeSaveInfo(dir, &info) < 0 || vnodeCommitInfo(dir, &info) < 0) {
|
if (vnodeSaveInfo(dir, &info) < 0 || vnodeCommitInfo(dir, &info) < 0) {
|
||||||
vError("vgId:%d failed to save vnode config since %s", pCfg->vgId, tstrerror(terrno));
|
vError("vgId:%d, failed to save vnode config since %s", pCfg->vgId, tstrerror(terrno));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
vInfo("vgId:%d vnode is created", pCfg->vgId);
|
vInfo("vgId:%d, vnode is created", pCfg->vgId);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -70,7 +70,7 @@ SVnode *vnodeOpen(const char *path, STfs *pTfs, SMsgCb msgCb) {
|
||||||
pVnode = (SVnode *)taosMemoryCalloc(1, sizeof(*pVnode) + strlen(path) + 1);
|
pVnode = (SVnode *)taosMemoryCalloc(1, sizeof(*pVnode) + strlen(path) + 1);
|
||||||
if (pVnode == NULL) {
|
if (pVnode == NULL) {
|
||||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||||
vError("vgId:%d failed to open vnode since %s", info.config.vgId, tstrerror(terrno));
|
vError("vgId:%d, failed to open vnode since %s", info.config.vgId, tstrerror(terrno));
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -86,25 +86,25 @@ SVnode *vnodeOpen(const char *path, STfs *pTfs, SMsgCb msgCb) {
|
||||||
|
|
||||||
// open buffer pool
|
// open buffer pool
|
||||||
if (vnodeOpenBufPool(pVnode, pVnode->config.isHeap ? 0 : pVnode->config.szBuf / 3) < 0) {
|
if (vnodeOpenBufPool(pVnode, pVnode->config.isHeap ? 0 : pVnode->config.szBuf / 3) < 0) {
|
||||||
vError("vgId:%d failed to open vnode buffer pool since %s", TD_VID(pVnode), tstrerror(terrno));
|
vError("vgId:%d, failed to open vnode buffer pool since %s", TD_VID(pVnode), tstrerror(terrno));
|
||||||
goto _err;
|
goto _err;
|
||||||
}
|
}
|
||||||
|
|
||||||
// open meta
|
// open meta
|
||||||
if (metaOpen(pVnode, &pVnode->pMeta) < 0) {
|
if (metaOpen(pVnode, &pVnode->pMeta) < 0) {
|
||||||
vError("vgId:%d failed to open vnode meta since %s", TD_VID(pVnode), tstrerror(terrno));
|
vError("vgId:%d, failed to open vnode meta since %s", TD_VID(pVnode), tstrerror(terrno));
|
||||||
goto _err;
|
goto _err;
|
||||||
}
|
}
|
||||||
|
|
||||||
// open tsdb
|
// open tsdb
|
||||||
if (!VND_IS_RSMA(pVnode) && tsdbOpen(pVnode, &VND_TSDB(pVnode), VNODE_TSDB_DIR, NULL) < 0) {
|
if (!VND_IS_RSMA(pVnode) && tsdbOpen(pVnode, &VND_TSDB(pVnode), VNODE_TSDB_DIR, NULL) < 0) {
|
||||||
vError("vgId:%d failed to open vnode tsdb since %s", TD_VID(pVnode), tstrerror(terrno));
|
vError("vgId:%d, failed to open vnode tsdb since %s", TD_VID(pVnode), tstrerror(terrno));
|
||||||
goto _err;
|
goto _err;
|
||||||
}
|
}
|
||||||
|
|
||||||
// open sma
|
// open sma
|
||||||
if (smaOpen(pVnode)) {
|
if (smaOpen(pVnode)) {
|
||||||
vError("vgId:%d failed to open vnode sma since %s", TD_VID(pVnode), tstrerror(terrno));
|
vError("vgId:%d, failed to open vnode sma since %s", TD_VID(pVnode), tstrerror(terrno));
|
||||||
goto _err;
|
goto _err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -113,7 +113,7 @@ SVnode *vnodeOpen(const char *path, STfs *pTfs, SMsgCb msgCb) {
|
||||||
taosRealPath(tdir, NULL, sizeof(tdir));
|
taosRealPath(tdir, NULL, sizeof(tdir));
|
||||||
pVnode->pWal = walOpen(tdir, &(pVnode->config.walCfg));
|
pVnode->pWal = walOpen(tdir, &(pVnode->config.walCfg));
|
||||||
if (pVnode->pWal == NULL) {
|
if (pVnode->pWal == NULL) {
|
||||||
vError("vgId:%d failed to open vnode wal since %s", TD_VID(pVnode), tstrerror(terrno));
|
vError("vgId:%d, failed to open vnode wal since %s", TD_VID(pVnode), tstrerror(terrno));
|
||||||
goto _err;
|
goto _err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -122,27 +122,27 @@ SVnode *vnodeOpen(const char *path, STfs *pTfs, SMsgCb msgCb) {
|
||||||
taosRealPath(tdir, NULL, sizeof(tdir));
|
taosRealPath(tdir, NULL, sizeof(tdir));
|
||||||
pVnode->pTq = tqOpen(tdir, pVnode, pVnode->pWal);
|
pVnode->pTq = tqOpen(tdir, pVnode, pVnode->pWal);
|
||||||
if (pVnode->pTq == NULL) {
|
if (pVnode->pTq == NULL) {
|
||||||
vError("vgId:%d failed to open vnode tq since %s", TD_VID(pVnode), tstrerror(terrno));
|
vError("vgId:%d, failed to open vnode tq since %s", TD_VID(pVnode), tstrerror(terrno));
|
||||||
goto _err;
|
goto _err;
|
||||||
}
|
}
|
||||||
|
|
||||||
// open query
|
// open query
|
||||||
if (vnodeQueryOpen(pVnode)) {
|
if (vnodeQueryOpen(pVnode)) {
|
||||||
vError("vgId:%d failed to open vnode query since %s", TD_VID(pVnode), tstrerror(terrno));
|
vError("vgId:%d, failed to open vnode query since %s", TD_VID(pVnode), tstrerror(terrno));
|
||||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||||
goto _err;
|
goto _err;
|
||||||
}
|
}
|
||||||
|
|
||||||
// vnode begin
|
// vnode begin
|
||||||
if (vnodeBegin(pVnode) < 0) {
|
if (vnodeBegin(pVnode) < 0) {
|
||||||
vError("vgId:%d failed to begin since %s", TD_VID(pVnode), tstrerror(terrno));
|
vError("vgId:%d, failed to begin since %s", TD_VID(pVnode), tstrerror(terrno));
|
||||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||||
goto _err;
|
goto _err;
|
||||||
}
|
}
|
||||||
|
|
||||||
// open sync
|
// open sync
|
||||||
if (vnodeSyncOpen(pVnode, dir)) {
|
if (vnodeSyncOpen(pVnode, dir)) {
|
||||||
vError("vgId:%d failed to open sync since %s", TD_VID(pVnode), tstrerror(terrno));
|
vError("vgId:%d, failed to open sync since %s", TD_VID(pVnode), tstrerror(terrno));
|
||||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||||
goto _err;
|
goto _err;
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,6 +25,7 @@ static int vnodeProcessSubmitReq(SVnode *pVnode, int64_t version, void *pReq, in
|
||||||
static int vnodeProcessCreateTSmaReq(SVnode *pVnode, int64_t version, void *pReq, int32_t len, SRpcMsg *pRsp);
|
static int vnodeProcessCreateTSmaReq(SVnode *pVnode, int64_t version, void *pReq, int32_t len, SRpcMsg *pRsp);
|
||||||
|
|
||||||
int32_t vnodePreprocessReq(SVnode *pVnode, SRpcMsg *pMsg) {
|
int32_t vnodePreprocessReq(SVnode *pVnode, SRpcMsg *pMsg) {
|
||||||
|
int32_t code = 0;
|
||||||
SDecoder dc = {0};
|
SDecoder dc = {0};
|
||||||
|
|
||||||
switch (pMsg->msgType) {
|
switch (pMsg->msgType) {
|
||||||
|
@ -89,13 +90,13 @@ int32_t vnodePreprocessReq(SVnode *pVnode, SRpcMsg *pMsg) {
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
case TDMT_VND_ALTER_REPLICA: {
|
case TDMT_VND_ALTER_REPLICA: {
|
||||||
vnodeSyncAlter(pVnode, pMsg);
|
code = vnodeSyncAlter(pVnode, pMsg);
|
||||||
} break;
|
} break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return code;
|
||||||
}
|
}
|
||||||
|
|
||||||
int vnodeProcessWriteReq(SVnode *pVnode, SRpcMsg *pMsg, int64_t version, SRpcMsg *pRsp) {
|
int vnodeProcessWriteReq(SVnode *pVnode, SRpcMsg *pMsg, int64_t version, SRpcMsg *pRsp) {
|
||||||
|
@ -104,7 +105,7 @@ int vnodeProcessWriteReq(SVnode *pVnode, SRpcMsg *pMsg, int64_t version, SRpcMsg
|
||||||
int len;
|
int len;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
vTrace("vgId:%d start to process write request %s, version %" PRId64, TD_VID(pVnode), TMSG_INFO(pMsg->msgType),
|
vTrace("vgId:%d, start to process write request %s, version %" PRId64, TD_VID(pVnode), TMSG_INFO(pMsg->msgType),
|
||||||
version);
|
version);
|
||||||
|
|
||||||
pVnode->state.applied = version;
|
pVnode->state.applied = version;
|
||||||
|
@ -164,16 +165,16 @@ int vnodeProcessWriteReq(SVnode *pVnode, SRpcMsg *pMsg, int64_t version, SRpcMsg
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
vDebug("vgId:%d process %s request success, version: %" PRId64, TD_VID(pVnode), TMSG_INFO(pMsg->msgType), version);
|
vTrace("vgId:%d, process %s request success, version: %" PRId64, TD_VID(pVnode), TMSG_INFO(pMsg->msgType), version);
|
||||||
|
|
||||||
if (tqPushMsg(pVnode->pTq, pMsg->pCont, pMsg->contLen, pMsg->msgType, version) < 0) {
|
if (tqPushMsg(pVnode->pTq, pMsg->pCont, pMsg->contLen, pMsg->msgType, version) < 0) {
|
||||||
vError("vgId:%d failed to push msg to TQ since %s", TD_VID(pVnode), tstrerror(terrno));
|
vError("vgId:%d, failed to push msg to TQ since %s", TD_VID(pVnode), tstrerror(terrno));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// commit if need
|
// commit if need
|
||||||
if (vnodeShouldCommit(pVnode)) {
|
if (vnodeShouldCommit(pVnode)) {
|
||||||
vInfo("vgId:%d commit at version %" PRId64, TD_VID(pVnode), version);
|
vInfo("vgId:%d, commit at version %" PRId64, TD_VID(pVnode), version);
|
||||||
// commit current change
|
// commit current change
|
||||||
vnodeCommit(pVnode);
|
vnodeCommit(pVnode);
|
||||||
|
|
||||||
|
@ -184,7 +185,7 @@ int vnodeProcessWriteReq(SVnode *pVnode, SRpcMsg *pMsg, int64_t version, SRpcMsg
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
_err:
|
_err:
|
||||||
vDebug("vgId:%d process %s request failed since %s, version: %" PRId64, TD_VID(pVnode), TMSG_INFO(pMsg->msgType),
|
vError("vgId:%d, process %s request failed since %s, version: %" PRId64, TD_VID(pVnode), TMSG_INFO(pMsg->msgType),
|
||||||
tstrerror(terrno), version);
|
tstrerror(terrno), version);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@ -828,13 +829,13 @@ static int vnodeProcessCreateTSmaReq(SVnode *pVnode, int64_t version, void *pReq
|
||||||
}
|
}
|
||||||
|
|
||||||
tDecoderClear(&coder);
|
tDecoderClear(&coder);
|
||||||
vDebug("vgId:%d success to create tsma %s:%" PRIi64 " version %" PRIi64 " for table %" PRIi64, TD_VID(pVnode),
|
vDebug("vgId:%d, success to create tsma %s:%" PRIi64 " version %" PRIi64 " for table %" PRIi64, TD_VID(pVnode),
|
||||||
req.indexName, req.indexUid, version, req.tableUid);
|
req.indexName, req.indexUid, version, req.tableUid);
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
_err:
|
_err:
|
||||||
tDecoderClear(&coder);
|
tDecoderClear(&coder);
|
||||||
vError("vgId:%d failed to create tsma %s:%" PRIi64 " version %" PRIi64 "for table %" PRIi64 " since %s",
|
vError("vgId:%d, failed to create tsma %s:%" PRIi64 " version %" PRIi64 "for table %" PRIi64 " since %s",
|
||||||
TD_VID(pVnode), req.indexName, req.indexUid, version, req.tableUid, terrstr(terrno));
|
TD_VID(pVnode), req.indexName, req.indexUid, version, req.tableUid, terrstr(terrno));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -50,13 +50,11 @@ int32_t vnodeSyncOpen(SVnode *pVnode, char *path) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void vnodeSyncAlter(SVnode *pVnode, SRpcMsg *pMsg) {
|
int32_t vnodeSyncAlter(SVnode *pVnode, SRpcMsg *pMsg) {
|
||||||
SAlterVnodeReq req = {0};
|
SAlterVnodeReq req = {0};
|
||||||
if (tDeserializeSAlterVnodeReq((char *)pMsg->pCont + sizeof(SMsgHead), pMsg->contLen - sizeof(SMsgHead), &req) != 0) {
|
if (tDeserializeSAlterVnodeReq((char *)pMsg->pCont + sizeof(SMsgHead), pMsg->contLen - sizeof(SMsgHead), &req) != 0) {
|
||||||
terrno = TSDB_CODE_INVALID_MSG;
|
terrno = TSDB_CODE_INVALID_MSG;
|
||||||
vError("vgId:%d, failed to alter replica since %s", TD_VID(pVnode), terrstr());
|
return TSDB_CODE_INVALID_MSG;
|
||||||
SRpcMsg rsp = {.info = pMsg->info, .code = terrno};
|
|
||||||
tmsgSendRsp(&rsp);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
vInfo("vgId:%d, start to alter vnode replica to %d", TD_VID(pVnode), req.replica);
|
vInfo("vgId:%d, start to alter vnode replica to %d", TD_VID(pVnode), req.replica);
|
||||||
|
@ -68,11 +66,15 @@ void vnodeSyncAlter(SVnode *pVnode, SRpcMsg *pMsg) {
|
||||||
vInfo("vgId:%d, replica:%d %s:%u", TD_VID(pVnode), r, pNode->nodeFqdn, pNode->nodePort);
|
vInfo("vgId:%d, replica:%d %s:%u", TD_VID(pVnode), r, pNode->nodeFqdn, pNode->nodePort);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (syncReconfig(pVnode->sync, &cfg) != 0) {
|
int32_t code = syncReconfig(pVnode->sync, &cfg);
|
||||||
vError("vgId:%d, failed to propose sync reconfig since %s", TD_VID(pVnode), terrstr());
|
if (code == TAOS_SYNC_PROPOSE_SUCCESS) {
|
||||||
|
// todo refactor
|
||||||
SRpcMsg rsp = {.info = pMsg->info, .code = terrno};
|
SRpcMsg rsp = {.info = pMsg->info, .code = terrno};
|
||||||
tmsgSendRsp(&rsp);
|
tmsgSendRsp(&rsp);
|
||||||
|
return TSDB_CODE_ACTION_IN_PROGRESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return code;
|
||||||
}
|
}
|
||||||
|
|
||||||
void vnodeSyncStart(SVnode *pVnode) {
|
void vnodeSyncStart(SVnode *pVnode) {
|
||||||
|
|
|
@ -66,7 +66,7 @@ void udfUdfdExit(uv_process_t *process, int64_t exitStatus, int termSignal) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32_t udfSpawnUdfd(SUdfdData* pData) {
|
static int32_t udfSpawnUdfd(SUdfdData* pData) {
|
||||||
fnInfo("dnode start spawning udfd");
|
fnInfo("start to init udfd");
|
||||||
uv_process_options_t options = {0};
|
uv_process_options_t options = {0};
|
||||||
|
|
||||||
char path[PATH_MAX] = {0};
|
char path[PATH_MAX] = {0};
|
||||||
|
@ -140,6 +140,8 @@ static int32_t udfSpawnUdfd(SUdfdData* pData) {
|
||||||
|
|
||||||
if (err != 0) {
|
if (err != 0) {
|
||||||
fnError("can not spawn udfd. path: %s, error: %s", path, uv_strerror(err));
|
fnError("can not spawn udfd. path: %s, error: %s", path, uv_strerror(err));
|
||||||
|
} else {
|
||||||
|
fnInfo("udfd is initialized");
|
||||||
}
|
}
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1450,12 +1450,12 @@ static void syncFreeNode(void* param) {
|
||||||
const char* syncStr(ESyncState state) {
|
const char* syncStr(ESyncState state) {
|
||||||
switch (state) {
|
switch (state) {
|
||||||
case TAOS_SYNC_STATE_FOLLOWER:
|
case TAOS_SYNC_STATE_FOLLOWER:
|
||||||
return "FOLLOWER";
|
return "follower";
|
||||||
case TAOS_SYNC_STATE_CANDIDATE:
|
case TAOS_SYNC_STATE_CANDIDATE:
|
||||||
return "CANDIDATE";
|
return "candidate";
|
||||||
case TAOS_SYNC_STATE_LEADER:
|
case TAOS_SYNC_STATE_LEADER:
|
||||||
return "LEADER";
|
return "leader";
|
||||||
default:
|
default:
|
||||||
return "ERROR";
|
return "error";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -190,7 +190,7 @@ TAOS_DEFINE_ERROR(TSDB_CODE_MND_BNODE_ALREADY_EXIST, "Bnode already exists"
|
||||||
TAOS_DEFINE_ERROR(TSDB_CODE_MND_BNODE_NOT_EXIST, "Bnode not there")
|
TAOS_DEFINE_ERROR(TSDB_CODE_MND_BNODE_NOT_EXIST, "Bnode not there")
|
||||||
TAOS_DEFINE_ERROR(TSDB_CODE_MND_TOO_FEW_MNODES, "The replicas of mnode cannot less than 1")
|
TAOS_DEFINE_ERROR(TSDB_CODE_MND_TOO_FEW_MNODES, "The replicas of mnode cannot less than 1")
|
||||||
TAOS_DEFINE_ERROR(TSDB_CODE_MND_TOO_MANY_MNODES, "The replicas of mnode cannot exceed 3")
|
TAOS_DEFINE_ERROR(TSDB_CODE_MND_TOO_MANY_MNODES, "The replicas of mnode cannot exceed 3")
|
||||||
TAOS_DEFINE_ERROR(TSDB_CODE_MND_CANT_DROP_MASTER, "Can't drop mnode which is LEADER")
|
TAOS_DEFINE_ERROR(TSDB_CODE_MND_CANT_DROP_MASTER, "Can't drop mnode which is leader")
|
||||||
|
|
||||||
// mnode-acct
|
// mnode-acct
|
||||||
TAOS_DEFINE_ERROR(TSDB_CODE_MND_ACCT_ALREADY_EXIST, "Account already exists")
|
TAOS_DEFINE_ERROR(TSDB_CODE_MND_ACCT_ALREADY_EXIST, "Account already exists")
|
||||||
|
|
|
@ -163,7 +163,7 @@ int32_t tWWorkerInit(SWWorkerPool *pool) {
|
||||||
worker->pool = pool;
|
worker->pool = pool;
|
||||||
}
|
}
|
||||||
|
|
||||||
uInfo("worker:%s is initialized, max:%d", pool->name, pool->max);
|
uDebug("worker:%s is initialized, max:%d", pool->name, pool->max);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -190,7 +190,7 @@ void tWWorkerCleanup(SWWorkerPool *pool) {
|
||||||
taosMemoryFreeClear(pool->workers);
|
taosMemoryFreeClear(pool->workers);
|
||||||
taosThreadMutexDestroy(&pool->mutex);
|
taosThreadMutexDestroy(&pool->mutex);
|
||||||
|
|
||||||
uInfo("worker:%s is closed", pool->name);
|
uDebug("worker:%s is closed", pool->name);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void *tWWorkerThreadFp(SWWorker *worker) {
|
static void *tWWorkerThreadFp(SWWorker *worker) {
|
||||||
|
|
|
@ -24,7 +24,7 @@ if $data00 != 1 then
|
||||||
return -1
|
return -1
|
||||||
endi
|
endi
|
||||||
|
|
||||||
if $data02 != LEADER then
|
if $data02 != leader then
|
||||||
return -1
|
return -1
|
||||||
endi
|
endi
|
||||||
|
|
||||||
|
@ -71,7 +71,7 @@ if $data00 != 1 then
|
||||||
return -1
|
return -1
|
||||||
endi
|
endi
|
||||||
|
|
||||||
if $data02 != LEADER then
|
if $data02 != leader then
|
||||||
return -1
|
return -1
|
||||||
endi
|
endi
|
||||||
|
|
||||||
|
|
|
@ -131,43 +131,43 @@ endi
|
||||||
|
|
||||||
sleep 3000
|
sleep 3000
|
||||||
#sql show db.vgroups
|
#sql show db.vgroups
|
||||||
#if $data[0][4] == LEADER then
|
#if $data[0][4] == leader then
|
||||||
# if $data[0][6] != FOLLOWER then
|
# if $data[0][6] != follower then
|
||||||
# return -1
|
# return -1
|
||||||
# endi
|
# endi
|
||||||
# if $data[0][8] != FOLLOWER then
|
# if $data[0][8] != follower then
|
||||||
# return -1
|
# return -1
|
||||||
# endi
|
# endi
|
||||||
#endi
|
#endi
|
||||||
#if $data[0][6] == LEADER then
|
#if $data[0][6] == leader then
|
||||||
# if $data[0][4] != FOLLOWER then
|
# if $data[0][4] != follower then
|
||||||
# return -1
|
# return -1
|
||||||
# endi
|
# endi
|
||||||
# if $data[0][8] != FOLLOWER then
|
# if $data[0][8] != follower then
|
||||||
# return -1
|
# return -1
|
||||||
# endi
|
# endi
|
||||||
#endi
|
#endi
|
||||||
#if $data[0][8] == LEADER then
|
#if $data[0][8] == leader then
|
||||||
# if $data[0][4] != FOLLOWER then
|
# if $data[0][4] != follower then
|
||||||
# return -1
|
# return -1
|
||||||
# endi
|
# endi
|
||||||
# if $data[0][6] != FOLLOWER then
|
# if $data[0][6] != follower then
|
||||||
# return -1
|
# return -1
|
||||||
# endi
|
# endi
|
||||||
#endi
|
#endi
|
||||||
#
|
#
|
||||||
#if $data[0][4] != LEADER then
|
#if $data[0][4] != leader then
|
||||||
# if $data[0][4] != FOLLOWER then
|
# if $data[0][4] != follower then
|
||||||
# return -1
|
# return -1
|
||||||
# endi
|
# endi
|
||||||
#endi
|
#endi
|
||||||
#if $data[0][6] != LEADER then
|
#if $data[0][6] != leader then
|
||||||
# if $data[0][6] != FOLLOWER then
|
# if $data[0][6] != follower then
|
||||||
# return -1
|
# return -1
|
||||||
# endi
|
# endi
|
||||||
#endi
|
#endi
|
||||||
#if $data[0][8] != LEADER then
|
#if $data[0][8] != leader then
|
||||||
# if $data[0][8] != FOLLOWER then
|
# if $data[0][8] != follower then
|
||||||
# return -1
|
# return -1
|
||||||
# endi
|
# endi
|
||||||
#endi
|
#endi
|
||||||
|
|
|
@ -12,11 +12,11 @@ sql connect
|
||||||
print =============== step1: create dnodes
|
print =============== step1: create dnodes
|
||||||
sql create dnode $hostname port 7200
|
sql create dnode $hostname port 7200
|
||||||
|
|
||||||
$loop_cnt = 0
|
$x = 0
|
||||||
step1:
|
step1:
|
||||||
$loop_cnt = $loop_cnt + 1
|
$ = $x + 1
|
||||||
sleep 1000
|
sleep 1000
|
||||||
if $loop_cnt == 10 then
|
if $x == 10 then
|
||||||
print ====> dnode not ready!
|
print ====> dnode not ready!
|
||||||
return -1
|
return -1
|
||||||
endi
|
endi
|
||||||
|
@ -73,11 +73,11 @@ print =============== step3: create dnodes
|
||||||
sql create dnode $hostname port 7300
|
sql create dnode $hostname port 7300
|
||||||
sql create dnode $hostname port 7400
|
sql create dnode $hostname port 7400
|
||||||
|
|
||||||
$loop_cnt = 0
|
$x = 0
|
||||||
step3:
|
step3:
|
||||||
$loop_cnt = $loop_cnt + 1
|
$x = $x + 1
|
||||||
sleep 1000
|
sleep 1000
|
||||||
if $loop_cnt == 10 then
|
if $x == 10 then
|
||||||
print ====> dnode not ready!
|
print ====> dnode not ready!
|
||||||
return -1
|
return -1
|
||||||
endi
|
endi
|
||||||
|
@ -103,22 +103,39 @@ if $data(4)[4] != ready then
|
||||||
goto step3
|
goto step3
|
||||||
endi
|
endi
|
||||||
|
|
||||||
return
|
|
||||||
print ============= step4: alter database
|
print ============= step4: alter database
|
||||||
sql alter database db replica 3
|
sql alter database db replica 3
|
||||||
if $rows != 3 then
|
|
||||||
return -1
|
$x = 0
|
||||||
|
step4:
|
||||||
|
$x = $x + 1
|
||||||
|
sleep 1000
|
||||||
|
if $x == 10 then
|
||||||
|
print ====> dnode not ready!
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
sql show db.vgroups
|
||||||
|
print ===> rows: $rows
|
||||||
|
print ===> $data00 $data01 $data02 $data03 $data04 $data05
|
||||||
|
if $data[0][4] != leader then
|
||||||
|
goto step4
|
||||||
endi
|
endi
|
||||||
if $data(db)[4] != 3 then
|
if $data[0][6] != follower then
|
||||||
return -1
|
goto step4
|
||||||
endi
|
endi
|
||||||
|
if $data[0][8] != follower then
|
||||||
|
goto step4
|
||||||
|
endi
|
||||||
|
|
||||||
|
print ============= step5: stop dnode 2
|
||||||
|
return
|
||||||
|
|
||||||
sql select * from db.stb
|
sql select * from db.stb
|
||||||
if $rows != 1 then
|
if $rows != 1 then
|
||||||
return -1
|
return -1
|
||||||
endi
|
endi
|
||||||
|
|
||||||
|
|
||||||
system sh/exec.sh -n dnode1 -s stop -x SIGINT
|
system sh/exec.sh -n dnode1 -s stop -x SIGINT
|
||||||
system sh/exec.sh -n dnode2 -s stop -x SIGINT
|
system sh/exec.sh -n dnode2 -s stop -x SIGINT
|
||||||
system sh/exec.sh -n dnode3 -s stop -x SIGINT
|
system sh/exec.sh -n dnode3 -s stop -x SIGINT
|
||||||
|
system sh/exec.sh -n dnode4 -s stop -x SIGINT
|
|
@ -27,7 +27,7 @@ if $data00 != 1 then
|
||||||
return -1
|
return -1
|
||||||
endi
|
endi
|
||||||
|
|
||||||
if $data02 != LEADER then
|
if $data02 != leader then
|
||||||
return -1
|
return -1
|
||||||
endi
|
endi
|
||||||
|
|
||||||
|
@ -74,7 +74,7 @@ if $data00 != 1 then
|
||||||
return -1
|
return -1
|
||||||
endi
|
endi
|
||||||
|
|
||||||
if $data02 != LEADER then
|
if $data02 != leader then
|
||||||
return -1
|
return -1
|
||||||
endi
|
endi
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,7 @@ if $data00 != 1 then
|
||||||
return -1
|
return -1
|
||||||
endi
|
endi
|
||||||
|
|
||||||
if $data02 != LEADER then
|
if $data02 != leader then
|
||||||
return -1
|
return -1
|
||||||
endi
|
endi
|
||||||
|
|
||||||
|
@ -59,13 +59,13 @@ endi
|
||||||
if $data(1)[0] != 1 then
|
if $data(1)[0] != 1 then
|
||||||
return -1
|
return -1
|
||||||
endi
|
endi
|
||||||
if $data(1)[2] != LEADER then
|
if $data(1)[2] != leader then
|
||||||
return -1
|
return -1
|
||||||
endi
|
endi
|
||||||
if $data(2)[0] != 2 then
|
if $data(2)[0] != 2 then
|
||||||
return -1
|
return -1
|
||||||
endi
|
endi
|
||||||
if $data(2)[2] != FOLLOWER then
|
if $data(2)[2] != follower then
|
||||||
goto step2
|
goto step2
|
||||||
endi
|
endi
|
||||||
|
|
||||||
|
@ -95,7 +95,7 @@ endi
|
||||||
if $data(1)[0] != 1 then
|
if $data(1)[0] != 1 then
|
||||||
return -1
|
return -1
|
||||||
endi
|
endi
|
||||||
if $data(1)[2] != LEADER then
|
if $data(1)[2] != leader then
|
||||||
return -1
|
return -1
|
||||||
endi
|
endi
|
||||||
if $data(2)[0] != null then
|
if $data(2)[0] != null then
|
||||||
|
@ -131,13 +131,13 @@ endi
|
||||||
if $data(1)[0] != 1 then
|
if $data(1)[0] != 1 then
|
||||||
return -1
|
return -1
|
||||||
endi
|
endi
|
||||||
if $data(1)[2] != LEADER then
|
if $data(1)[2] != leader then
|
||||||
return -1
|
return -1
|
||||||
endi
|
endi
|
||||||
if $data(2)[0] != 2 then
|
if $data(2)[0] != 2 then
|
||||||
return -1
|
return -1
|
||||||
endi
|
endi
|
||||||
if $data(2)[2] != FOLLOWER then
|
if $data(2)[2] != follower then
|
||||||
goto step3
|
goto step3
|
||||||
endi
|
endi
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,7 @@ if $data00 != 1 then
|
||||||
return -1
|
return -1
|
||||||
endi
|
endi
|
||||||
|
|
||||||
if $data02 != LEADER then
|
if $data02 != leader then
|
||||||
return -1
|
return -1
|
||||||
endi
|
endi
|
||||||
|
|
||||||
|
@ -56,13 +56,13 @@ endi
|
||||||
if $data(1)[0] != 1 then
|
if $data(1)[0] != 1 then
|
||||||
return -1
|
return -1
|
||||||
endi
|
endi
|
||||||
if $data(1)[2] != LEADER then
|
if $data(1)[2] != leader then
|
||||||
return -1
|
return -1
|
||||||
endi
|
endi
|
||||||
if $data(2)[0] != 2 then
|
if $data(2)[0] != 2 then
|
||||||
return -1
|
return -1
|
||||||
endi
|
endi
|
||||||
if $data(2)[2] != FOLLOWER then
|
if $data(2)[2] != follower then
|
||||||
goto step2
|
goto step2
|
||||||
endi
|
endi
|
||||||
|
|
||||||
|
|
|
@ -49,13 +49,13 @@ step2:
|
||||||
return -1
|
return -1
|
||||||
endi
|
endi
|
||||||
sql show mnodes -x step2
|
sql show mnodes -x step2
|
||||||
if $data(1)[2] != LEADER then
|
if $data(1)[2] != leader then
|
||||||
goto step2
|
goto step2
|
||||||
endi
|
endi
|
||||||
if $data(2)[2] != FOLLOWER then
|
if $data(2)[2] != follower then
|
||||||
goto step2
|
goto step2
|
||||||
endi
|
endi
|
||||||
if $data(3)[2] != FOLLOWER then
|
if $data(3)[2] != follower then
|
||||||
goto step2
|
goto step2
|
||||||
endi
|
endi
|
||||||
|
|
||||||
|
@ -114,7 +114,7 @@ print $data(1)[0] $data(1)[1] $data(1)[2]
|
||||||
print $data(2)[0] $data(2)[1] $data(2)[2]
|
print $data(2)[0] $data(2)[1] $data(2)[2]
|
||||||
print $data(3)[0] $data(3)[1] $data(3)[2]
|
print $data(3)[0] $data(3)[1] $data(3)[2]
|
||||||
|
|
||||||
if $data(2)[2] != OFFLINE then
|
if $data(2)[2] != offline then
|
||||||
goto step5
|
goto step5
|
||||||
endi
|
endi
|
||||||
|
|
||||||
|
|
|
@ -63,22 +63,22 @@ print $data[0][0] $data[0][1] $data[0][2] $data[0][3] $data[0][4]
|
||||||
print $data[1][0] $data[1][1] $data[1][2] $data[1][3] $data[1][4]
|
print $data[1][0] $data[1][1] $data[1][2] $data[1][3] $data[1][4]
|
||||||
print $data[2][0] $data[2][1] $data[2][2] $data[2][3] $data[2][4]
|
print $data[2][0] $data[2][1] $data[2][2] $data[2][3] $data[2][4]
|
||||||
|
|
||||||
if $data(1)[2] != LEADER then
|
if $data(1)[2] != leader then
|
||||||
goto step3
|
goto step3
|
||||||
endi
|
endi
|
||||||
if $data(2)[2] != FOLLOWER then
|
if $data(2)[2] != follower then
|
||||||
goto step3
|
goto step3
|
||||||
endi
|
endi
|
||||||
if $data(3)[2] != OFFLINE then
|
if $data(3)[2] != offline then
|
||||||
goto step3
|
goto step3
|
||||||
endi
|
endi
|
||||||
if $data(1)[3] != READY then
|
if $data(1)[3] != ready then
|
||||||
goto step3
|
goto step3
|
||||||
endi
|
endi
|
||||||
if $data(2)[3] != READY then
|
if $data(2)[3] != ready then
|
||||||
goto step3
|
goto step3
|
||||||
endi
|
endi
|
||||||
if $data(3)[3] != CREATING then
|
if $data(3)[3] != creating then
|
||||||
goto step3
|
goto step3
|
||||||
endi
|
endi
|
||||||
|
|
||||||
|
@ -97,22 +97,22 @@ print $data[0][0] $data[0][1] $data[0][2] $data[0][3] $data[0][4]
|
||||||
print $data[1][0] $data[1][1] $data[1][2] $data[1][3] $data[1][4]
|
print $data[1][0] $data[1][1] $data[1][2] $data[1][3] $data[1][4]
|
||||||
print $data[2][0] $data[2][1] $data[2][2] $data[2][3] $data[2][4]
|
print $data[2][0] $data[2][1] $data[2][2] $data[2][3] $data[2][4]
|
||||||
|
|
||||||
if $data(1)[2] != LEADER then
|
if $data(1)[2] != leader then
|
||||||
goto step4
|
goto step4
|
||||||
endi
|
endi
|
||||||
if $data(2)[2] != FOLLOWER then
|
if $data(2)[2] != follower then
|
||||||
goto step4
|
goto step4
|
||||||
endi
|
endi
|
||||||
if $data(3)[2] != FOLLOWER then
|
if $data(3)[2] != follower then
|
||||||
goto step4
|
goto step4
|
||||||
endi
|
endi
|
||||||
if $data(1)[3] != READY then
|
if $data(1)[3] != ready then
|
||||||
goto step4
|
goto step4
|
||||||
endi
|
endi
|
||||||
if $data(2)[3] != READY then
|
if $data(2)[3] != ready then
|
||||||
goto step4
|
goto step4
|
||||||
endi
|
endi
|
||||||
if $data(3)[3] != READY then
|
if $data(3)[3] != ready then
|
||||||
goto step4
|
goto step4
|
||||||
endi
|
endi
|
||||||
|
|
||||||
|
@ -132,22 +132,22 @@ print $data[0][0] $data[0][1] $data[0][2] $data[0][3] $data[0][4]
|
||||||
print $data[1][0] $data[1][1] $data[1][2] $data[1][3] $data[1][4]
|
print $data[1][0] $data[1][1] $data[1][2] $data[1][3] $data[1][4]
|
||||||
print $data[2][0] $data[2][1] $data[2][2] $data[2][3] $data[2][4]
|
print $data[2][0] $data[2][1] $data[2][2] $data[2][3] $data[2][4]
|
||||||
|
|
||||||
if $data(1)[2] != LEADER then
|
if $data(1)[2] != leader then
|
||||||
goto step5
|
goto step5
|
||||||
endi
|
endi
|
||||||
if $data(2)[2] != FOLLOWER then
|
if $data(2)[2] != follower then
|
||||||
goto step5
|
goto step5
|
||||||
endi
|
endi
|
||||||
if $data(3)[2] != OFFLINE then
|
if $data(3)[2] != offline then
|
||||||
goto step5
|
goto step5
|
||||||
endi
|
endi
|
||||||
if $data(1)[3] != READY then
|
if $data(1)[3] != ready then
|
||||||
goto step5
|
goto step5
|
||||||
endi
|
endi
|
||||||
if $data(2)[3] != READY then
|
if $data(2)[3] != ready then
|
||||||
goto step5
|
goto step5
|
||||||
endi
|
endi
|
||||||
if $data(3)[3] != DROPPING then
|
if $data(3)[3] != dropping then
|
||||||
goto step5
|
goto step5
|
||||||
endi
|
endi
|
||||||
|
|
||||||
|
@ -169,19 +169,19 @@ print $data[2][0] $data[2][1] $data[2][2] $data[2][3] $data[2][4]
|
||||||
if $rows != 2 then
|
if $rows != 2 then
|
||||||
goto step6
|
goto step6
|
||||||
endi
|
endi
|
||||||
if $data(1)[2] != LEADER then
|
if $data(1)[2] != leader then
|
||||||
goto step6
|
goto step6
|
||||||
endi
|
endi
|
||||||
if $data(2)[2] != FOLLOWER then
|
if $data(2)[2] != follower then
|
||||||
goto step6
|
goto step6
|
||||||
endi
|
endi
|
||||||
if $data(3)[2] != null then
|
if $data(3)[2] != null then
|
||||||
goto step6
|
goto step6
|
||||||
endi
|
endi
|
||||||
if $data(1)[3] != READY then
|
if $data(1)[3] != ready then
|
||||||
goto step6
|
goto step6
|
||||||
endi
|
endi
|
||||||
if $data(2)[3] != READY then
|
if $data(2)[3] != ready then
|
||||||
goto step6
|
goto step6
|
||||||
endi
|
endi
|
||||||
if $data(3)[3] != null then
|
if $data(3)[3] != null then
|
||||||
|
|
|
@ -24,7 +24,7 @@ if $data00 != 1 then
|
||||||
return -1
|
return -1
|
||||||
endi
|
endi
|
||||||
|
|
||||||
if $data02 != LEADER then
|
if $data02 != leader then
|
||||||
return -1
|
return -1
|
||||||
endi
|
endi
|
||||||
|
|
||||||
|
@ -71,7 +71,7 @@ if $data00 != 1 then
|
||||||
return -1
|
return -1
|
||||||
endi
|
endi
|
||||||
|
|
||||||
if $data02 != LEADER then
|
if $data02 != leader then
|
||||||
return -1
|
return -1
|
||||||
endi
|
endi
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
system sh/stop_dnodes.sh
|
system sh/stop_dnodes.sh
|
||||||
system sh/deploy.sh -n dnode1 -i 1
|
system sh/deploy.sh -n dnode1 -i 1
|
||||||
|
|
||||||
print ========= start dnode1 as LEADER
|
print ========= start dnode1 as leader
|
||||||
system sh/exec.sh -n dnode1 -s start
|
system sh/exec.sh -n dnode1 -s start
|
||||||
sql connect
|
sql connect
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@ system sh/deploy.sh -n dnode1 -i 1
|
||||||
system sh/cfg.sh -n dnode1 -c wallevel -v 2
|
system sh/cfg.sh -n dnode1 -c wallevel -v 2
|
||||||
system sh/cfg.sh -n dnode1 -c numOfMnodes -v 1
|
system sh/cfg.sh -n dnode1 -c numOfMnodes -v 1
|
||||||
|
|
||||||
print ========= start dnode1 as LEADER
|
print ========= start dnode1 as leader
|
||||||
system sh/exec.sh -n dnode1 -s start
|
system sh/exec.sh -n dnode1 -s start
|
||||||
sleep 2000
|
sleep 2000
|
||||||
sql connect
|
sql connect
|
||||||
|
|
|
@ -5,7 +5,7 @@ system sh/cfg.sh -n dnode1 -c wallevel -v 2
|
||||||
system sh/cfg.sh -n dnode1 -c numOfMnodes -v 1
|
system sh/cfg.sh -n dnode1 -c numOfMnodes -v 1
|
||||||
system sh/cfg.sh -n dnode1 -c udf -v 1
|
system sh/cfg.sh -n dnode1 -c udf -v 1
|
||||||
|
|
||||||
print ========= start dnode1 as LEADER
|
print ========= start dnode1 as leader
|
||||||
system sh/exec.sh -n dnode1 -s start
|
system sh/exec.sh -n dnode1 -s start
|
||||||
sleep 1000
|
sleep 1000
|
||||||
sql connect
|
sql connect
|
||||||
|
|
|
@ -24,7 +24,7 @@ if $data00 != 1 then
|
||||||
return -1
|
return -1
|
||||||
endi
|
endi
|
||||||
|
|
||||||
if $data02 != LEADER then
|
if $data02 != leader then
|
||||||
return -1
|
return -1
|
||||||
endi
|
endi
|
||||||
|
|
||||||
|
@ -71,7 +71,7 @@ if $data00 != 1 then
|
||||||
return -1
|
return -1
|
||||||
endi
|
endi
|
||||||
|
|
||||||
if $data02 != LEADER then
|
if $data02 != leader then
|
||||||
return -1
|
return -1
|
||||||
endi
|
endi
|
||||||
|
|
||||||
|
|
|
@ -105,21 +105,21 @@ if $rows != $vgroups then
|
||||||
return -1
|
return -1
|
||||||
endi
|
endi
|
||||||
|
|
||||||
if $data[0][4] == LEADER then
|
if $data[0][4] == leader then
|
||||||
if $data[0][6] == FOLLOWER then
|
if $data[0][6] == follower then
|
||||||
if $data[0][8] == FOLLOWER then
|
if $data[0][8] == follower then
|
||||||
print ---- vgroup $data[0][0] leader locate on dnode $data[0][3]
|
print ---- vgroup $data[0][0] leader locate on dnode $data[0][3]
|
||||||
endi
|
endi
|
||||||
endi
|
endi
|
||||||
elif $data[0][6] == LEADER then
|
elif $data[0][6] == leader then
|
||||||
if $data[0][4] == FOLLOWER then
|
if $data[0][4] == follower then
|
||||||
if $data[0][8] == FOLLOWER then
|
if $data[0][8] == follower then
|
||||||
print ---- vgroup $data[0][0] leader locate on dnode $data[0][5]
|
print ---- vgroup $data[0][0] leader locate on dnode $data[0][5]
|
||||||
endi
|
endi
|
||||||
endi
|
endi
|
||||||
elif $data[0][8] == LEADER then
|
elif $data[0][8] == leader then
|
||||||
if $data[0][4] == FOLLOWER then
|
if $data[0][4] == follower then
|
||||||
if $data[0][6] == FOLLOWER then
|
if $data[0][6] == follower then
|
||||||
print ---- vgroup $data[0][0] leader locate on dnode $data[0][7]
|
print ---- vgroup $data[0][0] leader locate on dnode $data[0][7]
|
||||||
endi
|
endi
|
||||||
endi
|
endi
|
||||||
|
@ -239,21 +239,21 @@ if $rows != $vgroups then
|
||||||
return -1
|
return -1
|
||||||
endi
|
endi
|
||||||
|
|
||||||
if $data[0][4] == LEADER then
|
if $data[0][4] == leader then
|
||||||
if $data[0][6] == FOLLOWER then
|
if $data[0][6] == follower then
|
||||||
if $data[0][8] == FOLLOWER then
|
if $data[0][8] == follower then
|
||||||
print ---- vgroup $data[0][0] leader locate on dnode $data[0][3]
|
print ---- vgroup $data[0][0] leader locate on dnode $data[0][3]
|
||||||
endi
|
endi
|
||||||
endi
|
endi
|
||||||
elif $data[0][6] == LEADER then
|
elif $data[0][6] == leader then
|
||||||
if $data[0][4] == FOLLOWER then
|
if $data[0][4] == follower then
|
||||||
if $data[0][8] == FOLLOWER then
|
if $data[0][8] == follower then
|
||||||
print ---- vgroup $data[0][0] leader locate on dnode $data[0][5]
|
print ---- vgroup $data[0][0] leader locate on dnode $data[0][5]
|
||||||
endi
|
endi
|
||||||
endi
|
endi
|
||||||
elif $data[0][8] == LEADER then
|
elif $data[0][8] == leader then
|
||||||
if $data[0][4] == FOLLOWER then
|
if $data[0][4] == follower then
|
||||||
if $data[0][6] == FOLLOWER then
|
if $data[0][6] == follower then
|
||||||
print ---- vgroup $data[0][0] leader locate on dnode $data[0][7]
|
print ---- vgroup $data[0][0] leader locate on dnode $data[0][7]
|
||||||
endi
|
endi
|
||||||
endi
|
endi
|
||||||
|
@ -447,21 +447,21 @@ if $rows != $vgroups then
|
||||||
return -1
|
return -1
|
||||||
endi
|
endi
|
||||||
|
|
||||||
if $data[0][4] == LEADER then
|
if $data[0][4] == leader then
|
||||||
if $data[0][6] == FOLLOWER then
|
if $data[0][6] == follower then
|
||||||
if $data[0][8] == FOLLOWER then
|
if $data[0][8] == follower then
|
||||||
print ---- vgroup $data[0][0] leader locate on dnode $data[0][3]
|
print ---- vgroup $data[0][0] leader locate on dnode $data[0][3]
|
||||||
endi
|
endi
|
||||||
endi
|
endi
|
||||||
elif $data[0][6] == LEADER then
|
elif $data[0][6] == leader then
|
||||||
if $data[0][4] == FOLLOWER then
|
if $data[0][4] == follower then
|
||||||
if $data[0][8] == FOLLOWER then
|
if $data[0][8] == follower then
|
||||||
print ---- vgroup $data[0][0] leader locate on dnode $data[0][5]
|
print ---- vgroup $data[0][0] leader locate on dnode $data[0][5]
|
||||||
endi
|
endi
|
||||||
endi
|
endi
|
||||||
elif $data[0][8] == LEADER then
|
elif $data[0][8] == leader then
|
||||||
if $data[0][4] == FOLLOWER then
|
if $data[0][4] == follower then
|
||||||
if $data[0][6] == FOLLOWER then
|
if $data[0][6] == follower then
|
||||||
print ---- vgroup $data[0][0] leader locate on dnode $data[0][7]
|
print ---- vgroup $data[0][0] leader locate on dnode $data[0][7]
|
||||||
endi
|
endi
|
||||||
endi
|
endi
|
||||||
|
|
|
@ -108,21 +108,21 @@ if $rows != $vgroups then
|
||||||
return -1
|
return -1
|
||||||
endi
|
endi
|
||||||
|
|
||||||
if $data[0][4] == LEADER then
|
if $data[0][4] == leader then
|
||||||
if $data[0][6] == FOLLOWER then
|
if $data[0][6] == follower then
|
||||||
if $data[0][8] == FOLLOWER then
|
if $data[0][8] == follower then
|
||||||
print ---- vgroup $data[0][0] leader locate on dnode $data[0][3]
|
print ---- vgroup $data[0][0] leader locate on dnode $data[0][3]
|
||||||
endi
|
endi
|
||||||
endi
|
endi
|
||||||
elif $data[0][6] == LEADER then
|
elif $data[0][6] == leader then
|
||||||
if $data[0][4] == FOLLOWER then
|
if $data[0][4] == follower then
|
||||||
if $data[0][8] == FOLLOWER then
|
if $data[0][8] == follower then
|
||||||
print ---- vgroup $data[0][0] leader locate on dnode $data[0][5]
|
print ---- vgroup $data[0][0] leader locate on dnode $data[0][5]
|
||||||
endi
|
endi
|
||||||
endi
|
endi
|
||||||
elif $data[0][8] == LEADER then
|
elif $data[0][8] == leader then
|
||||||
if $data[0][4] == FOLLOWER then
|
if $data[0][4] == follower then
|
||||||
if $data[0][6] == FOLLOWER then
|
if $data[0][6] == follower then
|
||||||
print ---- vgroup $data[0][0] leader locate on dnode $data[0][7]
|
print ---- vgroup $data[0][0] leader locate on dnode $data[0][7]
|
||||||
endi
|
endi
|
||||||
endi
|
endi
|
||||||
|
@ -130,21 +130,21 @@ else
|
||||||
goto check_vg_ready
|
goto check_vg_ready
|
||||||
endi
|
endi
|
||||||
|
|
||||||
if $data[1][4] == LEADER then
|
if $data[1][4] == leader then
|
||||||
if $data[1][6] == FOLLOWER then
|
if $data[1][6] == follower then
|
||||||
if $data[1][8] == FOLLOWER then
|
if $data[1][8] == follower then
|
||||||
print ---- vgroup $data[1][0] leader locate on dnode $data[1][3]
|
print ---- vgroup $data[1][0] leader locate on dnode $data[1][3]
|
||||||
endi
|
endi
|
||||||
endi
|
endi
|
||||||
elif $data[1][6] == LEADER then
|
elif $data[1][6] == leader then
|
||||||
if $data[1][4] == FOLLOWER then
|
if $data[1][4] == follower then
|
||||||
if $data[1][8] == FOLLOWER then
|
if $data[1][8] == follower then
|
||||||
print ---- vgroup $data[1][0] leader locate on dnode $data[1][5]
|
print ---- vgroup $data[1][0] leader locate on dnode $data[1][5]
|
||||||
endi
|
endi
|
||||||
endi
|
endi
|
||||||
elif $data[1][8] == LEADER then
|
elif $data[1][8] == leader then
|
||||||
if $data[1][4] == FOLLOWER then
|
if $data[1][4] == follower then
|
||||||
if $data[1][6] == FOLLOWER then
|
if $data[1][6] == follower then
|
||||||
print ---- vgroup $data[1][0] leader locate on dnode $data[1][7]
|
print ---- vgroup $data[1][0] leader locate on dnode $data[1][7]
|
||||||
endi
|
endi
|
||||||
endi
|
endi
|
||||||
|
@ -152,21 +152,21 @@ else
|
||||||
goto check_vg_ready
|
goto check_vg_ready
|
||||||
endi
|
endi
|
||||||
|
|
||||||
if $data[2][4] == LEADER then
|
if $data[2][4] == leader then
|
||||||
if $data[2][6] == FOLLOWER then
|
if $data[2][6] == follower then
|
||||||
if $data[2][8] == FOLLOWER then
|
if $data[2][8] == follower then
|
||||||
print ---- vgroup $data[2][0] leader locate on dnode $data[2][3]
|
print ---- vgroup $data[2][0] leader locate on dnode $data[2][3]
|
||||||
endi
|
endi
|
||||||
endi
|
endi
|
||||||
elif $data[2][6] == LEADER then
|
elif $data[2][6] == leader then
|
||||||
if $data[2][4] == FOLLOWER then
|
if $data[2][4] == follower then
|
||||||
if $data[2][8] == FOLLOWER then
|
if $data[2][8] == follower then
|
||||||
print ---- vgroup $data[2][0] leader locate on dnode $data[2][5]
|
print ---- vgroup $data[2][0] leader locate on dnode $data[2][5]
|
||||||
endi
|
endi
|
||||||
endi
|
endi
|
||||||
elif $data[2][8] == LEADER then
|
elif $data[2][8] == leader then
|
||||||
if $data[2][4] == FOLLOWER then
|
if $data[2][4] == follower then
|
||||||
if $data[2][6] == FOLLOWER then
|
if $data[2][6] == follower then
|
||||||
print ---- vgroup $data[2][0] leader locate on dnode $data[2][7]
|
print ---- vgroup $data[2][0] leader locate on dnode $data[2][7]
|
||||||
endi
|
endi
|
||||||
endi
|
endi
|
||||||
|
@ -174,21 +174,21 @@ else
|
||||||
goto check_vg_ready
|
goto check_vg_ready
|
||||||
endi
|
endi
|
||||||
|
|
||||||
if $data[3][4] == LEADER then
|
if $data[3][4] == leader then
|
||||||
if $data[3][6] == FOLLOWER then
|
if $data[3][6] == follower then
|
||||||
if $data[3][8] == FOLLOWER then
|
if $data[3][8] == follower then
|
||||||
print ---- vgroup $data[3][0] leader locate on dnode $data[3][3]
|
print ---- vgroup $data[3][0] leader locate on dnode $data[3][3]
|
||||||
endi
|
endi
|
||||||
endi
|
endi
|
||||||
elif $data[3][6] == LEADER then
|
elif $data[3][6] == leader then
|
||||||
if $data[3][4] == FOLLOWER then
|
if $data[3][4] == follower then
|
||||||
if $data[3][8] == FOLLOWER then
|
if $data[3][8] == follower then
|
||||||
print ---- vgroup $data[3][0] leader locate on dnode $data[3][5]
|
print ---- vgroup $data[3][0] leader locate on dnode $data[3][5]
|
||||||
endi
|
endi
|
||||||
endi
|
endi
|
||||||
elif $data[3][8] == LEADER then
|
elif $data[3][8] == leader then
|
||||||
if $data[3][4] == FOLLOWER then
|
if $data[3][4] == follower then
|
||||||
if $data[3][6] == FOLLOWER then
|
if $data[3][6] == follower then
|
||||||
print ---- vgroup $data[3][0] leader locate on dnode $data[3][7]
|
print ---- vgroup $data[3][0] leader locate on dnode $data[3][7]
|
||||||
endi
|
endi
|
||||||
endi
|
endi
|
||||||
|
@ -196,21 +196,21 @@ else
|
||||||
goto check_vg_ready
|
goto check_vg_ready
|
||||||
endi
|
endi
|
||||||
|
|
||||||
if $data[4][4] == LEADER then
|
if $data[4][4] == leader then
|
||||||
if $data[4][6] == FOLLOWER then
|
if $data[4][6] == follower then
|
||||||
if $data[4][8] == FOLLOWER then
|
if $data[4][8] == follower then
|
||||||
print ---- vgroup $data[4][0] leader locate on dnode $data[4][3]
|
print ---- vgroup $data[4][0] leader locate on dnode $data[4][3]
|
||||||
endi
|
endi
|
||||||
endi
|
endi
|
||||||
elif $data[4][6] == LEADER then
|
elif $data[4][6] == leader then
|
||||||
if $data[4][4] == FOLLOWER then
|
if $data[4][4] == follower then
|
||||||
if $data[4][8] == FOLLOWER then
|
if $data[4][8] == follower then
|
||||||
print ---- vgroup $data[4][0] leader locate on dnode $data[4][5]
|
print ---- vgroup $data[4][0] leader locate on dnode $data[4][5]
|
||||||
endi
|
endi
|
||||||
endi
|
endi
|
||||||
elif $data[4][8] == LEADER then
|
elif $data[4][8] == leader then
|
||||||
if $data[4][4] == FOLLOWER then
|
if $data[4][4] == follower then
|
||||||
if $data[4][6] == FOLLOWER then
|
if $data[4][6] == follower then
|
||||||
print ---- vgroup $data[4][0] leader locate on dnode $data[4][7]
|
print ---- vgroup $data[4][0] leader locate on dnode $data[4][7]
|
||||||
endi
|
endi
|
||||||
endi
|
endi
|
||||||
|
@ -335,21 +335,21 @@ if $rows != $vgroups then
|
||||||
return -1
|
return -1
|
||||||
endi
|
endi
|
||||||
|
|
||||||
if $data[0][4] == LEADER then
|
if $data[0][4] == leader then
|
||||||
if $data[0][6] == FOLLOWER then
|
if $data[0][6] == follower then
|
||||||
if $data[0][8] == FOLLOWER then
|
if $data[0][8] == follower then
|
||||||
print ---- vgroup $data[0][0] leader locate on dnode $data[0][3]
|
print ---- vgroup $data[0][0] leader locate on dnode $data[0][3]
|
||||||
endi
|
endi
|
||||||
endi
|
endi
|
||||||
elif $data[0][6] == LEADER then
|
elif $data[0][6] == leader then
|
||||||
if $data[0][4] == FOLLOWER then
|
if $data[0][4] == follower then
|
||||||
if $data[0][8] == FOLLOWER then
|
if $data[0][8] == follower then
|
||||||
print ---- vgroup $data[0][0] leader locate on dnode $data[0][5]
|
print ---- vgroup $data[0][0] leader locate on dnode $data[0][5]
|
||||||
endi
|
endi
|
||||||
endi
|
endi
|
||||||
elif $data[0][8] == LEADER then
|
elif $data[0][8] == leader then
|
||||||
if $data[0][4] == FOLLOWER then
|
if $data[0][4] == follower then
|
||||||
if $data[0][6] == FOLLOWER then
|
if $data[0][6] == follower then
|
||||||
print ---- vgroup $data[0][0] leader locate on dnode $data[0][7]
|
print ---- vgroup $data[0][0] leader locate on dnode $data[0][7]
|
||||||
endi
|
endi
|
||||||
endi
|
endi
|
||||||
|
@ -357,21 +357,21 @@ else
|
||||||
goto check_vg_ready1
|
goto check_vg_ready1
|
||||||
endi
|
endi
|
||||||
|
|
||||||
if $data[1][4] == LEADER then
|
if $data[1][4] == leader then
|
||||||
if $data[1][6] == FOLLOWER then
|
if $data[1][6] == follower then
|
||||||
if $data[1][8] == FOLLOWER then
|
if $data[1][8] == follower then
|
||||||
print ---- vgroup $data[1][0] leader locate on dnode $data[1][3]
|
print ---- vgroup $data[1][0] leader locate on dnode $data[1][3]
|
||||||
endi
|
endi
|
||||||
endi
|
endi
|
||||||
elif $data[1][6] == LEADER then
|
elif $data[1][6] == leader then
|
||||||
if $data[1][4] == FOLLOWER then
|
if $data[1][4] == follower then
|
||||||
if $data[1][8] == FOLLOWER then
|
if $data[1][8] == follower then
|
||||||
print ---- vgroup $data[1][0] leader locate on dnode $data[1][5]
|
print ---- vgroup $data[1][0] leader locate on dnode $data[1][5]
|
||||||
endi
|
endi
|
||||||
endi
|
endi
|
||||||
elif $data[1][8] == LEADER then
|
elif $data[1][8] == leader then
|
||||||
if $data[1][4] == FOLLOWER then
|
if $data[1][4] == follower then
|
||||||
if $data[1][6] == FOLLOWER then
|
if $data[1][6] == follower then
|
||||||
print ---- vgroup $data[1][0] leader locate on dnode $data[1][7]
|
print ---- vgroup $data[1][0] leader locate on dnode $data[1][7]
|
||||||
endi
|
endi
|
||||||
endi
|
endi
|
||||||
|
@ -379,21 +379,21 @@ else
|
||||||
goto check_vg_ready1
|
goto check_vg_ready1
|
||||||
endi
|
endi
|
||||||
|
|
||||||
if $data[2][4] == LEADER then
|
if $data[2][4] == leader then
|
||||||
if $data[2][6] == FOLLOWER then
|
if $data[2][6] == follower then
|
||||||
if $data[2][8] == FOLLOWER then
|
if $data[2][8] == follower then
|
||||||
print ---- vgroup $data[2][0] leader locate on dnode $data[2][3]
|
print ---- vgroup $data[2][0] leader locate on dnode $data[2][3]
|
||||||
endi
|
endi
|
||||||
endi
|
endi
|
||||||
elif $data[2][6] == LEADER then
|
elif $data[2][6] == leader then
|
||||||
if $data[2][4] == FOLLOWER then
|
if $data[2][4] == follower then
|
||||||
if $data[2][8] == FOLLOWER then
|
if $data[2][8] == follower then
|
||||||
print ---- vgroup $data[2][0] leader locate on dnode $data[2][5]
|
print ---- vgroup $data[2][0] leader locate on dnode $data[2][5]
|
||||||
endi
|
endi
|
||||||
endi
|
endi
|
||||||
elif $data[2][8] == LEADER then
|
elif $data[2][8] == leader then
|
||||||
if $data[2][4] == FOLLOWER then
|
if $data[2][4] == follower then
|
||||||
if $data[2][6] == FOLLOWER then
|
if $data[2][6] == follower then
|
||||||
print ---- vgroup $data[2][0] leader locate on dnode $data[2][7]
|
print ---- vgroup $data[2][0] leader locate on dnode $data[2][7]
|
||||||
endi
|
endi
|
||||||
endi
|
endi
|
||||||
|
@ -401,21 +401,21 @@ else
|
||||||
goto check_vg_ready1
|
goto check_vg_ready1
|
||||||
endi
|
endi
|
||||||
|
|
||||||
if $data[3][4] == LEADER then
|
if $data[3][4] == leader then
|
||||||
if $data[3][6] == FOLLOWER then
|
if $data[3][6] == follower then
|
||||||
if $data[3][8] == FOLLOWER then
|
if $data[3][8] == follower then
|
||||||
print ---- vgroup $data[3][0] leader locate on dnode $data[3][3]
|
print ---- vgroup $data[3][0] leader locate on dnode $data[3][3]
|
||||||
endi
|
endi
|
||||||
endi
|
endi
|
||||||
elif $data[3][6] == LEADER then
|
elif $data[3][6] == leader then
|
||||||
if $data[3][4] == FOLLOWER then
|
if $data[3][4] == follower then
|
||||||
if $data[3][8] == FOLLOWER then
|
if $data[3][8] == follower then
|
||||||
print ---- vgroup $data[3][0] leader locate on dnode $data[3][5]
|
print ---- vgroup $data[3][0] leader locate on dnode $data[3][5]
|
||||||
endi
|
endi
|
||||||
endi
|
endi
|
||||||
elif $data[3][8] == LEADER then
|
elif $data[3][8] == leader then
|
||||||
if $data[3][4] == FOLLOWER then
|
if $data[3][4] == follower then
|
||||||
if $data[3][6] == FOLLOWER then
|
if $data[3][6] == follower then
|
||||||
print ---- vgroup $data[3][0] leader locate on dnode $data[3][7]
|
print ---- vgroup $data[3][0] leader locate on dnode $data[3][7]
|
||||||
endi
|
endi
|
||||||
endi
|
endi
|
||||||
|
@ -423,21 +423,21 @@ else
|
||||||
goto check_vg_ready1
|
goto check_vg_ready1
|
||||||
endi
|
endi
|
||||||
|
|
||||||
if $data[4][4] == LEADER then
|
if $data[4][4] == leader then
|
||||||
if $data[4][6] == FOLLOWER then
|
if $data[4][6] == follower then
|
||||||
if $data[4][8] == FOLLOWER then
|
if $data[4][8] == follower then
|
||||||
print ---- vgroup $data[4][0] leader locate on dnode $data[4][3]
|
print ---- vgroup $data[4][0] leader locate on dnode $data[4][3]
|
||||||
endi
|
endi
|
||||||
endi
|
endi
|
||||||
elif $data[4][6] == LEADER then
|
elif $data[4][6] == leader then
|
||||||
if $data[4][4] == FOLLOWER then
|
if $data[4][4] == follower then
|
||||||
if $data[4][8] == FOLLOWER then
|
if $data[4][8] == follower then
|
||||||
print ---- vgroup $data[4][0] leader locate on dnode $data[4][5]
|
print ---- vgroup $data[4][0] leader locate on dnode $data[4][5]
|
||||||
endi
|
endi
|
||||||
endi
|
endi
|
||||||
elif $data[4][8] == LEADER then
|
elif $data[4][8] == leader then
|
||||||
if $data[4][4] == FOLLOWER then
|
if $data[4][4] == follower then
|
||||||
if $data[4][6] == FOLLOWER then
|
if $data[4][6] == follower then
|
||||||
print ---- vgroup $data[4][0] leader locate on dnode $data[4][7]
|
print ---- vgroup $data[4][0] leader locate on dnode $data[4][7]
|
||||||
endi
|
endi
|
||||||
endi
|
endi
|
||||||
|
@ -635,21 +635,21 @@ if $rows != $vgroups then
|
||||||
return -1
|
return -1
|
||||||
endi
|
endi
|
||||||
|
|
||||||
if $data[0][4] == LEADER then
|
if $data[0][4] == leader then
|
||||||
if $data[0][6] == FOLLOWER then
|
if $data[0][6] == follower then
|
||||||
if $data[0][8] == FOLLOWER then
|
if $data[0][8] == follower then
|
||||||
print ---- vgroup $data[0][0] leader locate on dnode $data[0][3]
|
print ---- vgroup $data[0][0] leader locate on dnode $data[0][3]
|
||||||
endi
|
endi
|
||||||
endi
|
endi
|
||||||
elif $data[0][6] == LEADER then
|
elif $data[0][6] == leader then
|
||||||
if $data[0][4] == FOLLOWER then
|
if $data[0][4] == follower then
|
||||||
if $data[0][8] == FOLLOWER then
|
if $data[0][8] == follower then
|
||||||
print ---- vgroup $data[0][0] leader locate on dnode $data[0][5]
|
print ---- vgroup $data[0][0] leader locate on dnode $data[0][5]
|
||||||
endi
|
endi
|
||||||
endi
|
endi
|
||||||
elif $data[0][8] == LEADER then
|
elif $data[0][8] == leader then
|
||||||
if $data[0][4] == FOLLOWER then
|
if $data[0][4] == follower then
|
||||||
if $data[0][6] == FOLLOWER then
|
if $data[0][6] == follower then
|
||||||
print ---- vgroup $data[0][0] leader locate on dnode $data[0][7]
|
print ---- vgroup $data[0][0] leader locate on dnode $data[0][7]
|
||||||
endi
|
endi
|
||||||
endi
|
endi
|
||||||
|
@ -657,21 +657,21 @@ else
|
||||||
goto check_vg_ready3
|
goto check_vg_ready3
|
||||||
endi
|
endi
|
||||||
|
|
||||||
if $data[1][4] == LEADER then
|
if $data[1][4] == leader then
|
||||||
if $data[1][6] == FOLLOWER then
|
if $data[1][6] == follower then
|
||||||
if $data[1][8] == FOLLOWER then
|
if $data[1][8] == follower then
|
||||||
print ---- vgroup $data[1][0] leader locate on dnode $data[1][3]
|
print ---- vgroup $data[1][0] leader locate on dnode $data[1][3]
|
||||||
endi
|
endi
|
||||||
endi
|
endi
|
||||||
elif $data[1][6] == LEADER then
|
elif $data[1][6] == leader then
|
||||||
if $data[1][4] == FOLLOWER then
|
if $data[1][4] == follower then
|
||||||
if $data[1][8] == FOLLOWER then
|
if $data[1][8] == follower then
|
||||||
print ---- vgroup $data[1][0] leader locate on dnode $data[1][5]
|
print ---- vgroup $data[1][0] leader locate on dnode $data[1][5]
|
||||||
endi
|
endi
|
||||||
endi
|
endi
|
||||||
elif $data[1][8] == LEADER then
|
elif $data[1][8] == leader then
|
||||||
if $data[1][4] == FOLLOWER then
|
if $data[1][4] == follower then
|
||||||
if $data[1][6] == FOLLOWER then
|
if $data[1][6] == follower then
|
||||||
print ---- vgroup $data[1][0] leader locate on dnode $data[1][7]
|
print ---- vgroup $data[1][0] leader locate on dnode $data[1][7]
|
||||||
endi
|
endi
|
||||||
endi
|
endi
|
||||||
|
@ -679,21 +679,21 @@ else
|
||||||
goto check_vg_ready3
|
goto check_vg_ready3
|
||||||
endi
|
endi
|
||||||
|
|
||||||
if $data[2][4] == LEADER then
|
if $data[2][4] == leader then
|
||||||
if $data[2][6] == FOLLOWER then
|
if $data[2][6] == follower then
|
||||||
if $data[2][8] == FOLLOWER then
|
if $data[2][8] == follower then
|
||||||
print ---- vgroup $data[2][0] leader locate on dnode $data[2][3]
|
print ---- vgroup $data[2][0] leader locate on dnode $data[2][3]
|
||||||
endi
|
endi
|
||||||
endi
|
endi
|
||||||
elif $data[2][6] == LEADER then
|
elif $data[2][6] == leader then
|
||||||
if $data[2][4] == FOLLOWER then
|
if $data[2][4] == follower then
|
||||||
if $data[2][8] == FOLLOWER then
|
if $data[2][8] == follower then
|
||||||
print ---- vgroup $data[2][0] leader locate on dnode $data[2][5]
|
print ---- vgroup $data[2][0] leader locate on dnode $data[2][5]
|
||||||
endi
|
endi
|
||||||
endi
|
endi
|
||||||
elif $data[2][8] == LEADER then
|
elif $data[2][8] == leader then
|
||||||
if $data[2][4] == FOLLOWER then
|
if $data[2][4] == follower then
|
||||||
if $data[2][6] == FOLLOWER then
|
if $data[2][6] == follower then
|
||||||
print ---- vgroup $data[2][0] leader locate on dnode $data[2][7]
|
print ---- vgroup $data[2][0] leader locate on dnode $data[2][7]
|
||||||
endi
|
endi
|
||||||
endi
|
endi
|
||||||
|
@ -701,21 +701,21 @@ else
|
||||||
goto check_vg_ready3
|
goto check_vg_ready3
|
||||||
endi
|
endi
|
||||||
|
|
||||||
if $data[3][4] == LEADER then
|
if $data[3][4] == leader then
|
||||||
if $data[3][6] == FOLLOWER then
|
if $data[3][6] == follower then
|
||||||
if $data[3][8] == FOLLOWER then
|
if $data[3][8] == follower then
|
||||||
print ---- vgroup $data[3][0] leader locate on dnode $data[3][3]
|
print ---- vgroup $data[3][0] leader locate on dnode $data[3][3]
|
||||||
endi
|
endi
|
||||||
endi
|
endi
|
||||||
elif $data[3][6] == LEADER then
|
elif $data[3][6] == leader then
|
||||||
if $data[3][4] == FOLLOWER then
|
if $data[3][4] == follower then
|
||||||
if $data[3][8] == FOLLOWER then
|
if $data[3][8] == follower then
|
||||||
print ---- vgroup $data[3][0] leader locate on dnode $data[3][5]
|
print ---- vgroup $data[3][0] leader locate on dnode $data[3][5]
|
||||||
endi
|
endi
|
||||||
endi
|
endi
|
||||||
elif $data[3][8] == LEADER then
|
elif $data[3][8] == leader then
|
||||||
if $data[3][4] == FOLLOWER then
|
if $data[3][4] == follower then
|
||||||
if $data[3][6] == FOLLOWER then
|
if $data[3][6] == follower then
|
||||||
print ---- vgroup $data[3][0] leader locate on dnode $data[3][7]
|
print ---- vgroup $data[3][0] leader locate on dnode $data[3][7]
|
||||||
endi
|
endi
|
||||||
endi
|
endi
|
||||||
|
@ -723,21 +723,21 @@ else
|
||||||
goto check_vg_ready3
|
goto check_vg_ready3
|
||||||
endi
|
endi
|
||||||
|
|
||||||
if $data[4][4] == LEADER then
|
if $data[4][4] == leader then
|
||||||
if $data[4][6] == FOLLOWER then
|
if $data[4][6] == follower then
|
||||||
if $data[4][8] == FOLLOWER then
|
if $data[4][8] == follower then
|
||||||
print ---- vgroup $data[4][0] leader locate on dnode $data[4][3]
|
print ---- vgroup $data[4][0] leader locate on dnode $data[4][3]
|
||||||
endi
|
endi
|
||||||
endi
|
endi
|
||||||
elif $data[4][6] == LEADER then
|
elif $data[4][6] == leader then
|
||||||
if $data[4][4] == FOLLOWER then
|
if $data[4][4] == follower then
|
||||||
if $data[4][8] == FOLLOWER then
|
if $data[4][8] == follower then
|
||||||
print ---- vgroup $data[4][0] leader locate on dnode $data[4][5]
|
print ---- vgroup $data[4][0] leader locate on dnode $data[4][5]
|
||||||
endi
|
endi
|
||||||
endi
|
endi
|
||||||
elif $data[4][8] == LEADER then
|
elif $data[4][8] == leader then
|
||||||
if $data[4][4] == FOLLOWER then
|
if $data[4][4] == follower then
|
||||||
if $data[4][6] == FOLLOWER then
|
if $data[4][6] == follower then
|
||||||
print ---- vgroup $data[4][0] leader locate on dnode $data[4][7]
|
print ---- vgroup $data[4][0] leader locate on dnode $data[4][7]
|
||||||
endi
|
endi
|
||||||
endi
|
endi
|
||||||
|
|
|
@ -103,13 +103,13 @@ print $data[0][0] $data[0][1] $data[0][2] $data[0][3] $data[0][4] $data[0][5] $d
|
||||||
if $rows != $vgroups then
|
if $rows != $vgroups then
|
||||||
return -1
|
return -1
|
||||||
endi
|
endi
|
||||||
if $data[0][4] == LEADER then
|
if $data[0][4] == leader then
|
||||||
print ---- vgroup $data[0][0] leader locate on dnode $data[0][3]
|
print ---- vgroup $data[0][0] leader locate on dnode $data[0][3]
|
||||||
goto vg_ready
|
goto vg_ready
|
||||||
elif $data[0][6] == LEADER then
|
elif $data[0][6] == leader then
|
||||||
print ---- vgroup $data[0][0] leader locate on dnode $data[0][5]
|
print ---- vgroup $data[0][0] leader locate on dnode $data[0][5]
|
||||||
goto vg_ready
|
goto vg_ready
|
||||||
elif $data[0][8] == LEADER then
|
elif $data[0][8] == leader then
|
||||||
print ---- vgroup $data[0][0] leader locate on dnode $data[0][7]
|
print ---- vgroup $data[0][0] leader locate on dnode $data[0][7]
|
||||||
goto vg_ready
|
goto vg_ready
|
||||||
else
|
else
|
||||||
|
@ -154,11 +154,11 @@ switch_leader_to_offine_loop:
|
||||||
print ====> finde vnode of leader, and stop the dnode where the vnode is located, and query stb/ntb count(*)
|
print ====> finde vnode of leader, and stop the dnode where the vnode is located, and query stb/ntb count(*)
|
||||||
sql show vgroups
|
sql show vgroups
|
||||||
print $data[0][0] $data[0][1] $data[0][2] $data[0][3] $data[0][4] $data[0][5] $data[0][6] $data[0][7] $data[0][8] $data[0][9] $data[0][6] $data[0][11] $data[0][12] $data[0][13]
|
print $data[0][0] $data[0][1] $data[0][2] $data[0][3] $data[0][4] $data[0][5] $data[0][6] $data[0][7] $data[0][8] $data[0][9] $data[0][6] $data[0][11] $data[0][12] $data[0][13]
|
||||||
if $data[0][4] == LEADER then
|
if $data[0][4] == leader then
|
||||||
$dnodeId = $data[0][3]
|
$dnodeId = $data[0][3]
|
||||||
elif $data[0][6] == LEADER then
|
elif $data[0][6] == leader then
|
||||||
$dnodeId = $data[0][5]
|
$dnodeId = $data[0][5]
|
||||||
elif $data[0][8] == LEADER then
|
elif $data[0][8] == leader then
|
||||||
$dnodeId = $data[0][7]
|
$dnodeId = $data[0][7]
|
||||||
else
|
else
|
||||||
print ====> no leader vnode!!!
|
print ====> no leader vnode!!!
|
||||||
|
@ -186,13 +186,13 @@ if $rows != $vgroups then
|
||||||
return -1
|
return -1
|
||||||
endi
|
endi
|
||||||
|
|
||||||
if $data[0][4] == OFFLINE then
|
if $data[0][4] == offline then
|
||||||
print ---- vgroup $dnodeId leader switch to offline
|
print ---- vgroup $dnodeId leader switch to offline
|
||||||
goto vg_offline_1
|
goto vg_offline_1
|
||||||
elif $data[0][6] == OFFLINE then
|
elif $data[0][6] == offline then
|
||||||
print ---- vgroup $dnodeId leader switch to offline
|
print ---- vgroup $dnodeId leader switch to offline
|
||||||
goto vg_offline_1
|
goto vg_offline_1
|
||||||
elif $data[0][8] == OFFLINE then
|
elif $data[0][8] == offline then
|
||||||
print ---- vgroup $dnodeId leader switch to offline
|
print ---- vgroup $dnodeId leader switch to offline
|
||||||
goto vg_offline_1
|
goto vg_offline_1
|
||||||
else
|
else
|
||||||
|
@ -218,13 +218,13 @@ print $data[0][0] $data[0][1] $data[0][2] $data[0][3] $data[0][4] $data[0][5] $d
|
||||||
if $rows != $vgroups then
|
if $rows != $vgroups then
|
||||||
return -1
|
return -1
|
||||||
endi
|
endi
|
||||||
if $data[0][4] == LEADER then
|
if $data[0][4] == leader then
|
||||||
print ---- vgroup $data[0][0] leader locate on dnode $data[0][3]
|
print ---- vgroup $data[0][0] leader locate on dnode $data[0][3]
|
||||||
goto countinu_loop
|
goto countinu_loop
|
||||||
elif $data[0][6] == LEADER then
|
elif $data[0][6] == leader then
|
||||||
print ---- vgroup $data[0][0] leader locate on dnode $data[0][5]
|
print ---- vgroup $data[0][0] leader locate on dnode $data[0][5]
|
||||||
goto countinu_loop
|
goto countinu_loop
|
||||||
elif $data[0][8] == LEADER then
|
elif $data[0][8] == leader then
|
||||||
print ---- vgroup $data[0][0] leader locate on dnode $data[0][7]
|
print ---- vgroup $data[0][0] leader locate on dnode $data[0][7]
|
||||||
goto countinu_loop
|
goto countinu_loop
|
||||||
else
|
else
|
||||||
|
|
|
@ -104,7 +104,7 @@ print $data[0][0] $data[0][1] $data[0][2] $data[0][3] $data[0][4] $data[0][5] $d
|
||||||
if $rows != $vgroups then
|
if $rows != $vgroups then
|
||||||
return -1
|
return -1
|
||||||
endi
|
endi
|
||||||
if $data[0][4] == LEADER then
|
if $data[0][4] == leader then
|
||||||
if $data[0][6] != NULL then
|
if $data[0][6] != NULL then
|
||||||
goto check_vg_ready
|
goto check_vg_ready
|
||||||
endi
|
endi
|
||||||
|
@ -114,7 +114,7 @@ if $data[0][4] == LEADER then
|
||||||
print ---- vgroup $data[0][0] leader locate on dnode $data[0][3]
|
print ---- vgroup $data[0][0] leader locate on dnode $data[0][3]
|
||||||
goto vg_ready
|
goto vg_ready
|
||||||
endi
|
endi
|
||||||
if $data[0][6] == LEADER then
|
if $data[0][6] == leader then
|
||||||
if $data[0][4] != NULL then
|
if $data[0][4] != NULL then
|
||||||
goto check_vg_ready
|
goto check_vg_ready
|
||||||
endi
|
endi
|
||||||
|
@ -124,7 +124,7 @@ if $data[0][6] == LEADER then
|
||||||
print ---- vgroup $data[0][0] leader locate on dnode $data[0][5]
|
print ---- vgroup $data[0][0] leader locate on dnode $data[0][5]
|
||||||
goto vg_ready
|
goto vg_ready
|
||||||
endi
|
endi
|
||||||
if $data[0][8] == LEADER then
|
if $data[0][8] == leader then
|
||||||
if $data[0][4] != NULL then
|
if $data[0][4] != NULL then
|
||||||
goto check_vg_ready
|
goto check_vg_ready
|
||||||
endi
|
endi
|
||||||
|
@ -208,11 +208,11 @@ switch_leader_loop:
|
||||||
print ====> finde vnode of leader, and stop the dnode where the vnode is located, and query stb/ntb count(*)
|
print ====> finde vnode of leader, and stop the dnode where the vnode is located, and query stb/ntb count(*)
|
||||||
sql show vgroups
|
sql show vgroups
|
||||||
print $data(2)[0] $data(2)[1] $data(2)[2] $data(2)[3] $data(2)[4] $data(2)[5] $data(2)[6] $data(2)[7] $data(2)[8] $data(2)[9] $data(2)[10] $data(2)[11] $data(2)[12] $data(2)[13]
|
print $data(2)[0] $data(2)[1] $data(2)[2] $data(2)[3] $data(2)[4] $data(2)[5] $data(2)[6] $data(2)[7] $data(2)[8] $data(2)[9] $data(2)[10] $data(2)[11] $data(2)[12] $data(2)[13]
|
||||||
if $data[0][4] == LEADER then
|
if $data[0][4] == leader then
|
||||||
$dnodeId = $data[0][3]
|
$dnodeId = $data[0][3]
|
||||||
elif $data[0][6] == LEADER then
|
elif $data[0][6] == leader then
|
||||||
$dnodeId = $data[0][5]
|
$dnodeId = $data[0][5]
|
||||||
elif $data[0][8] == LEADER then
|
elif $data[0][8] == leader then
|
||||||
$dnodeId = $data[0][7]
|
$dnodeId = $data[0][7]
|
||||||
else
|
else
|
||||||
print ====> no leader vnode!!!
|
print ====> no leader vnode!!!
|
||||||
|
@ -238,7 +238,7 @@ print $data[0][0] $data[0][1] $data[0][2] $data[0][3] $data[0][4] $data[0][5] $d
|
||||||
if $rows != $vgroups then
|
if $rows != $vgroups then
|
||||||
return -1
|
return -1
|
||||||
endi
|
endi
|
||||||
if $data[0][4] == LEADER then
|
if $data[0][4] == leader then
|
||||||
if $data[0][6] != NULL then
|
if $data[0][6] != NULL then
|
||||||
goto check_vg_ready_2
|
goto check_vg_ready_2
|
||||||
endi
|
endi
|
||||||
|
@ -248,7 +248,7 @@ if $data[0][4] == LEADER then
|
||||||
print ---- vgroup $data[0][0] leader switch to dnode $data[0][3]
|
print ---- vgroup $data[0][0] leader switch to dnode $data[0][3]
|
||||||
goto vg_ready_2
|
goto vg_ready_2
|
||||||
endi
|
endi
|
||||||
if $data[0][6] == LEADER then
|
if $data[0][6] == leader then
|
||||||
if $data[0][4] != NULL then
|
if $data[0][4] != NULL then
|
||||||
goto check_vg_ready_2
|
goto check_vg_ready_2
|
||||||
endi
|
endi
|
||||||
|
@ -258,7 +258,7 @@ if $data[0][6] == LEADER then
|
||||||
print ---- vgroup $data[0][0] leader switch to dnode $data[0][5]
|
print ---- vgroup $data[0][0] leader switch to dnode $data[0][5]
|
||||||
goto vg_ready_2
|
goto vg_ready_2
|
||||||
endi
|
endi
|
||||||
if $data[0][8] == LEADER then
|
if $data[0][8] == leader then
|
||||||
if $data[0][4] != NULL then
|
if $data[0][4] != NULL then
|
||||||
goto check_vg_ready_2
|
goto check_vg_ready_2
|
||||||
endi
|
endi
|
||||||
|
@ -343,7 +343,7 @@ print $data[0][0] $data[0][1] $data[0][2] $data[0][3] $data[0][4] $data[0][5] $d
|
||||||
if $rows != $vgroups then
|
if $rows != $vgroups then
|
||||||
return -1
|
return -1
|
||||||
endi
|
endi
|
||||||
if $data[0][4] == LEADER then
|
if $data[0][4] == leader then
|
||||||
if $data[0][6] != NULL then
|
if $data[0][6] != NULL then
|
||||||
goto check_vg_ready_1
|
goto check_vg_ready_1
|
||||||
endi
|
endi
|
||||||
|
@ -352,7 +352,7 @@ if $data[0][4] == LEADER then
|
||||||
endi
|
endi
|
||||||
goto vg_ready_1
|
goto vg_ready_1
|
||||||
endi
|
endi
|
||||||
if $data[0][6] == LEADER then
|
if $data[0][6] == leader then
|
||||||
if $data[0][4] != NULL then
|
if $data[0][4] != NULL then
|
||||||
goto check_vg_ready_1
|
goto check_vg_ready_1
|
||||||
endi
|
endi
|
||||||
|
@ -361,7 +361,7 @@ if $data[0][6] == LEADER then
|
||||||
endi
|
endi
|
||||||
goto vg_ready_1
|
goto vg_ready_1
|
||||||
endi
|
endi
|
||||||
if $data[0][8] == LEADER then
|
if $data[0][8] == leader then
|
||||||
if $data[0][4] != NULL then
|
if $data[0][4] != NULL then
|
||||||
goto check_vg_ready_1
|
goto check_vg_ready_1
|
||||||
endi
|
endi
|
||||||
|
|
|
@ -104,51 +104,51 @@ if $rows != $vgroups then
|
||||||
return -1
|
return -1
|
||||||
endi
|
endi
|
||||||
|
|
||||||
if $data[0][4] == LEADER then
|
if $data[0][4] == leader then
|
||||||
print ---- vgroup $data[0][0] leader locate on dnode $data[0][3]
|
print ---- vgroup $data[0][0] leader locate on dnode $data[0][3]
|
||||||
elif $data[0][6] == LEADER then
|
elif $data[0][6] == leader then
|
||||||
print ---- vgroup $data[0][0] leader locate on dnode $data[0][5]
|
print ---- vgroup $data[0][0] leader locate on dnode $data[0][5]
|
||||||
elif $data[0][8] == LEADER then
|
elif $data[0][8] == leader then
|
||||||
print ---- vgroup $data[0][0] leader locate on dnode $data[0][7]
|
print ---- vgroup $data[0][0] leader locate on dnode $data[0][7]
|
||||||
else
|
else
|
||||||
goto check_vg_ready
|
goto check_vg_ready
|
||||||
endi
|
endi
|
||||||
|
|
||||||
if $data[1][4] == LEADER then
|
if $data[1][4] == leader then
|
||||||
print ---- vgroup $data[1][0] leader locate on dnode $data[0][3]
|
print ---- vgroup $data[1][0] leader locate on dnode $data[0][3]
|
||||||
elif $data[1][6] == LEADER then
|
elif $data[1][6] == leader then
|
||||||
print ---- vgroup $data[1][0] leader locate on dnode $data[0][5]
|
print ---- vgroup $data[1][0] leader locate on dnode $data[0][5]
|
||||||
elif $data[1][8] == LEADER then
|
elif $data[1][8] == leader then
|
||||||
print ---- vgroup $data[1][0] leader locate on dnode $data[0][7]
|
print ---- vgroup $data[1][0] leader locate on dnode $data[0][7]
|
||||||
else
|
else
|
||||||
goto check_vg_ready
|
goto check_vg_ready
|
||||||
endi
|
endi
|
||||||
|
|
||||||
if $data[2][4] == LEADER then
|
if $data[2][4] == leader then
|
||||||
print ---- vgroup $data[2][0] leader locate on dnode $data[0][3]
|
print ---- vgroup $data[2][0] leader locate on dnode $data[0][3]
|
||||||
elif $data[2][6] == LEADER then
|
elif $data[2][6] == leader then
|
||||||
print ---- vgroup $data[2][0] leader locate on dnode $data[0][5]
|
print ---- vgroup $data[2][0] leader locate on dnode $data[0][5]
|
||||||
elif $data[2][8] == LEADER then
|
elif $data[2][8] == leader then
|
||||||
print ---- vgroup $data[2][0] leader locate on dnode $data[0][7]
|
print ---- vgroup $data[2][0] leader locate on dnode $data[0][7]
|
||||||
else
|
else
|
||||||
goto check_vg_ready
|
goto check_vg_ready
|
||||||
endi
|
endi
|
||||||
|
|
||||||
if $data[3][4] == LEADER then
|
if $data[3][4] == leader then
|
||||||
print ---- vgroup $data[3][0] leader locate on dnode $data[0][3]
|
print ---- vgroup $data[3][0] leader locate on dnode $data[0][3]
|
||||||
elif $data[3][6] == LEADER then
|
elif $data[3][6] == leader then
|
||||||
print ---- vgroup $data[3][0] leader locate on dnode $data[0][5]
|
print ---- vgroup $data[3][0] leader locate on dnode $data[0][5]
|
||||||
elif $data[3][8] == LEADER then
|
elif $data[3][8] == leader then
|
||||||
print ---- vgroup $data[3][0] leader locate on dnode $data[0][7]
|
print ---- vgroup $data[3][0] leader locate on dnode $data[0][7]
|
||||||
else
|
else
|
||||||
goto check_vg_ready
|
goto check_vg_ready
|
||||||
endi
|
endi
|
||||||
|
|
||||||
if $data[4][4] == LEADER then
|
if $data[4][4] == leader then
|
||||||
print ---- vgroup $data[4][0] leader locate on dnode $data[0][3]
|
print ---- vgroup $data[4][0] leader locate on dnode $data[0][3]
|
||||||
elif $data[4][6] == LEADER then
|
elif $data[4][6] == leader then
|
||||||
print ---- vgroup $data[4][0] leader locate on dnode $data[0][5]
|
print ---- vgroup $data[4][0] leader locate on dnode $data[0][5]
|
||||||
elif $data[4][8] == LEADER then
|
elif $data[4][8] == leader then
|
||||||
print ---- vgroup $data[4][0] leader locate on dnode $data[0][7]
|
print ---- vgroup $data[4][0] leader locate on dnode $data[0][7]
|
||||||
else
|
else
|
||||||
goto check_vg_ready
|
goto check_vg_ready
|
||||||
|
@ -272,51 +272,51 @@ if $rows != $vgroups then
|
||||||
return -1
|
return -1
|
||||||
endi
|
endi
|
||||||
|
|
||||||
if $data[0][4] == LEADER then
|
if $data[0][4] == leader then
|
||||||
print ---- vgroup $data[0][0] leader locate on dnode $data[0][3]
|
print ---- vgroup $data[0][0] leader locate on dnode $data[0][3]
|
||||||
elif $data[0][6] == LEADER then
|
elif $data[0][6] == leader then
|
||||||
print ---- vgroup $data[0][0] leader locate on dnode $data[0][5]
|
print ---- vgroup $data[0][0] leader locate on dnode $data[0][5]
|
||||||
elif $data[0][8] == LEADER then
|
elif $data[0][8] == leader then
|
||||||
print ---- vgroup $data[0][0] leader locate on dnode $data[0][7]
|
print ---- vgroup $data[0][0] leader locate on dnode $data[0][7]
|
||||||
else
|
else
|
||||||
goto check_vg_ready1
|
goto check_vg_ready1
|
||||||
endi
|
endi
|
||||||
|
|
||||||
if $data[1][4] == LEADER then
|
if $data[1][4] == leader then
|
||||||
print ---- vgroup $data[1][0] leader locate on dnode $data[1][3]
|
print ---- vgroup $data[1][0] leader locate on dnode $data[1][3]
|
||||||
elif $data[1][6] == LEADER then
|
elif $data[1][6] == leader then
|
||||||
print ---- vgroup $data[1][0] leader locate on dnode $data[1][5]
|
print ---- vgroup $data[1][0] leader locate on dnode $data[1][5]
|
||||||
elif $data[1][8] == LEADER then
|
elif $data[1][8] == leader then
|
||||||
print ---- vgroup $data[1][0] leader locate on dnode $data[1][7]
|
print ---- vgroup $data[1][0] leader locate on dnode $data[1][7]
|
||||||
else
|
else
|
||||||
goto check_vg_ready1
|
goto check_vg_ready1
|
||||||
endi
|
endi
|
||||||
|
|
||||||
if $data[2][4] == LEADER then
|
if $data[2][4] == leader then
|
||||||
print ---- vgroup $data[2][0] leader locate on dnode $data[2][3]
|
print ---- vgroup $data[2][0] leader locate on dnode $data[2][3]
|
||||||
elif $data[2][6] == LEADER then
|
elif $data[2][6] == leader then
|
||||||
print ---- vgroup $data[2][0] leader locate on dnode $data[2][5]
|
print ---- vgroup $data[2][0] leader locate on dnode $data[2][5]
|
||||||
elif $data[2][8] == LEADER then
|
elif $data[2][8] == leader then
|
||||||
print ---- vgroup $data[2][0] leader locate on dnode $data[2][7]
|
print ---- vgroup $data[2][0] leader locate on dnode $data[2][7]
|
||||||
else
|
else
|
||||||
goto check_vg_ready
|
goto check_vg_ready
|
||||||
endi
|
endi
|
||||||
|
|
||||||
if $data[3][4] == LEADER then
|
if $data[3][4] == leader then
|
||||||
print ---- vgroup $data[3][0] leader locate on dnode $data[3][3]
|
print ---- vgroup $data[3][0] leader locate on dnode $data[3][3]
|
||||||
elif $data[3][6] == LEADER then
|
elif $data[3][6] == leader then
|
||||||
print ---- vgroup $data[3][0] leader locate on dnode $data[3][5]
|
print ---- vgroup $data[3][0] leader locate on dnode $data[3][5]
|
||||||
elif $data[3][8] == LEADER then
|
elif $data[3][8] == leader then
|
||||||
print ---- vgroup $data[3][0] leader locate on dnode $data[3][7]
|
print ---- vgroup $data[3][0] leader locate on dnode $data[3][7]
|
||||||
else
|
else
|
||||||
goto check_vg_ready1
|
goto check_vg_ready1
|
||||||
endi
|
endi
|
||||||
|
|
||||||
if $data[4][4] == LEADER then
|
if $data[4][4] == leader then
|
||||||
print ---- vgroup $data[4][0] leader locate on dnode $data[4][3]
|
print ---- vgroup $data[4][0] leader locate on dnode $data[4][3]
|
||||||
elif $data[4][6] == LEADER then
|
elif $data[4][6] == leader then
|
||||||
print ---- vgroup $data[4][0] leader locate on dnode $data[4][5]
|
print ---- vgroup $data[4][0] leader locate on dnode $data[4][5]
|
||||||
elif $data[4][8] == LEADER then
|
elif $data[4][8] == leader then
|
||||||
print ---- vgroup $data[4][0] leader locate on dnode $data[4][7]
|
print ---- vgroup $data[4][0] leader locate on dnode $data[4][7]
|
||||||
else
|
else
|
||||||
goto check_vg_ready1
|
goto check_vg_ready1
|
||||||
|
|
|
@ -104,7 +104,7 @@ print $data[0][0] $data[0][1] $data[0][2] $data[0][3] $data[0][4] $data[0][5] $d
|
||||||
if $rows != $vgroups then
|
if $rows != $vgroups then
|
||||||
return -1
|
return -1
|
||||||
endi
|
endi
|
||||||
if $data[0][4] == LEADER then
|
if $data[0][4] == leader then
|
||||||
if $data[0][6] != FLLOWER then
|
if $data[0][6] != FLLOWER then
|
||||||
goto check_vg_ready
|
goto check_vg_ready
|
||||||
endi
|
endi
|
||||||
|
@ -114,7 +114,7 @@ if $data[0][4] == LEADER then
|
||||||
print ---- vgroup $data[0][0] leader locate on dnode $data[0][3]
|
print ---- vgroup $data[0][0] leader locate on dnode $data[0][3]
|
||||||
goto vg_ready
|
goto vg_ready
|
||||||
endi
|
endi
|
||||||
if $data[0][6] == LEADER then
|
if $data[0][6] == leader then
|
||||||
if $data[0][4] != FLLOWER then
|
if $data[0][4] != FLLOWER then
|
||||||
goto check_vg_ready
|
goto check_vg_ready
|
||||||
endi
|
endi
|
||||||
|
@ -124,7 +124,7 @@ if $data[0][6] == LEADER then
|
||||||
print ---- vgroup $data[0][0] leader locate on dnode $data[0][5]
|
print ---- vgroup $data[0][0] leader locate on dnode $data[0][5]
|
||||||
goto vg_ready
|
goto vg_ready
|
||||||
endi
|
endi
|
||||||
if $data[0][8] == LEADER then
|
if $data[0][8] == leader then
|
||||||
if $data[0][4] != FLLOWER then
|
if $data[0][4] != FLLOWER then
|
||||||
goto check_vg_ready
|
goto check_vg_ready
|
||||||
endi
|
endi
|
||||||
|
@ -199,11 +199,11 @@ endi
|
||||||
print ====> finde vnode of leader, and stop the dnode where the vnode is located, and query stb/ntb count(*)
|
print ====> finde vnode of leader, and stop the dnode where the vnode is located, and query stb/ntb count(*)
|
||||||
sql show vgroups
|
sql show vgroups
|
||||||
print $data(2)[0] $data(2)[1] $data(2)[2] $data(2)[3] $data(2)[4] $data(2)[5] $data(2)[6] $data(2)[7] $data(2)[8] $data(2)[9] $data(2)[10] $data(2)[11] $data(2)[12] $data(2)[13]
|
print $data(2)[0] $data(2)[1] $data(2)[2] $data(2)[3] $data(2)[4] $data(2)[5] $data(2)[6] $data(2)[7] $data(2)[8] $data(2)[9] $data(2)[10] $data(2)[11] $data(2)[12] $data(2)[13]
|
||||||
if $data[0][4] == LEADER then
|
if $data[0][4] == leader then
|
||||||
$dnodeId = $data[0][3]
|
$dnodeId = $data[0][3]
|
||||||
elif $data[0][6] == LEADER then
|
elif $data[0][6] == leader then
|
||||||
$dnodeId = $data[0][5]
|
$dnodeId = $data[0][5]
|
||||||
elif $data[0][8] == LEADER then
|
elif $data[0][8] == leader then
|
||||||
$dnodeId = $data[0][7]
|
$dnodeId = $data[0][7]
|
||||||
else
|
else
|
||||||
print ====> no leader vnode!!!
|
print ====> no leader vnode!!!
|
||||||
|
@ -216,11 +216,11 @@ system sh/exec.sh -n $dnodeId -s stop -x SIGINT
|
||||||
|
|
||||||
sql show vgroups
|
sql show vgroups
|
||||||
print $data(2)[0] $data(2)[1] $data(2)[2] $data(2)[3] $data(2)[4] $data(2)[5] $data(2)[6] $data(2)[7] $data(2)[8] $data(2)[9] $data(2)[10] $data(2)[11] $data(2)[12] $data(2)[13]
|
print $data(2)[0] $data(2)[1] $data(2)[2] $data(2)[3] $data(2)[4] $data(2)[5] $data(2)[6] $data(2)[7] $data(2)[8] $data(2)[9] $data(2)[10] $data(2)[11] $data(2)[12] $data(2)[13]
|
||||||
if $data[0][4] == LEADER then
|
if $data[0][4] == leader then
|
||||||
print ---- vgroup $data[0][0] leader switch to dnode $data[0][3]
|
print ---- vgroup $data[0][0] leader switch to dnode $data[0][3]
|
||||||
elif $data[0][6] == LEADER then
|
elif $data[0][6] == leader then
|
||||||
print ---- vgroup $data[0][0] leader switch to dnode $data[0][5]
|
print ---- vgroup $data[0][0] leader switch to dnode $data[0][5]
|
||||||
elif $data[0][8] == LEADER then
|
elif $data[0][8] == leader then
|
||||||
print ---- vgroup $data[0][0] leader switch to dnode $data[0][7]
|
print ---- vgroup $data[0][0] leader switch to dnode $data[0][7]
|
||||||
else
|
else
|
||||||
print ====> no leader vnode!!!
|
print ====> no leader vnode!!!
|
||||||
|
@ -264,7 +264,7 @@ print $data[0][0] $data[0][1] $data[0][2] $data[0][3] $data[0][4] $data[0][5] $d
|
||||||
if $rows != $vgroups then
|
if $rows != $vgroups then
|
||||||
return -1
|
return -1
|
||||||
endi
|
endi
|
||||||
if $data[0][4] == LEADER then
|
if $data[0][4] == leader then
|
||||||
if $data[0][6] != FLLOWER then
|
if $data[0][6] != FLLOWER then
|
||||||
goto check_vg_ready_1
|
goto check_vg_ready_1
|
||||||
endi
|
endi
|
||||||
|
@ -273,7 +273,7 @@ if $data[0][4] == LEADER then
|
||||||
endi
|
endi
|
||||||
goto vg_ready_1
|
goto vg_ready_1
|
||||||
endi
|
endi
|
||||||
if $data[0][6] == LEADER then
|
if $data[0][6] == leader then
|
||||||
if $data[0][4] != FLLOWER then
|
if $data[0][4] != FLLOWER then
|
||||||
goto check_vg_ready_1
|
goto check_vg_ready_1
|
||||||
endi
|
endi
|
||||||
|
@ -282,7 +282,7 @@ if $data[0][6] == LEADER then
|
||||||
endi
|
endi
|
||||||
goto vg_ready_1
|
goto vg_ready_1
|
||||||
endi
|
endi
|
||||||
if $data[0][8] == LEADER then
|
if $data[0][8] == leader then
|
||||||
if $data[0][4] != FLLOWER then
|
if $data[0][4] != FLLOWER then
|
||||||
goto check_vg_ready_1
|
goto check_vg_ready_1
|
||||||
endi
|
endi
|
||||||
|
@ -325,27 +325,27 @@ system sh/exec.sh -n $dnodeId -s stop -x SIGINT
|
||||||
check_vg_ready_3:
|
check_vg_ready_3:
|
||||||
sql show vgroups
|
sql show vgroups
|
||||||
print $data(2)[0] $data(2)[1] $data(2)[2] $data(2)[3] $data(2)[4] $data(2)[5] $data(2)[6] $data(2)[7] $data(2)[8] $data(2)[9] $data(2)[10] $data(2)[11] $data(2)[12] $data(2)[13]
|
print $data(2)[0] $data(2)[1] $data(2)[2] $data(2)[3] $data(2)[4] $data(2)[5] $data(2)[6] $data(2)[7] $data(2)[8] $data(2)[9] $data(2)[10] $data(2)[11] $data(2)[12] $data(2)[13]
|
||||||
if $data[0][4] == LEADER then
|
if $data[0][4] == leader then
|
||||||
if $data[0][6] == LEADER then
|
if $data[0][6] == leader then
|
||||||
goto check_vg_ready_3
|
goto check_vg_ready_3
|
||||||
endi
|
endi
|
||||||
if $data[0][8] == LEADER then
|
if $data[0][8] == leader then
|
||||||
goto check_vg_ready_3
|
goto check_vg_ready_3
|
||||||
endi
|
endi
|
||||||
print ---- vgroup $data[0][0] leader locating dnode $data[0][5]
|
print ---- vgroup $data[0][0] leader locating dnode $data[0][5]
|
||||||
elif $data[0][6] == LEADER then
|
elif $data[0][6] == leader then
|
||||||
if $data[0][4] == LEADER then
|
if $data[0][4] == leader then
|
||||||
goto check_vg_ready_3
|
goto check_vg_ready_3
|
||||||
endi
|
endi
|
||||||
if $data[0][8] == LEADER then
|
if $data[0][8] == leader then
|
||||||
goto check_vg_ready_3
|
goto check_vg_ready_3
|
||||||
endi
|
endi
|
||||||
print ---- vgroup $data[0][0] leader locating dnode $data[0][7]
|
print ---- vgroup $data[0][0] leader locating dnode $data[0][7]
|
||||||
elif $data[0][8] == LEADER then
|
elif $data[0][8] == leader then
|
||||||
if $data[0][4] == LEADER then
|
if $data[0][4] == leader then
|
||||||
goto check_vg_ready_3
|
goto check_vg_ready_3
|
||||||
endi
|
endi
|
||||||
if $data[0][6] == LEADER then
|
if $data[0][6] == leader then
|
||||||
goto check_vg_ready_3
|
goto check_vg_ready_3
|
||||||
endi
|
endi
|
||||||
print ---- vgroup $data[0][0] leader locating dnode $data[0][9]
|
print ---- vgroup $data[0][0] leader locating dnode $data[0][9]
|
||||||
|
|
|
@ -103,29 +103,29 @@ print $data[0][0] $data[0][1] $data[0][2] $data[0][3] $data[0][4] $data[0][5] $d
|
||||||
if $rows != $vgroups then
|
if $rows != $vgroups then
|
||||||
return -1
|
return -1
|
||||||
endi
|
endi
|
||||||
if $data[0][4] == LEADER then
|
if $data[0][4] == leader then
|
||||||
if $data[0][6] != FOLLOWER then
|
if $data[0][6] != follower then
|
||||||
goto check_vg_ready
|
goto check_vg_ready
|
||||||
endi
|
endi
|
||||||
if $data[0][8] != FOLLOWER then
|
if $data[0][8] != follower then
|
||||||
goto check_vg_ready
|
goto check_vg_ready
|
||||||
endi
|
endi
|
||||||
print ---- vgroup $data[0][0] leader locate on dnode $data[0][3]
|
print ---- vgroup $data[0][0] leader locate on dnode $data[0][3]
|
||||||
goto vg_ready
|
goto vg_ready
|
||||||
elif $data[0][6] == LEADER then
|
elif $data[0][6] == leader then
|
||||||
if $data[0][4] != FOLLOWER then
|
if $data[0][4] != follower then
|
||||||
goto check_vg_ready
|
goto check_vg_ready
|
||||||
endi
|
endi
|
||||||
if $data[0][8] != FOLLOWER then
|
if $data[0][8] != follower then
|
||||||
goto check_vg_ready
|
goto check_vg_ready
|
||||||
endi
|
endi
|
||||||
print ---- vgroup $data[0][0] leader locate on dnode $data[0][5]
|
print ---- vgroup $data[0][0] leader locate on dnode $data[0][5]
|
||||||
goto vg_ready
|
goto vg_ready
|
||||||
elif $data[0][8] == LEADER then
|
elif $data[0][8] == leader then
|
||||||
if $data[0][4] != FOLLOWER then
|
if $data[0][4] != follower then
|
||||||
goto check_vg_ready
|
goto check_vg_ready
|
||||||
endi
|
endi
|
||||||
if $data[0][6] != FOLLOWER then
|
if $data[0][6] != follower then
|
||||||
goto check_vg_ready
|
goto check_vg_ready
|
||||||
endi
|
endi
|
||||||
print ---- vgroup $data[0][0] leader locate on dnode $data[0][7]
|
print ---- vgroup $data[0][0] leader locate on dnode $data[0][7]
|
||||||
|
@ -193,11 +193,11 @@ switch_leader_loop:
|
||||||
print ====> finde vnode of leader, and stop the dnode where the vnode is located, and query stb/ntb count(*)
|
print ====> finde vnode of leader, and stop the dnode where the vnode is located, and query stb/ntb count(*)
|
||||||
sql show vgroups
|
sql show vgroups
|
||||||
print $data(2)[0] $data(2)[1] $data(2)[2] $data(2)[3] $data(2)[4] $data(2)[5] $data(2)[6] $data(2)[7] $data(2)[8] $data(2)[9] $data(2)[10] $data(2)[11] $data(2)[12] $data(2)[13]
|
print $data(2)[0] $data(2)[1] $data(2)[2] $data(2)[3] $data(2)[4] $data(2)[5] $data(2)[6] $data(2)[7] $data(2)[8] $data(2)[9] $data(2)[10] $data(2)[11] $data(2)[12] $data(2)[13]
|
||||||
if $data[0][4] == LEADER then
|
if $data[0][4] == leader then
|
||||||
$dnodeId = $data[0][3]
|
$dnodeId = $data[0][3]
|
||||||
elif $data[0][6] == LEADER then
|
elif $data[0][6] == leader then
|
||||||
$dnodeId = $data[0][5]
|
$dnodeId = $data[0][5]
|
||||||
elif $data[0][8] == LEADER then
|
elif $data[0][8] == leader then
|
||||||
$dnodeId = $data[0][7]
|
$dnodeId = $data[0][7]
|
||||||
else
|
else
|
||||||
print ====> no leader vnode!!!
|
print ====> no leader vnode!!!
|
||||||
|
@ -226,29 +226,29 @@ print $data[0][0] $data[0][1] $data[0][2] $data[0][3] $data[0][4] $data[0][5] $d
|
||||||
if $rows != $vgroups then
|
if $rows != $vgroups then
|
||||||
return -1
|
return -1
|
||||||
endi
|
endi
|
||||||
if $data[0][4] == LEADER then
|
if $data[0][4] == leader then
|
||||||
if $data[0][6] != FOLLOWER then
|
if $data[0][6] != follower then
|
||||||
goto check_vg_ready_2
|
goto check_vg_ready_2
|
||||||
endi
|
endi
|
||||||
if $data[0][8] != FOLLOWER then
|
if $data[0][8] != follower then
|
||||||
goto check_vg_ready_2
|
goto check_vg_ready_2
|
||||||
endi
|
endi
|
||||||
print ---- vgroup $dnodeId leader switch to dnode $data[0][3]
|
print ---- vgroup $dnodeId leader switch to dnode $data[0][3]
|
||||||
goto vg_ready_2
|
goto vg_ready_2
|
||||||
elif $data[0][6] == LEADER then
|
elif $data[0][6] == leader then
|
||||||
if $data[0][4] != FOLLOWER then
|
if $data[0][4] != follower then
|
||||||
goto check_vg_ready_2
|
goto check_vg_ready_2
|
||||||
endi
|
endi
|
||||||
if $data[0][8] != FOLLOWER then
|
if $data[0][8] != follower then
|
||||||
goto check_vg_ready_2
|
goto check_vg_ready_2
|
||||||
endi
|
endi
|
||||||
print ---- vgroup $dnodeId leader switch to dnode $data[0][5]
|
print ---- vgroup $dnodeId leader switch to dnode $data[0][5]
|
||||||
goto vg_ready_2
|
goto vg_ready_2
|
||||||
elif $data[0][8] == LEADER then
|
elif $data[0][8] == leader then
|
||||||
if $data[0][4] != FOLLOWER then
|
if $data[0][4] != follower then
|
||||||
goto check_vg_ready_2
|
goto check_vg_ready_2
|
||||||
endi
|
endi
|
||||||
if $data[0][6] != FOLLOWER then
|
if $data[0][6] != follower then
|
||||||
goto check_vg_ready_2
|
goto check_vg_ready_2
|
||||||
endi
|
endi
|
||||||
print ---- vgroup $dnodeId leader switch to dnode $data[0][7]
|
print ---- vgroup $dnodeId leader switch to dnode $data[0][7]
|
||||||
|
@ -329,29 +329,29 @@ print $data[0][0] $data[0][1] $data[0][2] $data[0][3] $data[0][4] $data[0][5] $d
|
||||||
if $rows != $vgroups then
|
if $rows != $vgroups then
|
||||||
return -1
|
return -1
|
||||||
endi
|
endi
|
||||||
if $data[0][4] == LEADER then
|
if $data[0][4] == leader then
|
||||||
if $data[0][6] != FOLLOWER then
|
if $data[0][6] != follower then
|
||||||
goto check_vg_ready_1
|
goto check_vg_ready_1
|
||||||
endi
|
endi
|
||||||
if $data[0][8] != FOLLOWER then
|
if $data[0][8] != follower then
|
||||||
goto check_vg_ready_1
|
goto check_vg_ready_1
|
||||||
endi
|
endi
|
||||||
goto vg_ready_1
|
goto vg_ready_1
|
||||||
endi
|
endi
|
||||||
if $data[0][6] == LEADER then
|
if $data[0][6] == leader then
|
||||||
if $data[0][4] != FOLLOWER then
|
if $data[0][4] != follower then
|
||||||
goto check_vg_ready_1
|
goto check_vg_ready_1
|
||||||
endi
|
endi
|
||||||
if $data[0][8] != FOLLOWER then
|
if $data[0][8] != follower then
|
||||||
goto check_vg_ready_1
|
goto check_vg_ready_1
|
||||||
endi
|
endi
|
||||||
goto vg_ready_1
|
goto vg_ready_1
|
||||||
endi
|
endi
|
||||||
if $data[0][8] == LEADER then
|
if $data[0][8] == leader then
|
||||||
if $data[0][4] != FOLLOWER then
|
if $data[0][4] != follower then
|
||||||
goto check_vg_ready_1
|
goto check_vg_ready_1
|
||||||
endi
|
endi
|
||||||
if $data[0][6] != FOLLOWER then
|
if $data[0][6] != follower then
|
||||||
goto check_vg_ready_1
|
goto check_vg_ready_1
|
||||||
endi
|
endi
|
||||||
goto vg_ready_1
|
goto vg_ready_1
|
||||||
|
@ -390,27 +390,27 @@ system sh/exec.sh -n $dnodeId -s stop -x SIGINT
|
||||||
check_vg_ready_3:
|
check_vg_ready_3:
|
||||||
sql show vgroups
|
sql show vgroups
|
||||||
print $data(2)[0] $data(2)[1] $data(2)[2] $data(2)[3] $data(2)[4] $data(2)[5] $data(2)[6] $data(2)[7] $data(2)[8] $data(2)[9] $data(2)[10] $data(2)[11] $data(2)[12] $data(2)[13]
|
print $data(2)[0] $data(2)[1] $data(2)[2] $data(2)[3] $data(2)[4] $data(2)[5] $data(2)[6] $data(2)[7] $data(2)[8] $data(2)[9] $data(2)[10] $data(2)[11] $data(2)[12] $data(2)[13]
|
||||||
if $data[0][4] == LEADER then
|
if $data[0][4] == leader then
|
||||||
if $data[0][6] == LEADER then
|
if $data[0][6] == leader then
|
||||||
goto check_vg_ready_3
|
goto check_vg_ready_3
|
||||||
endi
|
endi
|
||||||
if $data[0][8] == LEADER then
|
if $data[0][8] == leader then
|
||||||
goto check_vg_ready_3
|
goto check_vg_ready_3
|
||||||
endi
|
endi
|
||||||
print ---- vgroup $data[0][0] leader locating dnode $data[0][5]
|
print ---- vgroup $data[0][0] leader locating dnode $data[0][5]
|
||||||
elif $data[0][6] == LEADER then
|
elif $data[0][6] == leader then
|
||||||
if $data[0][4] == LEADER then
|
if $data[0][4] == leader then
|
||||||
goto check_vg_ready_3
|
goto check_vg_ready_3
|
||||||
endi
|
endi
|
||||||
if $data[0][8] == LEADER then
|
if $data[0][8] == leader then
|
||||||
goto check_vg_ready_3
|
goto check_vg_ready_3
|
||||||
endi
|
endi
|
||||||
print ---- vgroup $data[0][0] leader locating dnode $data[0][7]
|
print ---- vgroup $data[0][0] leader locating dnode $data[0][7]
|
||||||
elif $data[0][8] == LEADER then
|
elif $data[0][8] == leader then
|
||||||
if $data[0][4] == LEADER then
|
if $data[0][4] == leader then
|
||||||
goto check_vg_ready_3
|
goto check_vg_ready_3
|
||||||
endi
|
endi
|
||||||
if $data[0][6] == LEADER then
|
if $data[0][6] == leader then
|
||||||
goto check_vg_ready_3
|
goto check_vg_ready_3
|
||||||
endi
|
endi
|
||||||
print ---- vgroup $data[0][0] leader locating dnode $data[0][9]
|
print ---- vgroup $data[0][0] leader locating dnode $data[0][9]
|
||||||
|
|
|
@ -26,7 +26,7 @@ if $data00 != 1 then
|
||||||
return -1
|
return -1
|
||||||
endi
|
endi
|
||||||
|
|
||||||
if $data02 != LEADER then
|
if $data02 != leader then
|
||||||
return -1
|
return -1
|
||||||
endi
|
endi
|
||||||
|
|
||||||
|
|
|
@ -75,7 +75,7 @@ def telemetryInfoCheck(infoDict=''):
|
||||||
if k not in infoDict["cluster_info"]["dnodes"][0] or v != infoDict["cluster_info"]["dnodes"][0][k] :
|
if k not in infoDict["cluster_info"]["dnodes"][0] or v != infoDict["cluster_info"]["dnodes"][0][k] :
|
||||||
tdLog.exit("dnodes info is null!")
|
tdLog.exit("dnodes info is null!")
|
||||||
|
|
||||||
mnodes_info = { "mnode_id":1, "mnode_ep":f"{hostname}:{serverPort}","role": "LEADER" }
|
mnodes_info = { "mnode_id":1, "mnode_ep":f"{hostname}:{serverPort}","role": "leader" }
|
||||||
|
|
||||||
for k ,v in mnodes_info.items():
|
for k ,v in mnodes_info.items():
|
||||||
if k not in infoDict["cluster_info"]["mnodes"][0] or v != infoDict["cluster_info"]["mnodes"][0][k] :
|
if k not in infoDict["cluster_info"]["mnodes"][0] or v != infoDict["cluster_info"]["mnodes"][0][k] :
|
||||||
|
|
Loading…
Reference in New Issue