提交 94230001 编写于 作者: S Shengliang Guan

Merge remote-tracking branch 'origin/3.0' into fix/valgrind

...@@ -71,8 +71,8 @@ ELSE () ...@@ -71,8 +71,8 @@ ELSE ()
ENDIF () ENDIF ()
IF (${SANITIZER} MATCHES "true") IF (${SANITIZER} MATCHES "true")
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Werror -Werror=return-type -fPIC -gdwarf-2 -fsanitize=address -fsanitize=undefined -fno-sanitize-recover=all -fsanitize=float-divide-by-zero -fsanitize=float-cast-overflow -fno-sanitize=null -fno-sanitize=alignment -static-libasan -g3") SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Werror -Werror=return-type -fPIC -gdwarf-2 -fsanitize=address -fsanitize=undefined -fsanitize-recover=all -fsanitize=float-divide-by-zero -fsanitize=float-cast-overflow -fno-sanitize=null -fno-sanitize=alignment -static-libasan -g3")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror -Wno-literal-suffix -Werror=return-type -fPIC -gdwarf-2 -fsanitize=address -fsanitize=undefined -fno-sanitize-recover=all -fsanitize=float-divide-by-zero -fsanitize=float-cast-overflow -fno-sanitize=null -fno-sanitize=alignment -static-libasan -g3") SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror -Wno-literal-suffix -Werror=return-type -fPIC -gdwarf-2 -fsanitize=address -fsanitize=undefined -fsanitize-recover=all -fsanitize=float-divide-by-zero -fsanitize=float-cast-overflow -fno-sanitize=null -fno-sanitize=alignment -static-libasan -g3")
MESSAGE(STATUS "Will compile with Address Sanitizer!") MESSAGE(STATUS "Will compile with Address Sanitizer!")
ELSE () ELSE ()
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Werror -Werror=return-type -fPIC -gdwarf-2 -g3") SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Werror -Werror=return-type -fPIC -gdwarf-2 -g3")
......
...@@ -2524,7 +2524,7 @@ static FORCE_INLINE void* tDecodeSMqDataBlkRsp(const void* buf, SMqDataBlkRsp* p ...@@ -2524,7 +2524,7 @@ static FORCE_INLINE void* tDecodeSMqDataBlkRsp(const void* buf, SMqDataBlkRsp* p
buf = taosDecodeFixedI32(buf, &pRsp->skipLogNum); buf = taosDecodeFixedI32(buf, &pRsp->skipLogNum);
buf = taosDecodeFixedI32(buf, &pRsp->blockNum); buf = taosDecodeFixedI32(buf, &pRsp->blockNum);
pRsp->blockData = taosArrayInit(pRsp->blockNum, sizeof(void*)); pRsp->blockData = taosArrayInit(pRsp->blockNum, sizeof(void*));
pRsp->blockDataLen = taosArrayInit(pRsp->blockNum, sizeof(void*)); pRsp->blockDataLen = taosArrayInit(pRsp->blockNum, sizeof(int32_t));
pRsp->blockTbName = taosArrayInit(pRsp->blockNum, sizeof(void*)); pRsp->blockTbName = taosArrayInit(pRsp->blockNum, sizeof(void*));
pRsp->blockSchema = taosArrayInit(pRsp->blockNum, sizeof(void*)); pRsp->blockSchema = taosArrayInit(pRsp->blockNum, sizeof(void*));
if (pRsp->blockNum != 0) { if (pRsp->blockNum != 0) {
......
...@@ -231,19 +231,19 @@ extern int32_t (*queryProcessMsgRsp[TDMT_MAX])(void* output, char* msg, int32_t ...@@ -231,19 +231,19 @@ extern int32_t (*queryProcessMsgRsp[TDMT_MAX])(void* output, char* msg, int32_t
#define qDebug(...) \ #define qDebug(...) \
do { \ do { \
if (qDebugFlag & DEBUG_DEBUG) { \ if (qDebugFlag & DEBUG_DEBUG) { \
taosPrintLog("QRY ", DEBUG_DEBUG, qDebugFlag, __VA_ARGS__); \ taosPrintLog("QRY ", DEBUG_DEBUG, tsLogEmbedded ? 255 : qDebugFlag, __VA_ARGS__); \
} \ } \
} while (0) } while (0)
#define qTrace(...) \ #define qTrace(...) \
do { \ do { \
if (qDebugFlag & DEBUG_TRACE) { \ if (qDebugFlag & DEBUG_TRACE) { \
taosPrintLog("QRY ", DEBUG_TRACE, qDebugFlag, __VA_ARGS__); \ taosPrintLog("QRY ", DEBUG_TRACE, tsLogEmbedded ? 255 : qDebugFlag, __VA_ARGS__); \
} \ } \
} while (0) } while (0)
#define qDebugL(...) \ #define qDebugL(...) \
do { \ do { \
if (qDebugFlag & DEBUG_DEBUG) { \ if (qDebugFlag & DEBUG_DEBUG) { \
taosPrintLongString("QRY ", DEBUG_DEBUG, qDebugFlag, __VA_ARGS__); \ taosPrintLongString("QRY ", DEBUG_DEBUG, tsLogEmbedded ? 255 : qDebugFlag, __VA_ARGS__); \
} \ } \
} while (0) } while (0)
......
...@@ -13,11 +13,11 @@ ...@@ -13,11 +13,11 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include "trpc.h"
#include "query.h"
#include "tname.h"
#include "catalogInt.h" #include "catalogInt.h"
#include "query.h"
#include "systable.h" #include "systable.h"
#include "tname.h"
#include "trpc.h"
int32_t ctgActUpdateVg(SCtgMetaAction *action); int32_t ctgActUpdateVg(SCtgMetaAction *action);
int32_t ctgActUpdateTbl(SCtgMetaAction *action); int32_t ctgActUpdateTbl(SCtgMetaAction *action);
...@@ -28,37 +28,10 @@ int32_t ctgActUpdateUser(SCtgMetaAction *action); ...@@ -28,37 +28,10 @@ int32_t ctgActUpdateUser(SCtgMetaAction *action);
extern SCtgDebug gCTGDebug; extern SCtgDebug gCTGDebug;
SCatalogMgmt gCtgMgmt = {0}; SCatalogMgmt gCtgMgmt = {0};
SCtgAction gCtgAction[CTG_ACT_MAX] = {{ SCtgAction gCtgAction[CTG_ACT_MAX] = {
CTG_ACT_UPDATE_VG, {CTG_ACT_UPDATE_VG, "update vgInfo", ctgActUpdateVg}, {CTG_ACT_UPDATE_TBL, "update tbMeta", ctgActUpdateTbl},
"update vgInfo", {CTG_ACT_REMOVE_DB, "remove DB", ctgActRemoveDB}, {CTG_ACT_REMOVE_STB, "remove stbMeta", ctgActRemoveStb},
ctgActUpdateVg {CTG_ACT_REMOVE_TBL, "remove tbMeta", ctgActRemoveTbl}, {CTG_ACT_UPDATE_USER, "update user", ctgActUpdateUser}};
},
{
CTG_ACT_UPDATE_TBL,
"update tbMeta",
ctgActUpdateTbl
},
{
CTG_ACT_REMOVE_DB,
"remove DB",
ctgActRemoveDB
},
{
CTG_ACT_REMOVE_STB,
"remove stbMeta",
ctgActRemoveStb
},
{
CTG_ACT_REMOVE_TBL,
"remove tbMeta",
ctgActRemoveTbl
},
{
CTG_ACT_UPDATE_USER,
"update user",
ctgActUpdateUser
}
};
void ctgFreeMetaRent(SCtgRentMgmt *mgmt) { void ctgFreeMetaRent(SCtgRentMgmt *mgmt) {
if (NULL == mgmt->slots) { if (NULL == mgmt->slots) {
...@@ -76,7 +49,6 @@ void ctgFreeMetaRent(SCtgRentMgmt *mgmt) { ...@@ -76,7 +49,6 @@ void ctgFreeMetaRent(SCtgRentMgmt *mgmt) {
taosMemoryFreeClear(mgmt->slots); taosMemoryFreeClear(mgmt->slots);
} }
void ctgFreeTableMetaCache(SCtgTbMetaCache *cache) { void ctgFreeTableMetaCache(SCtgTbMetaCache *cache) {
CTG_LOCK(CTG_WRITE, &cache->stbLock); CTG_LOCK(CTG_WRITE, &cache->stbLock);
if (cache->stbCache) { if (cache->stbCache) {
...@@ -116,7 +88,7 @@ void ctgFreeDbCache(SCtgDBCache *dbCache) { ...@@ -116,7 +88,7 @@ void ctgFreeDbCache(SCtgDBCache *dbCache) {
} }
CTG_LOCK(CTG_WRITE, &dbCache->vgLock); CTG_LOCK(CTG_WRITE, &dbCache->vgLock);
ctgFreeVgInfo (dbCache->vgInfo); ctgFreeVgInfo(dbCache->vgInfo);
CTG_UNLOCK(CTG_WRITE, &dbCache->vgLock); CTG_UNLOCK(CTG_WRITE, &dbCache->vgLock);
ctgFreeTableMetaCache(&dbCache->tbCache); ctgFreeTableMetaCache(&dbCache->tbCache);
...@@ -128,7 +100,7 @@ void ctgFreeSCtgUserAuth(SCtgUserAuth *userCache) { ...@@ -128,7 +100,7 @@ void ctgFreeSCtgUserAuth(SCtgUserAuth *userCache) {
taosHashCleanup(userCache->writeDbs); taosHashCleanup(userCache->writeDbs);
} }
void ctgFreeHandle(SCatalog* pCtg) { void ctgFreeHandle(SCatalog *pCtg) {
ctgFreeMetaRent(&pCtg->dbRent); ctgFreeMetaRent(&pCtg->dbRent);
ctgFreeMetaRent(&pCtg->stbRent); ctgFreeMetaRent(&pCtg->stbRent);
...@@ -171,13 +143,11 @@ void ctgFreeHandle(SCatalog* pCtg) { ...@@ -171,13 +143,11 @@ void ctgFreeHandle(SCatalog* pCtg) {
taosMemoryFree(pCtg); taosMemoryFree(pCtg);
} }
void ctgWaitAction(SCtgMetaAction *action) { void ctgWaitAction(SCtgMetaAction *action) {
while (true) { while (true) {
tsem_wait(&gCtgMgmt.queue.rspSem); tsem_wait(&gCtgMgmt.queue.rspSem);
if (atomic_load_8((int8_t*)&gCtgMgmt.exit)) { if (atomic_load_8((int8_t *)&gCtgMgmt.exit)) {
tsem_post(&gCtgMgmt.queue.rspSem); tsem_post(&gCtgMgmt.queue.rspSem);
break; break;
} }
...@@ -204,8 +174,7 @@ void ctgPopAction(SCtgMetaAction **action) { ...@@ -204,8 +174,7 @@ void ctgPopAction(SCtgMetaAction **action) {
*action = &node->action; *action = &node->action;
} }
int32_t ctgPushAction(SCatalog *pCtg, SCtgMetaAction *action) {
int32_t ctgPushAction(SCatalog* pCtg, SCtgMetaAction *action) {
SCtgQNode *node = taosMemoryCalloc(1, sizeof(SCtgQNode)); SCtgQNode *node = taosMemoryCalloc(1, sizeof(SCtgQNode));
if (NULL == node) { if (NULL == node) {
qError("calloc %d failed", (int32_t)sizeof(SCtgQNode)); qError("calloc %d failed", (int32_t)sizeof(SCtgQNode));
...@@ -235,10 +204,9 @@ int32_t ctgPushAction(SCatalog* pCtg, SCtgMetaAction *action) { ...@@ -235,10 +204,9 @@ int32_t ctgPushAction(SCatalog* pCtg, SCtgMetaAction *action) {
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
} }
int32_t ctgPushRmDBMsgInQueue(SCatalog *pCtg, const char *dbFName, int64_t dbId) {
int32_t ctgPushRmDBMsgInQueue(SCatalog* pCtg, const char *dbFName, int64_t dbId) {
int32_t code = 0; int32_t code = 0;
SCtgMetaAction action= {.act = CTG_ACT_REMOVE_DB}; SCtgMetaAction action = {.act = CTG_ACT_REMOVE_DB};
SCtgRemoveDBMsg *msg = taosMemoryMalloc(sizeof(SCtgRemoveDBMsg)); SCtgRemoveDBMsg *msg = taosMemoryMalloc(sizeof(SCtgRemoveDBMsg));
if (NULL == msg) { if (NULL == msg) {
ctgError("malloc %d failed", (int32_t)sizeof(SCtgRemoveDBMsg)); ctgError("malloc %d failed", (int32_t)sizeof(SCtgRemoveDBMsg));
...@@ -266,10 +234,10 @@ _return: ...@@ -266,10 +234,10 @@ _return:
CTG_RET(code); CTG_RET(code);
} }
int32_t ctgPushRmStbMsgInQueue(SCatalog *pCtg, const char *dbFName, int64_t dbId, const char *stbName, uint64_t suid,
int32_t ctgPushRmStbMsgInQueue(SCatalog* pCtg, const char *dbFName, int64_t dbId, const char *stbName, uint64_t suid, bool syncReq) { bool syncReq) {
int32_t code = 0; int32_t code = 0;
SCtgMetaAction action= {.act = CTG_ACT_REMOVE_STB, .syncReq = syncReq}; SCtgMetaAction action = {.act = CTG_ACT_REMOVE_STB, .syncReq = syncReq};
SCtgRemoveStbMsg *msg = taosMemoryMalloc(sizeof(SCtgRemoveStbMsg)); SCtgRemoveStbMsg *msg = taosMemoryMalloc(sizeof(SCtgRemoveStbMsg));
if (NULL == msg) { if (NULL == msg) {
ctgError("malloc %d failed", (int32_t)sizeof(SCtgRemoveStbMsg)); ctgError("malloc %d failed", (int32_t)sizeof(SCtgRemoveStbMsg));
...@@ -294,11 +262,9 @@ _return: ...@@ -294,11 +262,9 @@ _return:
CTG_RET(code); CTG_RET(code);
} }
int32_t ctgPushRmTblMsgInQueue(SCatalog *pCtg, const char *dbFName, int64_t dbId, const char *tbName, bool syncReq) {
int32_t ctgPushRmTblMsgInQueue(SCatalog* pCtg, const char *dbFName, int64_t dbId, const char *tbName, bool syncReq) {
int32_t code = 0; int32_t code = 0;
SCtgMetaAction action= {.act = CTG_ACT_REMOVE_TBL, .syncReq = syncReq}; SCtgMetaAction action = {.act = CTG_ACT_REMOVE_TBL, .syncReq = syncReq};
SCtgRemoveTblMsg *msg = taosMemoryMalloc(sizeof(SCtgRemoveTblMsg)); SCtgRemoveTblMsg *msg = taosMemoryMalloc(sizeof(SCtgRemoveTblMsg));
if (NULL == msg) { if (NULL == msg) {
ctgError("malloc %d failed", (int32_t)sizeof(SCtgRemoveTblMsg)); ctgError("malloc %d failed", (int32_t)sizeof(SCtgRemoveTblMsg));
...@@ -322,9 +288,9 @@ _return: ...@@ -322,9 +288,9 @@ _return:
CTG_RET(code); CTG_RET(code);
} }
int32_t ctgPushUpdateVgMsgInQueue(SCatalog* pCtg, const char *dbFName, int64_t dbId, SDBVgInfo* dbInfo, bool syncReq) { int32_t ctgPushUpdateVgMsgInQueue(SCatalog *pCtg, const char *dbFName, int64_t dbId, SDBVgInfo *dbInfo, bool syncReq) {
int32_t code = 0; int32_t code = 0;
SCtgMetaAction action= {.act = CTG_ACT_UPDATE_VG, .syncReq = syncReq}; SCtgMetaAction action = {.act = CTG_ACT_UPDATE_VG, .syncReq = syncReq};
SCtgUpdateVgMsg *msg = taosMemoryMalloc(sizeof(SCtgUpdateVgMsg)); SCtgUpdateVgMsg *msg = taosMemoryMalloc(sizeof(SCtgUpdateVgMsg));
if (NULL == msg) { if (NULL == msg) {
ctgError("malloc %d failed", (int32_t)sizeof(SCtgUpdateVgMsg)); ctgError("malloc %d failed", (int32_t)sizeof(SCtgUpdateVgMsg));
...@@ -355,9 +321,9 @@ _return: ...@@ -355,9 +321,9 @@ _return:
CTG_RET(code); CTG_RET(code);
} }
int32_t ctgPushUpdateTblMsgInQueue(SCatalog* pCtg, STableMetaOutput *output, bool syncReq) { int32_t ctgPushUpdateTblMsgInQueue(SCatalog *pCtg, STableMetaOutput *output, bool syncReq) {
int32_t code = 0; int32_t code = 0;
SCtgMetaAction action= {.act = CTG_ACT_UPDATE_TBL, .syncReq = syncReq}; SCtgMetaAction action = {.act = CTG_ACT_UPDATE_TBL, .syncReq = syncReq};
SCtgUpdateTblMsg *msg = taosMemoryMalloc(sizeof(SCtgUpdateTblMsg)); SCtgUpdateTblMsg *msg = taosMemoryMalloc(sizeof(SCtgUpdateTblMsg));
if (NULL == msg) { if (NULL == msg) {
ctgError("malloc %d failed", (int32_t)sizeof(SCtgUpdateTblMsg)); ctgError("malloc %d failed", (int32_t)sizeof(SCtgUpdateTblMsg));
...@@ -385,9 +351,9 @@ _return: ...@@ -385,9 +351,9 @@ _return:
CTG_RET(code); CTG_RET(code);
} }
int32_t ctgPushUpdateUserMsgInQueue(SCatalog* pCtg, SGetUserAuthRsp *pAuth, bool syncReq) { int32_t ctgPushUpdateUserMsgInQueue(SCatalog *pCtg, SGetUserAuthRsp *pAuth, bool syncReq) {
int32_t code = 0; int32_t code = 0;
SCtgMetaAction action= {.act = CTG_ACT_UPDATE_USER, .syncReq = syncReq}; SCtgMetaAction action = {.act = CTG_ACT_UPDATE_USER, .syncReq = syncReq};
SCtgUpdateUserMsg *msg = taosMemoryMalloc(sizeof(SCtgUpdateUserMsg)); SCtgUpdateUserMsg *msg = taosMemoryMalloc(sizeof(SCtgUpdateUserMsg));
if (NULL == msg) { if (NULL == msg) {
ctgError("malloc %d failed", (int32_t)sizeof(SCtgUpdateUserMsg)); ctgError("malloc %d failed", (int32_t)sizeof(SCtgUpdateUserMsg));
...@@ -417,18 +383,17 @@ int32_t ctgAcquireVgInfo(SCatalog *pCtg, SCtgDBCache *dbCache, bool *inCache) { ...@@ -417,18 +383,17 @@ int32_t ctgAcquireVgInfo(SCatalog *pCtg, SCtgDBCache *dbCache, bool *inCache) {
if (dbCache->deleted) { if (dbCache->deleted) {
CTG_UNLOCK(CTG_READ, &dbCache->vgLock); CTG_UNLOCK(CTG_READ, &dbCache->vgLock);
ctgDebug("db is dropping, dbId:%"PRIx64, dbCache->dbId); ctgDebug("db is dropping, dbId:%" PRIx64, dbCache->dbId);
*inCache = false; *inCache = false;
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
} }
if (NULL == dbCache->vgInfo) { if (NULL == dbCache->vgInfo) {
CTG_UNLOCK(CTG_READ, &dbCache->vgLock); CTG_UNLOCK(CTG_READ, &dbCache->vgLock);
*inCache = false; *inCache = false;
ctgDebug("db vgInfo is empty, dbId:%"PRIx64, dbCache->dbId); ctgDebug("db vgInfo is empty, dbId:%" PRIx64, dbCache->dbId);
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
} }
...@@ -441,7 +406,7 @@ int32_t ctgWAcquireVgInfo(SCatalog *pCtg, SCtgDBCache *dbCache) { ...@@ -441,7 +406,7 @@ int32_t ctgWAcquireVgInfo(SCatalog *pCtg, SCtgDBCache *dbCache) {
CTG_LOCK(CTG_WRITE, &dbCache->vgLock); CTG_LOCK(CTG_WRITE, &dbCache->vgLock);
if (dbCache->deleted) { if (dbCache->deleted) {
ctgDebug("db is dropping, dbId:%"PRIx64, dbCache->dbId); ctgDebug("db is dropping, dbId:%" PRIx64, dbCache->dbId);
CTG_UNLOCK(CTG_WRITE, &dbCache->vgLock); CTG_UNLOCK(CTG_WRITE, &dbCache->vgLock);
CTG_ERR_RET(TSDB_CODE_CTG_DB_DROPPED); CTG_ERR_RET(TSDB_CODE_CTG_DB_DROPPED);
} }
...@@ -449,20 +414,13 @@ int32_t ctgWAcquireVgInfo(SCatalog *pCtg, SCtgDBCache *dbCache) { ...@@ -449,20 +414,13 @@ int32_t ctgWAcquireVgInfo(SCatalog *pCtg, SCtgDBCache *dbCache) {
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
} }
void ctgReleaseDBCache(SCatalog *pCtg, SCtgDBCache *dbCache) { void ctgReleaseDBCache(SCatalog *pCtg, SCtgDBCache *dbCache) { taosHashRelease(pCtg->dbCache, dbCache); }
taosHashRelease(pCtg->dbCache, dbCache);
}
void ctgReleaseVgInfo(SCtgDBCache *dbCache) {
CTG_UNLOCK(CTG_READ, &dbCache->vgLock);
}
void ctgWReleaseVgInfo(SCtgDBCache *dbCache) { void ctgReleaseVgInfo(SCtgDBCache *dbCache) { CTG_UNLOCK(CTG_READ, &dbCache->vgLock); }
CTG_UNLOCK(CTG_WRITE, &dbCache->vgLock);
}
void ctgWReleaseVgInfo(SCtgDBCache *dbCache) { CTG_UNLOCK(CTG_WRITE, &dbCache->vgLock); }
int32_t ctgAcquireDBCacheImpl(SCatalog* pCtg, const char *dbFName, SCtgDBCache **pCache, bool acquire) { int32_t ctgAcquireDBCacheImpl(SCatalog *pCtg, const char *dbFName, SCtgDBCache **pCache, bool acquire) {
char *p = strchr(dbFName, '.'); char *p = strchr(dbFName, '.');
if (p && CTG_IS_SYS_DBNAME(p + 1)) { if (p && CTG_IS_SYS_DBNAME(p + 1)) {
dbFName = p + 1; dbFName = p + 1;
...@@ -496,16 +454,15 @@ int32_t ctgAcquireDBCacheImpl(SCatalog* pCtg, const char *dbFName, SCtgDBCache * ...@@ -496,16 +454,15 @@ int32_t ctgAcquireDBCacheImpl(SCatalog* pCtg, const char *dbFName, SCtgDBCache *
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
} }
int32_t ctgAcquireDBCache(SCatalog* pCtg, const char *dbFName, SCtgDBCache **pCache) { int32_t ctgAcquireDBCache(SCatalog *pCtg, const char *dbFName, SCtgDBCache **pCache) {
CTG_RET(ctgAcquireDBCacheImpl(pCtg, dbFName, pCache, true)); CTG_RET(ctgAcquireDBCacheImpl(pCtg, dbFName, pCache, true));
} }
int32_t ctgGetDBCache(SCatalog* pCtg, const char *dbFName, SCtgDBCache **pCache) { int32_t ctgGetDBCache(SCatalog *pCtg, const char *dbFName, SCtgDBCache **pCache) {
CTG_RET(ctgAcquireDBCacheImpl(pCtg, dbFName, pCache, false)); CTG_RET(ctgAcquireDBCacheImpl(pCtg, dbFName, pCache, false));
} }
int32_t ctgAcquireVgInfoFromCache(SCatalog *pCtg, const char *dbFName, SCtgDBCache **pCache, bool *inCache) {
int32_t ctgAcquireVgInfoFromCache(SCatalog* pCtg, const char *dbFName, SCtgDBCache **pCache, bool *inCache) {
SCtgDBCache *dbCache = NULL; SCtgDBCache *dbCache = NULL;
if (NULL == pCtg->dbCache) { if (NULL == pCtg->dbCache) {
...@@ -548,7 +505,7 @@ _return: ...@@ -548,7 +505,7 @@ _return:
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
} }
int32_t ctgGetQnodeListFromMnode(SCatalog* pCtg, void *pRpc, const SEpSet* pMgmtEps, SArray *out) { int32_t ctgGetQnodeListFromMnode(SCatalog *pCtg, void *pRpc, const SEpSet *pMgmtEps, SArray *out) {
char *msg = NULL; char *msg = NULL;
int32_t msgLen = 0; int32_t msgLen = 0;
...@@ -568,7 +525,7 @@ int32_t ctgGetQnodeListFromMnode(SCatalog* pCtg, void *pRpc, const SEpSet* pMgmt ...@@ -568,7 +525,7 @@ int32_t ctgGetQnodeListFromMnode(SCatalog* pCtg, void *pRpc, const SEpSet* pMgmt
SRpcMsg rpcRsp = {0}; SRpcMsg rpcRsp = {0};
rpcSendRecv(pRpc, (SEpSet*)pMgmtEps, &rpcMsg, &rpcRsp); rpcSendRecv(pRpc, (SEpSet *)pMgmtEps, &rpcMsg, &rpcRsp);
if (TSDB_CODE_SUCCESS != rpcRsp.code) { if (TSDB_CODE_SUCCESS != rpcRsp.code) {
ctgError("error rsp for qnode list, error:%s", tstrerror(rpcRsp.code)); ctgError("error rsp for qnode list, error:%s", tstrerror(rpcRsp.code));
CTG_ERR_RET(rpcRsp.code); CTG_ERR_RET(rpcRsp.code);
...@@ -585,8 +542,8 @@ int32_t ctgGetQnodeListFromMnode(SCatalog* pCtg, void *pRpc, const SEpSet* pMgmt ...@@ -585,8 +542,8 @@ int32_t ctgGetQnodeListFromMnode(SCatalog* pCtg, void *pRpc, const SEpSet* pMgmt
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
} }
int32_t ctgGetDBVgInfoFromMnode(SCatalog *pCtg, void *pRpc, const SEpSet *pMgmtEps, SBuildUseDBInput *input,
int32_t ctgGetDBVgInfoFromMnode(SCatalog* pCtg, void *pRpc, const SEpSet* pMgmtEps, SBuildUseDBInput *input, SUseDbOutput *out) { SUseDbOutput *out) {
char *msg = NULL; char *msg = NULL;
int32_t msgLen = 0; int32_t msgLen = 0;
...@@ -606,7 +563,7 @@ int32_t ctgGetDBVgInfoFromMnode(SCatalog* pCtg, void *pRpc, const SEpSet* pMgmtE ...@@ -606,7 +563,7 @@ int32_t ctgGetDBVgInfoFromMnode(SCatalog* pCtg, void *pRpc, const SEpSet* pMgmtE
SRpcMsg rpcRsp = {0}; SRpcMsg rpcRsp = {0};
rpcSendRecv(pRpc, (SEpSet*)pMgmtEps, &rpcMsg, &rpcRsp); rpcSendRecv(pRpc, (SEpSet *)pMgmtEps, &rpcMsg, &rpcRsp);
if (TSDB_CODE_SUCCESS != rpcRsp.code) { if (TSDB_CODE_SUCCESS != rpcRsp.code) {
ctgError("error rsp for use db, error:%s, db:%s", tstrerror(rpcRsp.code), input->db); ctgError("error rsp for use db, error:%s, db:%s", tstrerror(rpcRsp.code), input->db);
CTG_ERR_RET(rpcRsp.code); CTG_ERR_RET(rpcRsp.code);
...@@ -623,7 +580,7 @@ int32_t ctgGetDBVgInfoFromMnode(SCatalog* pCtg, void *pRpc, const SEpSet* pMgmtE ...@@ -623,7 +580,7 @@ int32_t ctgGetDBVgInfoFromMnode(SCatalog* pCtg, void *pRpc, const SEpSet* pMgmtE
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
} }
int32_t ctgGetDBCfgFromMnode(SCatalog* pCtg, void *pRpc, const SEpSet* pMgmtEps, const char *dbFName, SDbCfgInfo *out) { int32_t ctgGetDBCfgFromMnode(SCatalog *pCtg, void *pRpc, const SEpSet *pMgmtEps, const char *dbFName, SDbCfgInfo *out) {
char *msg = NULL; char *msg = NULL;
int32_t msgLen = 0; int32_t msgLen = 0;
...@@ -643,7 +600,7 @@ int32_t ctgGetDBCfgFromMnode(SCatalog* pCtg, void *pRpc, const SEpSet* pMgmtEps, ...@@ -643,7 +600,7 @@ int32_t ctgGetDBCfgFromMnode(SCatalog* pCtg, void *pRpc, const SEpSet* pMgmtEps,
SRpcMsg rpcRsp = {0}; SRpcMsg rpcRsp = {0};
rpcSendRecv(pRpc, (SEpSet*)pMgmtEps, &rpcMsg, &rpcRsp); rpcSendRecv(pRpc, (SEpSet *)pMgmtEps, &rpcMsg, &rpcRsp);
if (TSDB_CODE_SUCCESS != rpcRsp.code) { if (TSDB_CODE_SUCCESS != rpcRsp.code) {
ctgError("error rsp for get db cfg, error:%s, db:%s", tstrerror(rpcRsp.code), dbFName); ctgError("error rsp for get db cfg, error:%s, db:%s", tstrerror(rpcRsp.code), dbFName);
CTG_ERR_RET(rpcRsp.code); CTG_ERR_RET(rpcRsp.code);
...@@ -660,7 +617,8 @@ int32_t ctgGetDBCfgFromMnode(SCatalog* pCtg, void *pRpc, const SEpSet* pMgmtEps, ...@@ -660,7 +617,8 @@ int32_t ctgGetDBCfgFromMnode(SCatalog* pCtg, void *pRpc, const SEpSet* pMgmtEps,
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
} }
int32_t ctgGetIndexInfoFromMnode(SCatalog* pCtg, void *pRpc, const SEpSet* pMgmtEps, const char *indexName, SIndexInfo *out) { int32_t ctgGetIndexInfoFromMnode(SCatalog *pCtg, void *pRpc, const SEpSet *pMgmtEps, const char *indexName,
SIndexInfo *out) {
char *msg = NULL; char *msg = NULL;
int32_t msgLen = 0; int32_t msgLen = 0;
...@@ -680,7 +638,7 @@ int32_t ctgGetIndexInfoFromMnode(SCatalog* pCtg, void *pRpc, const SEpSet* pMgmt ...@@ -680,7 +638,7 @@ int32_t ctgGetIndexInfoFromMnode(SCatalog* pCtg, void *pRpc, const SEpSet* pMgmt
SRpcMsg rpcRsp = {0}; SRpcMsg rpcRsp = {0};
rpcSendRecv(pRpc, (SEpSet*)pMgmtEps, &rpcMsg, &rpcRsp); rpcSendRecv(pRpc, (SEpSet *)pMgmtEps, &rpcMsg, &rpcRsp);
if (TSDB_CODE_SUCCESS != rpcRsp.code) { if (TSDB_CODE_SUCCESS != rpcRsp.code) {
ctgError("error rsp for get index, error:%s, indexName:%s", tstrerror(rpcRsp.code), indexName); ctgError("error rsp for get index, error:%s, indexName:%s", tstrerror(rpcRsp.code), indexName);
CTG_ERR_RET(rpcRsp.code); CTG_ERR_RET(rpcRsp.code);
...@@ -697,7 +655,8 @@ int32_t ctgGetIndexInfoFromMnode(SCatalog* pCtg, void *pRpc, const SEpSet* pMgmt ...@@ -697,7 +655,8 @@ int32_t ctgGetIndexInfoFromMnode(SCatalog* pCtg, void *pRpc, const SEpSet* pMgmt
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
} }
int32_t ctgGetUdfInfoFromMnode(SCatalog* pCtg, void *pRpc, const SEpSet* pMgmtEps, const char *funcName, SFuncInfo **out) { int32_t ctgGetUdfInfoFromMnode(SCatalog *pCtg, void *pRpc, const SEpSet *pMgmtEps, const char *funcName,
SFuncInfo **out) {
char *msg = NULL; char *msg = NULL;
int32_t msgLen = 0; int32_t msgLen = 0;
...@@ -717,7 +676,7 @@ int32_t ctgGetUdfInfoFromMnode(SCatalog* pCtg, void *pRpc, const SEpSet* pMgmtEp ...@@ -717,7 +676,7 @@ int32_t ctgGetUdfInfoFromMnode(SCatalog* pCtg, void *pRpc, const SEpSet* pMgmtEp
SRpcMsg rpcRsp = {0}; SRpcMsg rpcRsp = {0};
rpcSendRecv(pRpc, (SEpSet*)pMgmtEps, &rpcMsg, &rpcRsp); rpcSendRecv(pRpc, (SEpSet *)pMgmtEps, &rpcMsg, &rpcRsp);
if (TSDB_CODE_SUCCESS != rpcRsp.code) { if (TSDB_CODE_SUCCESS != rpcRsp.code) {
if (TSDB_CODE_MND_FUNC_NOT_EXIST == rpcRsp.code) { if (TSDB_CODE_MND_FUNC_NOT_EXIST == rpcRsp.code) {
ctgDebug("funcName %s not exist in mnode", funcName); ctgDebug("funcName %s not exist in mnode", funcName);
...@@ -740,7 +699,8 @@ int32_t ctgGetUdfInfoFromMnode(SCatalog* pCtg, void *pRpc, const SEpSet* pMgmtEp ...@@ -740,7 +699,8 @@ int32_t ctgGetUdfInfoFromMnode(SCatalog* pCtg, void *pRpc, const SEpSet* pMgmtEp
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
} }
int32_t ctgGetUserDbAuthFromMnode(SCatalog* pCtg, void *pRpc, const SEpSet* pMgmtEps, const char *user, SGetUserAuthRsp *authRsp) { int32_t ctgGetUserDbAuthFromMnode(SCatalog *pCtg, void *pRpc, const SEpSet *pMgmtEps, const char *user,
SGetUserAuthRsp *authRsp) {
char *msg = NULL; char *msg = NULL;
int32_t msgLen = 0; int32_t msgLen = 0;
...@@ -760,7 +720,7 @@ int32_t ctgGetUserDbAuthFromMnode(SCatalog* pCtg, void *pRpc, const SEpSet* pMgm ...@@ -760,7 +720,7 @@ int32_t ctgGetUserDbAuthFromMnode(SCatalog* pCtg, void *pRpc, const SEpSet* pMgm
SRpcMsg rpcRsp = {0}; SRpcMsg rpcRsp = {0};
rpcSendRecv(pRpc, (SEpSet*)pMgmtEps, &rpcMsg, &rpcRsp); rpcSendRecv(pRpc, (SEpSet *)pMgmtEps, &rpcMsg, &rpcRsp);
if (TSDB_CODE_SUCCESS != rpcRsp.code) { if (TSDB_CODE_SUCCESS != rpcRsp.code) {
ctgError("error rsp for get user auth, error:%s, user:%s", tstrerror(rpcRsp.code), user); ctgError("error rsp for get user auth, error:%s, user:%s", tstrerror(rpcRsp.code), user);
CTG_ERR_RET(rpcRsp.code); CTG_ERR_RET(rpcRsp.code);
...@@ -777,8 +737,7 @@ int32_t ctgGetUserDbAuthFromMnode(SCatalog* pCtg, void *pRpc, const SEpSet* pMgm ...@@ -777,8 +737,7 @@ int32_t ctgGetUserDbAuthFromMnode(SCatalog* pCtg, void *pRpc, const SEpSet* pMgm
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
} }
int32_t ctgIsTableMetaExistInCache(SCatalog *pCtg, char *dbFName, char *tbName, int32_t *exist) {
int32_t ctgIsTableMetaExistInCache(SCatalog* pCtg, char *dbFName, char* tbName, int32_t *exist) {
if (NULL == pCtg->dbCache) { if (NULL == pCtg->dbCache) {
*exist = 0; *exist = 0;
ctgWarn("empty db cache, dbFName:%s, tbName:%s", dbFName, tbName); ctgWarn("empty db cache, dbFName:%s, tbName:%s", dbFName, tbName);
...@@ -814,8 +773,8 @@ int32_t ctgIsTableMetaExistInCache(SCatalog* pCtg, char *dbFName, char* tbName, ...@@ -814,8 +773,8 @@ int32_t ctgIsTableMetaExistInCache(SCatalog* pCtg, char *dbFName, char* tbName,
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
} }
int32_t ctgGetTableMetaFromCache(SCatalog *pCtg, const SName *pTableName, STableMeta **pTableMeta, bool *inCache,
int32_t ctgGetTableMetaFromCache(SCatalog* pCtg, const SName* pTableName, STableMeta** pTableMeta, bool *inCache, int32_t flag, uint64_t *dbId) { int32_t flag, uint64_t *dbId) {
if (NULL == pCtg->dbCache) { if (NULL == pCtg->dbCache) {
ctgDebug("empty tbmeta cache, tbName:%s", pTableName->tname); ctgDebug("empty tbmeta cache, tbName:%s", pTableName->tname);
goto _return; goto _return;
...@@ -839,7 +798,8 @@ int32_t ctgGetTableMetaFromCache(SCatalog* pCtg, const SName* pTableName, STable ...@@ -839,7 +798,8 @@ int32_t ctgGetTableMetaFromCache(SCatalog* pCtg, const SName* pTableName, STable
int32_t sz = 0; int32_t sz = 0;
CTG_LOCK(CTG_READ, &dbCache->tbCache.metaLock); CTG_LOCK(CTG_READ, &dbCache->tbCache.metaLock);
int32_t code = taosHashGetDup_m(dbCache->tbCache.metaCache, pTableName->tname, strlen(pTableName->tname), (void **)pTableMeta, &sz); int32_t code = taosHashGetDup_m(dbCache->tbCache.metaCache, pTableName->tname, strlen(pTableName->tname),
(void **)pTableMeta, &sz);
CTG_UNLOCK(CTG_READ, &dbCache->tbCache.metaLock); CTG_UNLOCK(CTG_READ, &dbCache->tbCache.metaLock);
if (NULL == *pTableMeta) { if (NULL == *pTableMeta) {
...@@ -852,7 +812,7 @@ int32_t ctgGetTableMetaFromCache(SCatalog* pCtg, const SName* pTableName, STable ...@@ -852,7 +812,7 @@ int32_t ctgGetTableMetaFromCache(SCatalog* pCtg, const SName* pTableName, STable
*dbId = dbCache->dbId; *dbId = dbCache->dbId;
} }
STableMeta* tbMeta = *pTableMeta; STableMeta *tbMeta = *pTableMeta;
if (tbMeta->tableType != TSDB_CHILD_TABLE) { if (tbMeta->tableType != TSDB_CHILD_TABLE) {
ctgReleaseDBCache(pCtg, dbCache); ctgReleaseDBCache(pCtg, dbCache);
...@@ -864,7 +824,8 @@ int32_t ctgGetTableMetaFromCache(SCatalog* pCtg, const SName* pTableName, STable ...@@ -864,7 +824,8 @@ int32_t ctgGetTableMetaFromCache(SCatalog* pCtg, const SName* pTableName, STable
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
} }
ctgDebug("Got subtable meta from cache, type:%d, dbFName:%s, tbName:%s, suid:%" PRIx64, tbMeta->tableType, dbFName, pTableName->tname, tbMeta->suid); ctgDebug("Got subtable meta from cache, type:%d, dbFName:%s, tbName:%s, suid:%" PRIx64, tbMeta->tableType, dbFName,
pTableName->tname, tbMeta->suid);
CTG_LOCK(CTG_READ, &dbCache->tbCache.stbLock); CTG_LOCK(CTG_READ, &dbCache->tbCache.stbLock);
...@@ -872,7 +833,7 @@ int32_t ctgGetTableMetaFromCache(SCatalog* pCtg, const SName* pTableName, STable ...@@ -872,7 +833,7 @@ int32_t ctgGetTableMetaFromCache(SCatalog* pCtg, const SName* pTableName, STable
if (NULL == stbMeta || NULL == *stbMeta) { if (NULL == stbMeta || NULL == *stbMeta) {
CTG_UNLOCK(CTG_READ, &dbCache->tbCache.stbLock); CTG_UNLOCK(CTG_READ, &dbCache->tbCache.stbLock);
ctgReleaseDBCache(pCtg, dbCache); ctgReleaseDBCache(pCtg, dbCache);
ctgError("stb not in stbCache, suid:%"PRIx64, tbMeta->suid); ctgError("stb not in stbCache, suid:%" PRIx64, tbMeta->suid);
taosMemoryFreeClear(*pTableMeta); taosMemoryFreeClear(*pTableMeta);
goto _return; goto _return;
} }
...@@ -881,7 +842,8 @@ int32_t ctgGetTableMetaFromCache(SCatalog* pCtg, const SName* pTableName, STable ...@@ -881,7 +842,8 @@ int32_t ctgGetTableMetaFromCache(SCatalog* pCtg, const SName* pTableName, STable
CTG_UNLOCK(CTG_READ, &dbCache->tbCache.stbLock); CTG_UNLOCK(CTG_READ, &dbCache->tbCache.stbLock);
ctgReleaseDBCache(pCtg, dbCache); ctgReleaseDBCache(pCtg, dbCache);
taosMemoryFreeClear(*pTableMeta); taosMemoryFreeClear(*pTableMeta);
ctgError("stable suid in stbCache mis-match, expected suid:%"PRIx64 ",actual suid:%"PRIx64, tbMeta->suid, (*stbMeta)->suid); ctgError("stable suid in stbCache mis-match, expected suid:%" PRIx64 ",actual suid:%" PRIx64, tbMeta->suid,
(*stbMeta)->suid);
CTG_ERR_RET(TSDB_CODE_CTG_INTERNAL_ERROR); CTG_ERR_RET(TSDB_CODE_CTG_INTERNAL_ERROR);
} }
...@@ -915,7 +877,7 @@ _return: ...@@ -915,7 +877,7 @@ _return:
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
} }
int32_t ctgGetTableTypeFromCache(SCatalog* pCtg, const char* dbFName, const char *tableName, int32_t *tbType) { int32_t ctgGetTableTypeFromCache(SCatalog *pCtg, const char *dbFName, const char *tableName, int32_t *tbType) {
if (NULL == pCtg->dbCache) { if (NULL == pCtg->dbCache) {
ctgWarn("empty db cache, dbFName:%s, tbName:%s", dbFName, tableName); ctgWarn("empty db cache, dbFName:%s, tbName:%s", dbFName, tableName);
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
...@@ -951,7 +913,8 @@ int32_t ctgGetTableTypeFromCache(SCatalog* pCtg, const char* dbFName, const char ...@@ -951,7 +913,8 @@ int32_t ctgGetTableTypeFromCache(SCatalog* pCtg, const char* dbFName, const char
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
} }
int32_t ctgChkAuthFromCache(SCatalog* pCtg, const char* user, const char* dbFName, AUTH_TYPE type, bool *inCache, bool *pass) { int32_t ctgChkAuthFromCache(SCatalog *pCtg, const char *user, const char *dbFName, AUTH_TYPE type, bool *inCache,
bool *pass) {
if (NULL == pCtg->userCache) { if (NULL == pCtg->userCache) {
ctgDebug("empty user auth cache, user:%s", user); ctgDebug("empty user auth cache, user:%s", user);
goto _return; goto _return;
...@@ -1000,7 +963,8 @@ _return: ...@@ -1000,7 +963,8 @@ _return:
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
} }
int32_t ctgGetTableMetaFromMnodeImpl(SCatalog* pCtg, void *pTrans, const SEpSet* pMgmtEps, char *dbFName, char* tbName, STableMetaOutput* output) { int32_t ctgGetTableMetaFromMnodeImpl(SCatalog *pCtg, void *pTrans, const SEpSet *pMgmtEps, char *dbFName, char *tbName,
STableMetaOutput *output) {
SBuildTableMetaInput bInput = {.vgId = 0, .dbFName = dbFName, .tbName = tbName}; SBuildTableMetaInput bInput = {.vgId = 0, .dbFName = dbFName, .tbName = tbName};
char *msg = NULL; char *msg = NULL;
SEpSet *pVnodeEpSet = NULL; SEpSet *pVnodeEpSet = NULL;
...@@ -1022,7 +986,7 @@ int32_t ctgGetTableMetaFromMnodeImpl(SCatalog* pCtg, void *pTrans, const SEpSet* ...@@ -1022,7 +986,7 @@ int32_t ctgGetTableMetaFromMnodeImpl(SCatalog* pCtg, void *pTrans, const SEpSet*
SRpcMsg rpcRsp = {0}; SRpcMsg rpcRsp = {0};
rpcSendRecv(pTrans, (SEpSet*)pMgmtEps, &rpcMsg, &rpcRsp); rpcSendRecv(pTrans, (SEpSet *)pMgmtEps, &rpcMsg, &rpcRsp);
if (TSDB_CODE_SUCCESS != rpcRsp.code) { if (TSDB_CODE_SUCCESS != rpcRsp.code) {
if (CTG_TABLE_NOT_EXIST(rpcRsp.code)) { if (CTG_TABLE_NOT_EXIST(rpcRsp.code)) {
...@@ -1031,7 +995,8 @@ int32_t ctgGetTableMetaFromMnodeImpl(SCatalog* pCtg, void *pTrans, const SEpSet* ...@@ -1031,7 +995,8 @@ int32_t ctgGetTableMetaFromMnodeImpl(SCatalog* pCtg, void *pTrans, const SEpSet*
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
} }
ctgError("error rsp for stablemeta from mnode, code:%s, dbFName:%s, tbName:%s", tstrerror(rpcRsp.code), dbFName, tbName); ctgError("error rsp for stablemeta from mnode, code:%s, dbFName:%s, tbName:%s", tstrerror(rpcRsp.code), dbFName,
tbName);
CTG_ERR_RET(rpcRsp.code); CTG_ERR_RET(rpcRsp.code);
} }
...@@ -1046,15 +1011,18 @@ int32_t ctgGetTableMetaFromMnodeImpl(SCatalog* pCtg, void *pTrans, const SEpSet* ...@@ -1046,15 +1011,18 @@ int32_t ctgGetTableMetaFromMnodeImpl(SCatalog* pCtg, void *pTrans, const SEpSet*
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
} }
int32_t ctgGetTableMetaFromMnode(SCatalog* pCtg, void *pTrans, const SEpSet* pMgmtEps, const SName* pTableName, STableMetaOutput* output) { int32_t ctgGetTableMetaFromMnode(SCatalog *pCtg, void *pTrans, const SEpSet *pMgmtEps, const SName *pTableName,
STableMetaOutput *output) {
char dbFName[TSDB_DB_FNAME_LEN]; char dbFName[TSDB_DB_FNAME_LEN];
tNameGetFullDbName(pTableName, dbFName); tNameGetFullDbName(pTableName, dbFName);
return ctgGetTableMetaFromMnodeImpl(pCtg, pTrans, pMgmtEps, dbFName, (char *)pTableName->tname, output); return ctgGetTableMetaFromMnodeImpl(pCtg, pTrans, pMgmtEps, dbFName, (char *)pTableName->tname, output);
} }
int32_t ctgGetTableMetaFromVnodeImpl(SCatalog* pCtg, void *pTrans, const SEpSet* pMgmtEps, const SName* pTableName, SVgroupInfo *vgroupInfo, STableMetaOutput* output) { int32_t ctgGetTableMetaFromVnodeImpl(SCatalog *pCtg, void *pTrans, const SEpSet *pMgmtEps, const SName *pTableName,
if (NULL == pCtg || NULL == pTrans || NULL == pMgmtEps || NULL == pTableName || NULL == vgroupInfo || NULL == output) { SVgroupInfo *vgroupInfo, STableMetaOutput *output) {
if (NULL == pCtg || NULL == pTrans || NULL == pMgmtEps || NULL == pTableName || NULL == vgroupInfo ||
NULL == output) {
CTG_ERR_RET(TSDB_CODE_CTG_INVALID_INPUT); CTG_ERR_RET(TSDB_CODE_CTG_INVALID_INPUT);
} }
...@@ -1063,13 +1031,15 @@ int32_t ctgGetTableMetaFromVnodeImpl(SCatalog* pCtg, void *pTrans, const SEpSet* ...@@ -1063,13 +1031,15 @@ int32_t ctgGetTableMetaFromVnodeImpl(SCatalog* pCtg, void *pTrans, const SEpSet*
ctgDebug("try to get table meta from vnode, dbFName:%s, tbName:%s", dbFName, tNameGetTableName(pTableName)); ctgDebug("try to get table meta from vnode, dbFName:%s, tbName:%s", dbFName, tNameGetTableName(pTableName));
SBuildTableMetaInput bInput = {.vgId = vgroupInfo->vgId, .dbFName = dbFName, .tbName = (char *)tNameGetTableName(pTableName)}; SBuildTableMetaInput bInput = {
.vgId = vgroupInfo->vgId, .dbFName = dbFName, .tbName = (char *)tNameGetTableName(pTableName)};
char *msg = NULL; char *msg = NULL;
int32_t msgLen = 0; int32_t msgLen = 0;
int32_t code = queryBuildMsg[TMSG_INDEX(TDMT_VND_TABLE_META)](&bInput, &msg, 0, &msgLen); int32_t code = queryBuildMsg[TMSG_INDEX(TDMT_VND_TABLE_META)](&bInput, &msg, 0, &msgLen);
if (code) { if (code) {
ctgError("Build vnode tablemeta msg failed, code:%x, dbFName:%s, tbName:%s", code, dbFName, tNameGetTableName(pTableName)); ctgError("Build vnode tablemeta msg failed, code:%x, dbFName:%s, tbName:%s", code, dbFName,
tNameGetTableName(pTableName));
CTG_ERR_RET(code); CTG_ERR_RET(code);
} }
...@@ -1089,13 +1059,15 @@ int32_t ctgGetTableMetaFromVnodeImpl(SCatalog* pCtg, void *pTrans, const SEpSet* ...@@ -1089,13 +1059,15 @@ int32_t ctgGetTableMetaFromVnodeImpl(SCatalog* pCtg, void *pTrans, const SEpSet*
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
} }
ctgError("error rsp for table meta from vnode, code:%s, dbFName:%s, tbName:%s", tstrerror(rpcRsp.code), dbFName, tNameGetTableName(pTableName)); ctgError("error rsp for table meta from vnode, code:%s, dbFName:%s, tbName:%s", tstrerror(rpcRsp.code), dbFName,
tNameGetTableName(pTableName));
CTG_ERR_RET(rpcRsp.code); CTG_ERR_RET(rpcRsp.code);
} }
code = queryProcessMsgRsp[TMSG_INDEX(TDMT_VND_TABLE_META)](output, rpcRsp.pCont, rpcRsp.contLen); code = queryProcessMsgRsp[TMSG_INDEX(TDMT_VND_TABLE_META)](output, rpcRsp.pCont, rpcRsp.contLen);
if (code) { if (code) {
ctgError("Process vnode tablemeta rsp failed, code:%s, dbFName:%s, tbName:%s", tstrerror(code), dbFName, tNameGetTableName(pTableName)); ctgError("Process vnode tablemeta rsp failed, code:%s, dbFName:%s, tbName:%s", tstrerror(code), dbFName,
tNameGetTableName(pTableName));
CTG_ERR_RET(code); CTG_ERR_RET(code);
} }
...@@ -1103,7 +1075,8 @@ int32_t ctgGetTableMetaFromVnodeImpl(SCatalog* pCtg, void *pTrans, const SEpSet* ...@@ -1103,7 +1075,8 @@ int32_t ctgGetTableMetaFromVnodeImpl(SCatalog* pCtg, void *pTrans, const SEpSet*
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
} }
int32_t ctgGetTableMetaFromVnode(SCatalog* pCtg, void *pTrans, const SEpSet* pMgmtEps, const SName* pTableName, SVgroupInfo *vgroupInfo, STableMetaOutput* output) { int32_t ctgGetTableMetaFromVnode(SCatalog *pCtg, void *pTrans, const SEpSet *pMgmtEps, const SName *pTableName,
SVgroupInfo *vgroupInfo, STableMetaOutput *output) {
int32_t code = 0; int32_t code = 0;
int32_t retryNum = 0; int32_t retryNum = 0;
...@@ -1140,7 +1113,7 @@ int32_t ctgGetHashFunction(int8_t hashMethod, tableNameHashFp *fp) { ...@@ -1140,7 +1113,7 @@ int32_t ctgGetHashFunction(int8_t hashMethod, tableNameHashFp *fp) {
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
} }
int32_t ctgGenerateVgList(SCatalog *pCtg, SHashObj *vgHash, SArray** pList) { int32_t ctgGenerateVgList(SCatalog *pCtg, SHashObj *vgHash, SArray **pList) {
SHashObj *vgroupHash = NULL; SHashObj *vgroupHash = NULL;
SVgroupInfo *vgInfo = NULL; SVgroupInfo *vgInfo = NULL;
SArray *vgList = NULL; SArray *vgList = NULL;
...@@ -1217,7 +1190,8 @@ int32_t ctgGetVgInfoFromHashValue(SCatalog *pCtg, SDBVgInfo *dbInfo, const SName ...@@ -1217,7 +1190,8 @@ int32_t ctgGetVgInfoFromHashValue(SCatalog *pCtg, SDBVgInfo *dbInfo, const SName
} }
if (NULL == vgInfo) { if (NULL == vgInfo) {
ctgError("no hash range found for hash value [%u], db:%s, numOfVgId:%d", hashValue, db, taosHashGetSize(dbInfo->vgHash)); ctgError("no hash range found for hash value [%u], db:%s, numOfVgId:%d", hashValue, db,
taosHashGetSize(dbInfo->vgHash));
CTG_ERR_RET(TSDB_CODE_CTG_INTERNAL_ERROR); CTG_ERR_RET(TSDB_CODE_CTG_INTERNAL_ERROR);
} }
...@@ -1226,47 +1200,46 @@ int32_t ctgGetVgInfoFromHashValue(SCatalog *pCtg, SDBVgInfo *dbInfo, const SName ...@@ -1226,47 +1200,46 @@ int32_t ctgGetVgInfoFromHashValue(SCatalog *pCtg, SDBVgInfo *dbInfo, const SName
CTG_RET(code); CTG_RET(code);
} }
int32_t ctgStbVersionSearchCompare(const void* key1, const void* key2) { int32_t ctgStbVersionSearchCompare(const void *key1, const void *key2) {
if (*(uint64_t *)key1 < ((SSTableMetaVersion*)key2)->suid) { if (*(uint64_t *)key1 < ((SSTableMetaVersion *)key2)->suid) {
return -1; return -1;
} else if (*(uint64_t *)key1 > ((SSTableMetaVersion*)key2)->suid) { } else if (*(uint64_t *)key1 > ((SSTableMetaVersion *)key2)->suid) {
return 1; return 1;
} else { } else {
return 0; return 0;
} }
} }
int32_t ctgDbVgVersionSearchCompare(const void* key1, const void* key2) { int32_t ctgDbVgVersionSearchCompare(const void *key1, const void *key2) {
if (*(int64_t *)key1 < ((SDbVgVersion*)key2)->dbId) { if (*(int64_t *)key1 < ((SDbVgVersion *)key2)->dbId) {
return -1; return -1;
} else if (*(int64_t *)key1 > ((SDbVgVersion*)key2)->dbId) { } else if (*(int64_t *)key1 > ((SDbVgVersion *)key2)->dbId) {
return 1; return 1;
} else { } else {
return 0; return 0;
} }
} }
int32_t ctgStbVersionSortCompare(const void* key1, const void* key2) { int32_t ctgStbVersionSortCompare(const void *key1, const void *key2) {
if (((SSTableMetaVersion*)key1)->suid < ((SSTableMetaVersion*)key2)->suid) { if (((SSTableMetaVersion *)key1)->suid < ((SSTableMetaVersion *)key2)->suid) {
return -1; return -1;
} else if (((SSTableMetaVersion*)key1)->suid > ((SSTableMetaVersion*)key2)->suid) { } else if (((SSTableMetaVersion *)key1)->suid > ((SSTableMetaVersion *)key2)->suid) {
return 1; return 1;
} else { } else {
return 0; return 0;
} }
} }
int32_t ctgDbVgVersionSortCompare(const void* key1, const void* key2) { int32_t ctgDbVgVersionSortCompare(const void *key1, const void *key2) {
if (((SDbVgVersion*)key1)->dbId < ((SDbVgVersion*)key2)->dbId) { if (((SDbVgVersion *)key1)->dbId < ((SDbVgVersion *)key2)->dbId) {
return -1; return -1;
} else if (((SDbVgVersion*)key1)->dbId > ((SDbVgVersion*)key2)->dbId) { } else if (((SDbVgVersion *)key1)->dbId > ((SDbVgVersion *)key2)->dbId) {
return 1; return 1;
} else { } else {
return 0; return 0;
} }
} }
int32_t ctgMetaRentInit(SCtgRentMgmt *mgmt, uint32_t rentSec, int8_t type) { int32_t ctgMetaRentInit(SCtgRentMgmt *mgmt, uint32_t rentSec, int8_t type) {
mgmt->slotRIdx = 0; mgmt->slotRIdx = 0;
mgmt->slotNum = rentSec / CTG_RENT_SLOT_SECOND; mgmt->slotNum = rentSec / CTG_RENT_SLOT_SECOND;
...@@ -1285,7 +1258,6 @@ int32_t ctgMetaRentInit(SCtgRentMgmt *mgmt, uint32_t rentSec, int8_t type) { ...@@ -1285,7 +1258,6 @@ int32_t ctgMetaRentInit(SCtgRentMgmt *mgmt, uint32_t rentSec, int8_t type) {
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
} }
int32_t ctgMetaRentAdd(SCtgRentMgmt *mgmt, void *meta, int64_t id, int32_t size) { int32_t ctgMetaRentAdd(SCtgRentMgmt *mgmt, void *meta, int64_t id, int32_t size) {
int16_t widx = abs((int)(id % mgmt->slotNum)); int16_t widx = abs((int)(id % mgmt->slotNum));
...@@ -1296,19 +1268,20 @@ int32_t ctgMetaRentAdd(SCtgRentMgmt *mgmt, void *meta, int64_t id, int32_t size) ...@@ -1296,19 +1268,20 @@ int32_t ctgMetaRentAdd(SCtgRentMgmt *mgmt, void *meta, int64_t id, int32_t size)
if (NULL == slot->meta) { if (NULL == slot->meta) {
slot->meta = taosArrayInit(CTG_DEFAULT_RENT_SLOT_SIZE, size); slot->meta = taosArrayInit(CTG_DEFAULT_RENT_SLOT_SIZE, size);
if (NULL == slot->meta) { if (NULL == slot->meta) {
qError("taosArrayInit %d failed, id:%"PRIx64", slot idx:%d, type:%d", CTG_DEFAULT_RENT_SLOT_SIZE, id, widx, mgmt->type); qError("taosArrayInit %d failed, id:%" PRIx64 ", slot idx:%d, type:%d", CTG_DEFAULT_RENT_SLOT_SIZE, id, widx,
mgmt->type);
CTG_ERR_JRET(TSDB_CODE_CTG_MEM_ERROR); CTG_ERR_JRET(TSDB_CODE_CTG_MEM_ERROR);
} }
} }
if (NULL == taosArrayPush(slot->meta, meta)) { if (NULL == taosArrayPush(slot->meta, meta)) {
qError("taosArrayPush meta to rent failed, id:%"PRIx64", slot idx:%d, type:%d", id, widx, mgmt->type); qError("taosArrayPush meta to rent failed, id:%" PRIx64 ", slot idx:%d, type:%d", id, widx, mgmt->type);
CTG_ERR_JRET(TSDB_CODE_CTG_MEM_ERROR); CTG_ERR_JRET(TSDB_CODE_CTG_MEM_ERROR);
} }
slot->needSort = true; slot->needSort = true;
qDebug("add meta to rent, id:%"PRIx64", slot idx:%d, type:%d", id, widx, mgmt->type); qDebug("add meta to rent, id:%" PRIx64 ", slot idx:%d, type:%d", id, widx, mgmt->type);
_return: _return:
...@@ -1316,7 +1289,8 @@ _return: ...@@ -1316,7 +1289,8 @@ _return:
CTG_RET(code); CTG_RET(code);
} }
int32_t ctgMetaRentUpdate(SCtgRentMgmt *mgmt, void *meta, int64_t id, int32_t size, __compar_fn_t sortCompare, __compar_fn_t searchCompare) { int32_t ctgMetaRentUpdate(SCtgRentMgmt *mgmt, void *meta, int64_t id, int32_t size, __compar_fn_t sortCompare,
__compar_fn_t searchCompare) {
int16_t widx = abs((int)(id % mgmt->slotNum)); int16_t widx = abs((int)(id % mgmt->slotNum));
SCtgRentSlot *slot = &mgmt->slots[widx]; SCtgRentSlot *slot = &mgmt->slots[widx];
...@@ -1324,12 +1298,13 @@ int32_t ctgMetaRentUpdate(SCtgRentMgmt *mgmt, void *meta, int64_t id, int32_t si ...@@ -1324,12 +1298,13 @@ int32_t ctgMetaRentUpdate(SCtgRentMgmt *mgmt, void *meta, int64_t id, int32_t si
CTG_LOCK(CTG_WRITE, &slot->lock); CTG_LOCK(CTG_WRITE, &slot->lock);
if (NULL == slot->meta) { if (NULL == slot->meta) {
qError("empty meta slot, id:%"PRIx64", slot idx:%d, type:%d", id, widx, mgmt->type); qError("empty meta slot, id:%" PRIx64 ", slot idx:%d, type:%d", id, widx, mgmt->type);
CTG_ERR_JRET(TSDB_CODE_CTG_INTERNAL_ERROR); CTG_ERR_JRET(TSDB_CODE_CTG_INTERNAL_ERROR);
} }
if (slot->needSort) { if (slot->needSort) {
qDebug("meta slot before sorte, slot idx:%d, type:%d, size:%d", widx, mgmt->type, (int32_t)taosArrayGetSize(slot->meta)); qDebug("meta slot before sorte, slot idx:%d, type:%d, size:%d", widx, mgmt->type,
(int32_t)taosArrayGetSize(slot->meta));
taosArraySort(slot->meta, sortCompare); taosArraySort(slot->meta, sortCompare);
slot->needSort = false; slot->needSort = false;
qDebug("meta slot sorted, slot idx:%d, type:%d, size:%d", widx, mgmt->type, (int32_t)taosArrayGetSize(slot->meta)); qDebug("meta slot sorted, slot idx:%d, type:%d, size:%d", widx, mgmt->type, (int32_t)taosArrayGetSize(slot->meta));
...@@ -1337,20 +1312,22 @@ int32_t ctgMetaRentUpdate(SCtgRentMgmt *mgmt, void *meta, int64_t id, int32_t si ...@@ -1337,20 +1312,22 @@ int32_t ctgMetaRentUpdate(SCtgRentMgmt *mgmt, void *meta, int64_t id, int32_t si
void *orig = taosArraySearch(slot->meta, &id, searchCompare, TD_EQ); void *orig = taosArraySearch(slot->meta, &id, searchCompare, TD_EQ);
if (NULL == orig) { if (NULL == orig) {
qError("meta not found in slot, id:%"PRIx64", slot idx:%d, type:%d, size:%d", id, widx, mgmt->type, (int32_t)taosArrayGetSize(slot->meta)); qError("meta not found in slot, id:%" PRIx64 ", slot idx:%d, type:%d, size:%d", id, widx, mgmt->type,
(int32_t)taosArrayGetSize(slot->meta));
CTG_ERR_JRET(TSDB_CODE_CTG_INTERNAL_ERROR); CTG_ERR_JRET(TSDB_CODE_CTG_INTERNAL_ERROR);
} }
memcpy(orig, meta, size); memcpy(orig, meta, size);
qDebug("meta in rent updated, id:%"PRIx64", slot idx:%d, type:%d", id, widx, mgmt->type); qDebug("meta in rent updated, id:%" PRIx64 ", slot idx:%d, type:%d", id, widx, mgmt->type);
_return: _return:
CTG_UNLOCK(CTG_WRITE, &slot->lock); CTG_UNLOCK(CTG_WRITE, &slot->lock);
if (code) { if (code) {
qWarn("meta in rent update failed, will try to add it, code:%x, id:%"PRIx64", slot idx:%d, type:%d", code, id, widx, mgmt->type); qWarn("meta in rent update failed, will try to add it, code:%x, id:%" PRIx64 ", slot idx:%d, type:%d", code, id,
widx, mgmt->type);
CTG_RET(ctgMetaRentAdd(mgmt, meta, id, size)); CTG_RET(ctgMetaRentAdd(mgmt, meta, id, size));
} }
...@@ -1365,7 +1342,7 @@ int32_t ctgMetaRentRemove(SCtgRentMgmt *mgmt, int64_t id, __compar_fn_t sortComp ...@@ -1365,7 +1342,7 @@ int32_t ctgMetaRentRemove(SCtgRentMgmt *mgmt, int64_t id, __compar_fn_t sortComp
CTG_LOCK(CTG_WRITE, &slot->lock); CTG_LOCK(CTG_WRITE, &slot->lock);
if (NULL == slot->meta) { if (NULL == slot->meta) {
qError("empty meta slot, id:%"PRIx64", slot idx:%d, type:%d", id, widx, mgmt->type); qError("empty meta slot, id:%" PRIx64 ", slot idx:%d, type:%d", id, widx, mgmt->type);
CTG_ERR_JRET(TSDB_CODE_CTG_INTERNAL_ERROR); CTG_ERR_JRET(TSDB_CODE_CTG_INTERNAL_ERROR);
} }
...@@ -1377,13 +1354,13 @@ int32_t ctgMetaRentRemove(SCtgRentMgmt *mgmt, int64_t id, __compar_fn_t sortComp ...@@ -1377,13 +1354,13 @@ int32_t ctgMetaRentRemove(SCtgRentMgmt *mgmt, int64_t id, __compar_fn_t sortComp
int32_t idx = taosArraySearchIdx(slot->meta, &id, searchCompare, TD_EQ); int32_t idx = taosArraySearchIdx(slot->meta, &id, searchCompare, TD_EQ);
if (idx < 0) { if (idx < 0) {
qError("meta not found in slot, id:%"PRIx64", slot idx:%d, type:%d", id, widx, mgmt->type); qError("meta not found in slot, id:%" PRIx64 ", slot idx:%d, type:%d", id, widx, mgmt->type);
CTG_ERR_JRET(TSDB_CODE_CTG_INTERNAL_ERROR); CTG_ERR_JRET(TSDB_CODE_CTG_INTERNAL_ERROR);
} }
taosArrayRemove(slot->meta, idx); taosArrayRemove(slot->meta, idx);
qDebug("meta in rent removed, id:%"PRIx64", slot idx:%d, type:%d", id, widx, mgmt->type); qDebug("meta in rent removed, id:%" PRIx64 ", slot idx:%d, type:%d", id, widx, mgmt->type);
_return: _return:
...@@ -1392,7 +1369,6 @@ _return: ...@@ -1392,7 +1369,6 @@ _return:
CTG_RET(code); CTG_RET(code);
} }
int32_t ctgMetaRentGetImpl(SCtgRentMgmt *mgmt, void **res, uint32_t *num, int32_t size) { int32_t ctgMetaRentGetImpl(SCtgRentMgmt *mgmt, void **res, uint32_t *num, int32_t size) {
int16_t ridx = atomic_add_fetch_16(&mgmt->slotRIdx, 1); int16_t ridx = atomic_add_fetch_16(&mgmt->slotRIdx, 1);
if (ridx >= mgmt->slotNum) { if (ridx >= mgmt->slotNum) {
...@@ -1468,13 +1444,15 @@ int32_t ctgAddNewDBCache(SCatalog *pCtg, const char *dbFName, uint64_t dbId) { ...@@ -1468,13 +1444,15 @@ int32_t ctgAddNewDBCache(SCatalog *pCtg, const char *dbFName, uint64_t dbId) {
SCtgDBCache newDBCache = {0}; SCtgDBCache newDBCache = {0};
newDBCache.dbId = dbId; newDBCache.dbId = dbId;
newDBCache.tbCache.metaCache = taosHashInit(gCtgMgmt.cfg.maxTblCacheNum, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), true, HASH_ENTRY_LOCK); newDBCache.tbCache.metaCache = taosHashInit(gCtgMgmt.cfg.maxTblCacheNum,
taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), true, HASH_ENTRY_LOCK);
if (NULL == newDBCache.tbCache.metaCache) { if (NULL == newDBCache.tbCache.metaCache) {
ctgError("taosHashInit %d metaCache failed", gCtgMgmt.cfg.maxTblCacheNum); ctgError("taosHashInit %d metaCache failed", gCtgMgmt.cfg.maxTblCacheNum);
CTG_ERR_RET(TSDB_CODE_CTG_MEM_ERROR); CTG_ERR_RET(TSDB_CODE_CTG_MEM_ERROR);
} }
newDBCache.tbCache.stbCache = taosHashInit(gCtgMgmt.cfg.maxTblCacheNum, taosGetDefaultHashFunction(TSDB_DATA_TYPE_UBIGINT), true, HASH_ENTRY_LOCK); newDBCache.tbCache.stbCache = taosHashInit(gCtgMgmt.cfg.maxTblCacheNum,
taosGetDefaultHashFunction(TSDB_DATA_TYPE_UBIGINT), true, HASH_ENTRY_LOCK);
if (NULL == newDBCache.tbCache.stbCache) { if (NULL == newDBCache.tbCache.stbCache) {
ctgError("taosHashInit %d stbCache failed", gCtgMgmt.cfg.maxTblCacheNum); ctgError("taosHashInit %d stbCache failed", gCtgMgmt.cfg.maxTblCacheNum);
CTG_ERR_JRET(TSDB_CODE_CTG_MEM_ERROR); CTG_ERR_JRET(TSDB_CODE_CTG_MEM_ERROR);
...@@ -1496,11 +1474,11 @@ int32_t ctgAddNewDBCache(SCatalog *pCtg, const char *dbFName, uint64_t dbId) { ...@@ -1496,11 +1474,11 @@ int32_t ctgAddNewDBCache(SCatalog *pCtg, const char *dbFName, uint64_t dbId) {
SDbVgVersion vgVersion = {.dbId = newDBCache.dbId, .vgVersion = -1}; SDbVgVersion vgVersion = {.dbId = newDBCache.dbId, .vgVersion = -1};
strncpy(vgVersion.dbFName, dbFName, sizeof(vgVersion.dbFName)); strncpy(vgVersion.dbFName, dbFName, sizeof(vgVersion.dbFName));
ctgDebug("db added to cache, dbFName:%s, dbId:%"PRIx64, dbFName, dbId); ctgDebug("db added to cache, dbFName:%s, dbId:%" PRIx64, dbFName, dbId);
CTG_ERR_RET(ctgMetaRentAdd(&pCtg->dbRent, &vgVersion, dbId, sizeof(SDbVgVersion))); CTG_ERR_RET(ctgMetaRentAdd(&pCtg->dbRent, &vgVersion, dbId, sizeof(SDbVgVersion)));
ctgDebug("db added to rent, dbFName:%s, vgVersion:%d, dbId:%"PRIx64, dbFName, vgVersion.vgVersion, dbId); ctgDebug("db added to rent, dbFName:%s, vgVersion:%d, dbId:%" PRIx64, dbFName, vgVersion.vgVersion, dbId);
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
...@@ -1511,8 +1489,7 @@ _return: ...@@ -1511,8 +1489,7 @@ _return:
CTG_RET(code); CTG_RET(code);
} }
void ctgRemoveStbRent(SCatalog *pCtg, SCtgTbMetaCache *cache) {
void ctgRemoveStbRent(SCatalog* pCtg, SCtgTbMetaCache *cache) {
CTG_LOCK(CTG_WRITE, &cache->stbLock); CTG_LOCK(CTG_WRITE, &cache->stbLock);
if (cache->stbCache) { if (cache->stbCache) {
void *pIter = taosHashIterate(cache->stbCache, NULL); void *pIter = taosHashIterate(cache->stbCache, NULL);
...@@ -1520,8 +1497,9 @@ void ctgRemoveStbRent(SCatalog* pCtg, SCtgTbMetaCache *cache) { ...@@ -1520,8 +1497,9 @@ void ctgRemoveStbRent(SCatalog* pCtg, SCtgTbMetaCache *cache) {
uint64_t *suid = NULL; uint64_t *suid = NULL;
suid = taosHashGetKey(pIter, NULL); suid = taosHashGetKey(pIter, NULL);
if (TSDB_CODE_SUCCESS == ctgMetaRentRemove(&pCtg->stbRent, *suid, ctgStbVersionSortCompare, ctgStbVersionSearchCompare)) { if (TSDB_CODE_SUCCESS ==
ctgDebug("stb removed from rent, suid:%"PRIx64, *suid); ctgMetaRentRemove(&pCtg->stbRent, *suid, ctgStbVersionSortCompare, ctgStbVersionSearchCompare)) {
ctgDebug("stb removed from rent, suid:%" PRIx64, *suid);
} }
pIter = taosHashIterate(cache->stbCache, pIter); pIter = taosHashIterate(cache->stbCache, pIter);
...@@ -1530,11 +1508,10 @@ void ctgRemoveStbRent(SCatalog* pCtg, SCtgTbMetaCache *cache) { ...@@ -1530,11 +1508,10 @@ void ctgRemoveStbRent(SCatalog* pCtg, SCtgTbMetaCache *cache) {
CTG_UNLOCK(CTG_WRITE, &cache->stbLock); CTG_UNLOCK(CTG_WRITE, &cache->stbLock);
} }
int32_t ctgRemoveDB(SCatalog *pCtg, SCtgDBCache *dbCache, const char *dbFName) {
int32_t ctgRemoveDB(SCatalog* pCtg, SCtgDBCache *dbCache, const char* dbFName) {
uint64_t dbId = dbCache->dbId; uint64_t dbId = dbCache->dbId;
ctgInfo("start to remove db from cache, dbFName:%s, dbId:%"PRIx64, dbFName, dbCache->dbId); ctgInfo("start to remove db from cache, dbFName:%s, dbId:%" PRIx64, dbFName, dbCache->dbId);
atomic_store_8(&dbCache->deleted, 1); atomic_store_8(&dbCache->deleted, 1);
...@@ -1544,7 +1521,7 @@ int32_t ctgRemoveDB(SCatalog* pCtg, SCtgDBCache *dbCache, const char* dbFName) { ...@@ -1544,7 +1521,7 @@ int32_t ctgRemoveDB(SCatalog* pCtg, SCtgDBCache *dbCache, const char* dbFName) {
CTG_ERR_RET(ctgMetaRentRemove(&pCtg->dbRent, dbCache->dbId, ctgDbVgVersionSortCompare, ctgDbVgVersionSearchCompare)); CTG_ERR_RET(ctgMetaRentRemove(&pCtg->dbRent, dbCache->dbId, ctgDbVgVersionSortCompare, ctgDbVgVersionSearchCompare));
ctgDebug("db removed from rent, dbFName:%s, dbId:%"PRIx64, dbFName, dbCache->dbId); ctgDebug("db removed from rent, dbFName:%s, dbId:%" PRIx64, dbFName, dbCache->dbId);
if (taosHashRemove(pCtg->dbCache, dbFName, strlen(dbFName))) { if (taosHashRemove(pCtg->dbCache, dbFName, strlen(dbFName))) {
ctgInfo("taosHashRemove from dbCache failed, may be removed, dbFName:%s", dbFName); ctgInfo("taosHashRemove from dbCache failed, may be removed, dbFName:%s", dbFName);
...@@ -1553,13 +1530,12 @@ int32_t ctgRemoveDB(SCatalog* pCtg, SCtgDBCache *dbCache, const char* dbFName) { ...@@ -1553,13 +1530,12 @@ int32_t ctgRemoveDB(SCatalog* pCtg, SCtgDBCache *dbCache, const char* dbFName) {
CTG_CACHE_STAT_SUB(dbNum, 1); CTG_CACHE_STAT_SUB(dbNum, 1);
ctgInfo("db removed from cache, dbFName:%s, dbId:%"PRIx64, dbFName, dbId); ctgInfo("db removed from cache, dbFName:%s, dbId:%" PRIx64, dbFName, dbId);
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
} }
int32_t ctgGetAddDBCache(SCatalog *pCtg, const char *dbFName, uint64_t dbId, SCtgDBCache **pCache) {
int32_t ctgGetAddDBCache(SCatalog* pCtg, const char *dbFName, uint64_t dbId, SCtgDBCache **pCache) {
int32_t code = 0; int32_t code = 0;
SCtgDBCache *dbCache = NULL; SCtgDBCache *dbCache = NULL;
ctgGetDBCache(pCtg, dbFName, &dbCache); ctgGetDBCache(pCtg, dbFName, &dbCache);
...@@ -1600,18 +1576,17 @@ int32_t ctgGetAddDBCache(SCatalog* pCtg, const char *dbFName, uint64_t dbId, SCt ...@@ -1600,18 +1576,17 @@ int32_t ctgGetAddDBCache(SCatalog* pCtg, const char *dbFName, uint64_t dbId, SCt
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
} }
int32_t ctgUpdateDBVgInfo(SCatalog *pCtg, const char *dbFName, uint64_t dbId, SDBVgInfo **pDbInfo) {
int32_t ctgUpdateDBVgInfo(SCatalog* pCtg, const char* dbFName, uint64_t dbId, SDBVgInfo** pDbInfo) {
int32_t code = 0; int32_t code = 0;
SDBVgInfo* dbInfo = *pDbInfo; SDBVgInfo *dbInfo = *pDbInfo;
if (NULL == dbInfo->vgHash) { if (NULL == dbInfo->vgHash) {
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
} }
if (dbInfo->vgVersion < 0 || taosHashGetSize(dbInfo->vgHash) <= 0) { if (dbInfo->vgVersion < 0 || taosHashGetSize(dbInfo->vgHash) <= 0) {
ctgError("invalid db vgInfo, dbFName:%s, vgHash:%p, vgVersion:%d, vgHashSize:%d", ctgError("invalid db vgInfo, dbFName:%s, vgHash:%p, vgVersion:%d, vgHashSize:%d", dbFName, dbInfo->vgHash,
dbFName, dbInfo->vgHash, dbInfo->vgVersion, taosHashGetSize(dbInfo->vgHash)); dbInfo->vgVersion, taosHashGetSize(dbInfo->vgHash));
CTG_ERR_RET(TSDB_CODE_CTG_MEM_ERROR); CTG_ERR_RET(TSDB_CODE_CTG_MEM_ERROR);
} }
...@@ -1621,7 +1596,7 @@ int32_t ctgUpdateDBVgInfo(SCatalog* pCtg, const char* dbFName, uint64_t dbId, SD ...@@ -1621,7 +1596,7 @@ int32_t ctgUpdateDBVgInfo(SCatalog* pCtg, const char* dbFName, uint64_t dbId, SD
SCtgDBCache *dbCache = NULL; SCtgDBCache *dbCache = NULL;
CTG_ERR_RET(ctgGetAddDBCache(pCtg, dbFName, dbId, &dbCache)); CTG_ERR_RET(ctgGetAddDBCache(pCtg, dbFName, dbId, &dbCache));
if (NULL == dbCache) { if (NULL == dbCache) {
ctgInfo("conflict db update, ignore this update, dbFName:%s, dbId:%"PRIx64, dbFName, dbId); ctgInfo("conflict db update, ignore this update, dbFName:%s, dbId:%" PRIx64, dbFName, dbId);
CTG_ERR_RET(TSDB_CODE_CTG_INTERNAL_ERROR); CTG_ERR_RET(TSDB_CODE_CTG_INTERNAL_ERROR);
} }
...@@ -1630,14 +1605,16 @@ int32_t ctgUpdateDBVgInfo(SCatalog* pCtg, const char* dbFName, uint64_t dbId, SD ...@@ -1630,14 +1605,16 @@ int32_t ctgUpdateDBVgInfo(SCatalog* pCtg, const char* dbFName, uint64_t dbId, SD
if (dbCache->vgInfo) { if (dbCache->vgInfo) {
if (dbInfo->vgVersion < dbCache->vgInfo->vgVersion) { if (dbInfo->vgVersion < dbCache->vgInfo->vgVersion) {
ctgDebug("db vgVersion is old, dbFName:%s, vgVersion:%d, currentVersion:%d", dbFName, dbInfo->vgVersion, dbCache->vgInfo->vgVersion); ctgDebug("db vgVersion is old, dbFName:%s, vgVersion:%d, currentVersion:%d", dbFName, dbInfo->vgVersion,
dbCache->vgInfo->vgVersion);
ctgWReleaseVgInfo(dbCache); ctgWReleaseVgInfo(dbCache);
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
} }
if (dbInfo->vgVersion == dbCache->vgInfo->vgVersion && dbInfo->numOfTable == dbCache->vgInfo->numOfTable) { if (dbInfo->vgVersion == dbCache->vgInfo->vgVersion && dbInfo->numOfTable == dbCache->vgInfo->numOfTable) {
ctgDebug("no new db vgVersion or numOfTable, dbFName:%s, vgVersion:%d, numOfTable:%d", dbFName, dbInfo->vgVersion, dbInfo->numOfTable); ctgDebug("no new db vgVersion or numOfTable, dbFName:%s, vgVersion:%d, numOfTable:%d", dbFName, dbInfo->vgVersion,
dbInfo->numOfTable);
ctgWReleaseVgInfo(dbCache); ctgWReleaseVgInfo(dbCache);
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
...@@ -1650,26 +1627,27 @@ int32_t ctgUpdateDBVgInfo(SCatalog* pCtg, const char* dbFName, uint64_t dbId, SD ...@@ -1650,26 +1627,27 @@ int32_t ctgUpdateDBVgInfo(SCatalog* pCtg, const char* dbFName, uint64_t dbId, SD
*pDbInfo = NULL; *pDbInfo = NULL;
ctgDebug("db vgInfo updated, dbFName:%s, vgVersion:%d, dbId:%"PRIx64, dbFName, vgVersion.vgVersion, vgVersion.dbId); ctgDebug("db vgInfo updated, dbFName:%s, vgVersion:%d, dbId:%" PRIx64, dbFName, vgVersion.vgVersion, vgVersion.dbId);
ctgWReleaseVgInfo(dbCache); ctgWReleaseVgInfo(dbCache);
dbCache = NULL; dbCache = NULL;
strncpy(vgVersion.dbFName, dbFName, sizeof(vgVersion.dbFName)); strncpy(vgVersion.dbFName, dbFName, sizeof(vgVersion.dbFName));
CTG_ERR_RET(ctgMetaRentUpdate(&pCtg->dbRent, &vgVersion, vgVersion.dbId, sizeof(SDbVgVersion), ctgDbVgVersionSortCompare, ctgDbVgVersionSearchCompare)); CTG_ERR_RET(ctgMetaRentUpdate(&pCtg->dbRent, &vgVersion, vgVersion.dbId, sizeof(SDbVgVersion),
ctgDbVgVersionSortCompare, ctgDbVgVersionSearchCompare));
CTG_RET(code); CTG_RET(code);
} }
int32_t ctgUpdateTblMeta(SCatalog *pCtg, SCtgDBCache *dbCache, char *dbFName, uint64_t dbId, char *tbName,
int32_t ctgUpdateTblMeta(SCatalog *pCtg, SCtgDBCache *dbCache, char *dbFName, uint64_t dbId, char *tbName, STableMeta *meta, int32_t metaSize) { STableMeta *meta, int32_t metaSize) {
SCtgTbMetaCache *tbCache = &dbCache->tbCache; SCtgTbMetaCache *tbCache = &dbCache->tbCache;
CTG_LOCK(CTG_READ, &tbCache->metaLock); CTG_LOCK(CTG_READ, &tbCache->metaLock);
if (dbCache->deleted || NULL == tbCache->metaCache || NULL == tbCache->stbCache) { if (dbCache->deleted || NULL == tbCache->metaCache || NULL == tbCache->stbCache) {
CTG_UNLOCK(CTG_READ, &tbCache->metaLock); CTG_UNLOCK(CTG_READ, &tbCache->metaLock);
ctgError("db is dropping, dbId:%"PRIx64, dbCache->dbId); ctgError("db is dropping, dbId:%" PRIx64, dbCache->dbId);
CTG_ERR_RET(TSDB_CODE_CTG_DB_DROPPED); CTG_ERR_RET(TSDB_CODE_CTG_DB_DROPPED);
} }
...@@ -1680,7 +1658,8 @@ int32_t ctgUpdateTblMeta(SCatalog *pCtg, SCtgDBCache *dbCache, char *dbFName, ui ...@@ -1680,7 +1658,8 @@ int32_t ctgUpdateTblMeta(SCatalog *pCtg, SCtgDBCache *dbCache, char *dbFName, ui
if (orig) { if (orig) {
origType = orig->tableType; origType = orig->tableType;
if (origType == meta->tableType && orig->uid == meta->uid && orig->sversion >= meta->sversion && orig->tversion >= meta->tversion) { if (origType == meta->tableType && orig->uid == meta->uid && orig->sversion >= meta->sversion &&
orig->tversion >= meta->tversion) {
CTG_UNLOCK(CTG_READ, &tbCache->metaLock); CTG_UNLOCK(CTG_READ, &tbCache->metaLock);
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
} }
...@@ -1689,13 +1668,13 @@ int32_t ctgUpdateTblMeta(SCatalog *pCtg, SCtgDBCache *dbCache, char *dbFName, ui ...@@ -1689,13 +1668,13 @@ int32_t ctgUpdateTblMeta(SCatalog *pCtg, SCtgDBCache *dbCache, char *dbFName, ui
if ((!isStb) || orig->suid != meta->suid) { if ((!isStb) || orig->suid != meta->suid) {
CTG_LOCK(CTG_WRITE, &tbCache->stbLock); CTG_LOCK(CTG_WRITE, &tbCache->stbLock);
if (taosHashRemove(tbCache->stbCache, &orig->suid, sizeof(orig->suid))) { if (taosHashRemove(tbCache->stbCache, &orig->suid, sizeof(orig->suid))) {
ctgError("stb not exist in stbCache, dbFName:%s, stb:%s, suid:%"PRIx64, dbFName, tbName, orig->suid); ctgError("stb not exist in stbCache, dbFName:%s, stb:%s, suid:%" PRIx64, dbFName, tbName, orig->suid);
} else { } else {
CTG_CACHE_STAT_SUB(stblNum, 1); CTG_CACHE_STAT_SUB(stblNum, 1);
} }
CTG_UNLOCK(CTG_WRITE, &tbCache->stbLock); CTG_UNLOCK(CTG_WRITE, &tbCache->stbLock);
ctgDebug("stb removed from stbCache, dbFName:%s, stb:%s, suid:%"PRIx64, dbFName, tbName, orig->suid); ctgDebug("stb removed from stbCache, dbFName:%s, stb:%s, suid:%" PRIx64, dbFName, tbName, orig->suid);
ctgMetaRentRemove(&pCtg->stbRent, orig->suid, ctgStbVersionSortCompare, ctgStbVersionSearchCompare); ctgMetaRentRemove(&pCtg->stbRent, orig->suid, ctgStbVersionSortCompare, ctgStbVersionSearchCompare);
} }
...@@ -1722,7 +1701,8 @@ int32_t ctgUpdateTblMeta(SCatalog *pCtg, SCtgDBCache *dbCache, char *dbFName, ui ...@@ -1722,7 +1701,8 @@ int32_t ctgUpdateTblMeta(SCatalog *pCtg, SCtgDBCache *dbCache, char *dbFName, ui
CTG_CACHE_STAT_ADD(tblNum, 1); CTG_CACHE_STAT_ADD(tblNum, 1);
} }
ctgDebug("tbmeta updated to cache, dbFName:%s, tbName:%s, tbType:%d, suid:%" PRIx64, dbFName, tbName, meta->tableType, meta->suid); ctgDebug("tbmeta updated to cache, dbFName:%s, tbName:%s, tbType:%d, suid:%" PRIx64, dbFName, tbName, meta->tableType,
meta->suid);
ctgdShowTableMeta(pCtg, tbName, meta); ctgdShowTableMeta(pCtg, tbName, meta);
if (!isStb) { if (!isStb) {
...@@ -1734,7 +1714,7 @@ int32_t ctgUpdateTblMeta(SCatalog *pCtg, SCtgDBCache *dbCache, char *dbFName, ui ...@@ -1734,7 +1714,7 @@ int32_t ctgUpdateTblMeta(SCatalog *pCtg, SCtgDBCache *dbCache, char *dbFName, ui
if (taosHashPut(tbCache->stbCache, &meta->suid, sizeof(meta->suid), &tbMeta, POINTER_BYTES) != 0) { if (taosHashPut(tbCache->stbCache, &meta->suid, sizeof(meta->suid), &tbMeta, POINTER_BYTES) != 0) {
CTG_UNLOCK(CTG_WRITE, &tbCache->stbLock); CTG_UNLOCK(CTG_WRITE, &tbCache->stbLock);
CTG_UNLOCK(CTG_READ, &tbCache->metaLock); CTG_UNLOCK(CTG_READ, &tbCache->metaLock);
ctgError("taosHashPut stable to stable cache failed, suid:%"PRIx64, meta->suid); ctgError("taosHashPut stable to stable cache failed, suid:%" PRIx64, meta->suid);
CTG_ERR_RET(TSDB_CODE_CTG_MEM_ERROR); CTG_ERR_RET(TSDB_CODE_CTG_MEM_ERROR);
} }
...@@ -1744,9 +1724,11 @@ int32_t ctgUpdateTblMeta(SCatalog *pCtg, SCtgDBCache *dbCache, char *dbFName, ui ...@@ -1744,9 +1724,11 @@ int32_t ctgUpdateTblMeta(SCatalog *pCtg, SCtgDBCache *dbCache, char *dbFName, ui
CTG_UNLOCK(CTG_READ, &tbCache->metaLock); CTG_UNLOCK(CTG_READ, &tbCache->metaLock);
ctgDebug("stb updated to stbCache, dbFName:%s, tbName:%s, tbType:%d, suid:%" PRIx64 ",ma:%p", dbFName, tbName, meta->tableType, meta->suid, tbMeta); ctgDebug("stb updated to stbCache, dbFName:%s, tbName:%s, tbType:%d, suid:%" PRIx64 ",ma:%p", dbFName, tbName,
meta->tableType, meta->suid, tbMeta);
SSTableMetaVersion metaRent = {.dbId = dbId, .suid = meta->suid, .sversion = meta->sversion, .tversion = meta->tversion}; SSTableMetaVersion metaRent = {
.dbId = dbId, .suid = meta->suid, .sversion = meta->sversion, .tversion = meta->tversion};
strcpy(metaRent.dbFName, dbFName); strcpy(metaRent.dbFName, dbFName);
strcpy(metaRent.stbName, tbName); strcpy(metaRent.stbName, tbName);
CTG_ERR_RET(ctgMetaRentAdd(&pCtg->stbRent, &metaRent, metaRent.suid, sizeof(SSTableMetaVersion))); CTG_ERR_RET(ctgMetaRentAdd(&pCtg->stbRent, &metaRent, metaRent.suid, sizeof(SSTableMetaVersion)));
...@@ -1787,13 +1769,11 @@ int32_t ctgCloneVgInfo(SDBVgInfo *src, SDBVgInfo **dst) { ...@@ -1787,13 +1769,11 @@ int32_t ctgCloneVgInfo(SDBVgInfo *src, SDBVgInfo **dst) {
pIter = taosHashIterate(src->vgHash, pIter); pIter = taosHashIterate(src->vgHash, pIter);
} }
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
} }
int32_t ctgGetDBVgInfo(SCatalog *pCtg, void *pRpc, const SEpSet *pMgmtEps, const char *dbFName, SCtgDBCache **dbCache,
SDBVgInfo **pInfo) {
int32_t ctgGetDBVgInfo(SCatalog* pCtg, void *pRpc, const SEpSet* pMgmtEps, const char* dbFName, SCtgDBCache** dbCache, SDBVgInfo **pInfo) {
bool inCache = false; bool inCache = false;
int32_t code = 0; int32_t code = 0;
...@@ -1833,10 +1813,10 @@ _return: ...@@ -1833,10 +1813,10 @@ _return:
CTG_RET(code); CTG_RET(code);
} }
int32_t ctgRefreshDBVgInfo(SCatalog* pCtg, void *pRpc, const SEpSet* pMgmtEps, const char* dbFName) { int32_t ctgRefreshDBVgInfo(SCatalog *pCtg, void *pRpc, const SEpSet *pMgmtEps, const char *dbFName) {
bool inCache = false; bool inCache = false;
int32_t code = 0; int32_t code = 0;
SCtgDBCache* dbCache = NULL; SCtgDBCache *dbCache = NULL;
CTG_ERR_RET(ctgAcquireVgInfoFromCache(pCtg, dbFName, &dbCache, &inCache)); CTG_ERR_RET(ctgAcquireVgInfoFromCache(pCtg, dbFName, &dbCache, &inCache));
...@@ -1869,8 +1849,6 @@ int32_t ctgRefreshDBVgInfo(SCatalog* pCtg, void *pRpc, const SEpSet* pMgmtEps, c ...@@ -1869,8 +1849,6 @@ int32_t ctgRefreshDBVgInfo(SCatalog* pCtg, void *pRpc, const SEpSet* pMgmtEps, c
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
} }
int32_t ctgCloneMetaOutput(STableMetaOutput *output, STableMetaOutput **pOutput) { int32_t ctgCloneMetaOutput(STableMetaOutput *output, STableMetaOutput **pOutput) {
*pOutput = taosMemoryMalloc(sizeof(STableMetaOutput)); *pOutput = taosMemoryMalloc(sizeof(STableMetaOutput));
if (NULL == *pOutput) { if (NULL == *pOutput) {
...@@ -1895,9 +1873,8 @@ int32_t ctgCloneMetaOutput(STableMetaOutput *output, STableMetaOutput **pOutput) ...@@ -1895,9 +1873,8 @@ int32_t ctgCloneMetaOutput(STableMetaOutput *output, STableMetaOutput **pOutput)
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
} }
int32_t ctgRefreshTblMeta(SCatalog *pCtg, void *pTrans, const SEpSet *pMgmtEps, const SName *pTableName, int32_t flag,
STableMetaOutput **pOutput, bool syncReq) {
int32_t ctgRefreshTblMeta(SCatalog* pCtg, void *pTrans, const SEpSet* pMgmtEps, const SName* pTableName, int32_t flag, STableMetaOutput **pOutput, bool syncReq) {
if (NULL == pCtg || NULL == pTrans || NULL == pMgmtEps || NULL == pTableName) { if (NULL == pCtg || NULL == pTrans || NULL == pMgmtEps || NULL == pTableName) {
CTG_ERR_RET(TSDB_CODE_CTG_INVALID_INPUT); CTG_ERR_RET(TSDB_CODE_CTG_INVALID_INPUT);
} }
...@@ -1919,7 +1896,8 @@ int32_t ctgRefreshTblMeta(SCatalog* pCtg, void *pTrans, const SEpSet* pMgmtEps, ...@@ -1919,7 +1896,8 @@ int32_t ctgRefreshTblMeta(SCatalog* pCtg, void *pTrans, const SEpSet* pMgmtEps,
if (CTG_FLAG_IS_SYS_DB(flag)) { if (CTG_FLAG_IS_SYS_DB(flag)) {
ctgDebug("will refresh tbmeta, supposed in information_schema, tbName:%s", tNameGetTableName(pTableName)); ctgDebug("will refresh tbmeta, supposed in information_schema, tbName:%s", tNameGetTableName(pTableName));
CTG_ERR_JRET(ctgGetTableMetaFromMnodeImpl(pCtg, pTrans, pMgmtEps, (char *)pTableName->dbname, (char *)pTableName->tname, output)); CTG_ERR_JRET(ctgGetTableMetaFromMnodeImpl(pCtg, pTrans, pMgmtEps, (char *)pTableName->dbname,
(char *)pTableName->tname, output));
} else if (CTG_FLAG_IS_STB(flag)) { } else if (CTG_FLAG_IS_STB(flag)) {
ctgDebug("will refresh tbmeta, supposed to be stb, tbName:%s", tNameGetTableName(pTableName)); ctgDebug("will refresh tbmeta, supposed to be stb, tbName:%s", tNameGetTableName(pTableName));
...@@ -1972,9 +1950,11 @@ int32_t ctgRefreshTblMeta(SCatalog* pCtg, void *pTrans, const SEpSet* pMgmtEps, ...@@ -1972,9 +1950,11 @@ int32_t ctgRefreshTblMeta(SCatalog* pCtg, void *pTrans, const SEpSet* pMgmtEps,
} }
if (CTG_IS_META_TABLE(output->metaType)) { if (CTG_IS_META_TABLE(output->metaType)) {
ctgDebug("tbmeta got, dbFName:%s, tbName:%s, tbType:%d", output->dbFName, output->tbName, output->tbMeta->tableType); ctgDebug("tbmeta got, dbFName:%s, tbName:%s, tbType:%d", output->dbFName, output->tbName,
output->tbMeta->tableType);
} else { } else {
ctgDebug("tbmeta got, dbFName:%s, tbName:%s, tbType:%d, stbMetaGot:%d", output->dbFName, output->ctbName, output->ctbMeta.tableType, CTG_IS_META_BOTH(output->metaType)); ctgDebug("tbmeta got, dbFName:%s, tbName:%s, tbType:%d, stbMetaGot:%d", output->dbFName, output->ctbName,
output->ctbMeta.tableType, CTG_IS_META_BOTH(output->metaType));
} }
if (pOutput) { if (pOutput) {
...@@ -1993,7 +1973,8 @@ _return: ...@@ -1993,7 +1973,8 @@ _return:
CTG_RET(code); CTG_RET(code);
} }
int32_t ctgGetTableMeta(SCatalog* pCtg, void *pRpc, const SEpSet* pMgmtEps, const SName* pTableName, STableMeta** pTableMeta, int32_t flag) { int32_t ctgGetTableMeta(SCatalog *pCtg, void *pRpc, const SEpSet *pMgmtEps, const SName *pTableName,
STableMeta **pTableMeta, int32_t flag) {
if (NULL == pCtg || NULL == pRpc || NULL == pMgmtEps || NULL == pTableName || NULL == pTableMeta) { if (NULL == pCtg || NULL == pRpc || NULL == pMgmtEps || NULL == pTableName || NULL == pTableMeta) {
CTG_ERR_RET(TSDB_CODE_CTG_INVALID_INPUT); CTG_ERR_RET(TSDB_CODE_CTG_INVALID_INPUT);
} }
...@@ -2013,7 +1994,8 @@ int32_t ctgGetTableMeta(SCatalog* pCtg, void *pRpc, const SEpSet* pMgmtEps, cons ...@@ -2013,7 +1994,8 @@ int32_t ctgGetTableMeta(SCatalog* pCtg, void *pRpc, const SEpSet* pMgmtEps, cons
int32_t tbType = 0; int32_t tbType = 0;
if (inCache) { if (inCache) {
if (CTG_FLAG_MATCH_STB(flag, (*pTableMeta)->tableType) && ((!CTG_FLAG_IS_FORCE_UPDATE(flag)) || (CTG_FLAG_IS_SYS_DB(flag)))) { if (CTG_FLAG_MATCH_STB(flag, (*pTableMeta)->tableType) &&
((!CTG_FLAG_IS_FORCE_UPDATE(flag)) || (CTG_FLAG_IS_SYS_DB(flag)))) {
goto _return; goto _return;
} }
...@@ -2027,7 +2009,6 @@ int32_t ctgGetTableMeta(SCatalog* pCtg, void *pRpc, const SEpSet* pMgmtEps, cons ...@@ -2027,7 +2009,6 @@ int32_t ctgGetTableMeta(SCatalog* pCtg, void *pRpc, const SEpSet* pMgmtEps, cons
CTG_FLAG_SET_STB(flag, tbType); CTG_FLAG_SET_STB(flag, tbType);
} }
while (true) { while (true) {
CTG_ERR_JRET(ctgRefreshTblMeta(pCtg, pRpc, pMgmtEps, pTableName, flag, &output, false)); CTG_ERR_JRET(ctgRefreshTblMeta(pCtg, pRpc, pMgmtEps, pTableName, flag, &output, false));
...@@ -2095,7 +2076,8 @@ _return: ...@@ -2095,7 +2076,8 @@ _return:
CTG_RET(code); CTG_RET(code);
} }
int32_t ctgChkAuth(SCatalog* pCtg, void *pRpc, const SEpSet* pMgmtEps, const char* user, const char* dbFName, AUTH_TYPE type, bool *pass) { int32_t ctgChkAuth(SCatalog *pCtg, void *pRpc, const SEpSet *pMgmtEps, const char *user, const char *dbFName,
AUTH_TYPE type, bool *pass) {
bool inCache = false; bool inCache = false;
int32_t code = 0; int32_t code = 0;
...@@ -2135,7 +2117,6 @@ _return: ...@@ -2135,7 +2117,6 @@ _return:
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
} }
int32_t ctgActUpdateVg(SCtgMetaAction *action) { int32_t ctgActUpdateVg(SCtgMetaAction *action) {
int32_t code = 0; int32_t code = 0;
SCtgUpdateVgMsg *msg = action->data; SCtgUpdateVgMsg *msg = action->data;
...@@ -2153,7 +2134,7 @@ _return: ...@@ -2153,7 +2134,7 @@ _return:
int32_t ctgActRemoveDB(SCtgMetaAction *action) { int32_t ctgActRemoveDB(SCtgMetaAction *action) {
int32_t code = 0; int32_t code = 0;
SCtgRemoveDBMsg *msg = action->data; SCtgRemoveDBMsg *msg = action->data;
SCatalog* pCtg = msg->pCtg; SCatalog *pCtg = msg->pCtg;
SCtgDBCache *dbCache = NULL; SCtgDBCache *dbCache = NULL;
ctgGetDBCache(msg->pCtg, msg->dbFName, &dbCache); ctgGetDBCache(msg->pCtg, msg->dbFName, &dbCache);
...@@ -2162,7 +2143,8 @@ int32_t ctgActRemoveDB(SCtgMetaAction *action) { ...@@ -2162,7 +2143,8 @@ int32_t ctgActRemoveDB(SCtgMetaAction *action) {
} }
if (dbCache->dbId != msg->dbId) { if (dbCache->dbId != msg->dbId) {
ctgInfo("dbId already updated, dbFName:%s, dbId:%"PRIx64 ", targetId:%"PRIx64, msg->dbFName, dbCache->dbId, msg->dbId); ctgInfo("dbId already updated, dbFName:%s, dbId:%" PRIx64 ", targetId:%" PRIx64, msg->dbFName, dbCache->dbId,
msg->dbId);
goto _return; goto _return;
} }
...@@ -2175,12 +2157,11 @@ _return: ...@@ -2175,12 +2157,11 @@ _return:
CTG_RET(code); CTG_RET(code);
} }
int32_t ctgActUpdateTbl(SCtgMetaAction *action) { int32_t ctgActUpdateTbl(SCtgMetaAction *action) {
int32_t code = 0; int32_t code = 0;
SCtgUpdateTblMsg *msg = action->data; SCtgUpdateTblMsg *msg = action->data;
SCatalog* pCtg = msg->pCtg; SCatalog *pCtg = msg->pCtg;
STableMetaOutput* output = msg->output; STableMetaOutput *output = msg->output;
SCtgDBCache *dbCache = NULL; SCtgDBCache *dbCache = NULL;
if ((!CTG_IS_META_CTABLE(output->metaType)) && NULL == output->tbMeta) { if ((!CTG_IS_META_CTABLE(output->metaType)) && NULL == output->tbMeta) {
...@@ -2195,18 +2176,20 @@ int32_t ctgActUpdateTbl(SCtgMetaAction *action) { ...@@ -2195,18 +2176,20 @@ int32_t ctgActUpdateTbl(SCtgMetaAction *action) {
CTG_ERR_JRET(ctgGetAddDBCache(pCtg, output->dbFName, output->dbId, &dbCache)); CTG_ERR_JRET(ctgGetAddDBCache(pCtg, output->dbFName, output->dbId, &dbCache));
if (NULL == dbCache) { if (NULL == dbCache) {
ctgInfo("conflict db update, ignore this update, dbFName:%s, dbId:%"PRIx64, output->dbFName, output->dbId); ctgInfo("conflict db update, ignore this update, dbFName:%s, dbId:%" PRIx64, output->dbFName, output->dbId);
CTG_ERR_JRET(TSDB_CODE_CTG_INTERNAL_ERROR); CTG_ERR_JRET(TSDB_CODE_CTG_INTERNAL_ERROR);
} }
if (CTG_IS_META_TABLE(output->metaType) || CTG_IS_META_BOTH(output->metaType)) { if (CTG_IS_META_TABLE(output->metaType) || CTG_IS_META_BOTH(output->metaType)) {
int32_t metaSize = CTG_META_SIZE(output->tbMeta); int32_t metaSize = CTG_META_SIZE(output->tbMeta);
CTG_ERR_JRET(ctgUpdateTblMeta(pCtg, dbCache, output->dbFName, output->dbId, output->tbName, output->tbMeta, metaSize)); CTG_ERR_JRET(
ctgUpdateTblMeta(pCtg, dbCache, output->dbFName, output->dbId, output->tbName, output->tbMeta, metaSize));
} }
if (CTG_IS_META_CTABLE(output->metaType) || CTG_IS_META_BOTH(output->metaType)) { if (CTG_IS_META_CTABLE(output->metaType) || CTG_IS_META_BOTH(output->metaType)) {
CTG_ERR_JRET(ctgUpdateTblMeta(pCtg, dbCache, output->dbFName, output->dbId, output->ctbName, (STableMeta *)&output->ctbMeta, sizeof(output->ctbMeta))); CTG_ERR_JRET(ctgUpdateTblMeta(pCtg, dbCache, output->dbFName, output->dbId, output->ctbName,
(STableMeta *)&output->ctbMeta, sizeof(output->ctbMeta)));
} }
_return: _return:
...@@ -2221,11 +2204,10 @@ _return: ...@@ -2221,11 +2204,10 @@ _return:
CTG_RET(code); CTG_RET(code);
} }
int32_t ctgActRemoveStb(SCtgMetaAction *action) { int32_t ctgActRemoveStb(SCtgMetaAction *action) {
int32_t code = 0; int32_t code = 0;
SCtgRemoveStbMsg *msg = action->data; SCtgRemoveStbMsg *msg = action->data;
SCatalog* pCtg = msg->pCtg; SCatalog *pCtg = msg->pCtg;
SCtgDBCache *dbCache = NULL; SCtgDBCache *dbCache = NULL;
ctgGetDBCache(pCtg, msg->dbFName, &dbCache); ctgGetDBCache(pCtg, msg->dbFName, &dbCache);
...@@ -2234,20 +2216,22 @@ int32_t ctgActRemoveStb(SCtgMetaAction *action) { ...@@ -2234,20 +2216,22 @@ int32_t ctgActRemoveStb(SCtgMetaAction *action) {
} }
if (msg->dbId && (dbCache->dbId != msg->dbId)) { if (msg->dbId && (dbCache->dbId != msg->dbId)) {
ctgDebug("dbId already modified, dbFName:%s, current:%"PRIx64", dbId:%"PRIx64", stb:%s, suid:%"PRIx64, msg->dbFName, dbCache->dbId, msg->dbId, msg->stbName, msg->suid); ctgDebug("dbId already modified, dbFName:%s, current:%" PRIx64 ", dbId:%" PRIx64 ", stb:%s, suid:%" PRIx64,
msg->dbFName, dbCache->dbId, msg->dbId, msg->stbName, msg->suid);
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
} }
CTG_LOCK(CTG_WRITE, &dbCache->tbCache.stbLock); CTG_LOCK(CTG_WRITE, &dbCache->tbCache.stbLock);
if (taosHashRemove(dbCache->tbCache.stbCache, &msg->suid, sizeof(msg->suid))) { if (taosHashRemove(dbCache->tbCache.stbCache, &msg->suid, sizeof(msg->suid))) {
ctgDebug("stb not exist in stbCache, may be removed, dbFName:%s, stb:%s, suid:%"PRIx64, msg->dbFName, msg->stbName, msg->suid); ctgDebug("stb not exist in stbCache, may be removed, dbFName:%s, stb:%s, suid:%" PRIx64, msg->dbFName, msg->stbName,
msg->suid);
} else { } else {
CTG_CACHE_STAT_SUB(stblNum, 1); CTG_CACHE_STAT_SUB(stblNum, 1);
} }
CTG_LOCK(CTG_READ, &dbCache->tbCache.metaLock); CTG_LOCK(CTG_READ, &dbCache->tbCache.metaLock);
if (taosHashRemove(dbCache->tbCache.metaCache, msg->stbName, strlen(msg->stbName))) { if (taosHashRemove(dbCache->tbCache.metaCache, msg->stbName, strlen(msg->stbName))) {
ctgError("stb not exist in cache, dbFName:%s, stb:%s, suid:%"PRIx64, msg->dbFName, msg->stbName, msg->suid); ctgError("stb not exist in cache, dbFName:%s, stb:%s, suid:%" PRIx64, msg->dbFName, msg->stbName, msg->suid);
} else { } else {
CTG_CACHE_STAT_SUB(tblNum, 1); CTG_CACHE_STAT_SUB(tblNum, 1);
} }
...@@ -2255,11 +2239,11 @@ int32_t ctgActRemoveStb(SCtgMetaAction *action) { ...@@ -2255,11 +2239,11 @@ int32_t ctgActRemoveStb(SCtgMetaAction *action) {
CTG_UNLOCK(CTG_WRITE, &dbCache->tbCache.stbLock); CTG_UNLOCK(CTG_WRITE, &dbCache->tbCache.stbLock);
ctgInfo("stb removed from cache, dbFName:%s, stbName:%s, suid:%"PRIx64, msg->dbFName, msg->stbName, msg->suid); ctgInfo("stb removed from cache, dbFName:%s, stbName:%s, suid:%" PRIx64, msg->dbFName, msg->stbName, msg->suid);
CTG_ERR_JRET(ctgMetaRentRemove(&msg->pCtg->stbRent, msg->suid, ctgStbVersionSortCompare, ctgStbVersionSearchCompare)); CTG_ERR_JRET(ctgMetaRentRemove(&msg->pCtg->stbRent, msg->suid, ctgStbVersionSortCompare, ctgStbVersionSearchCompare));
ctgDebug("stb removed from rent, dbFName:%s, stbName:%s, suid:%"PRIx64, msg->dbFName, msg->stbName, msg->suid); ctgDebug("stb removed from rent, dbFName:%s, stbName:%s, suid:%" PRIx64, msg->dbFName, msg->stbName, msg->suid);
_return: _return:
...@@ -2271,7 +2255,7 @@ _return: ...@@ -2271,7 +2255,7 @@ _return:
int32_t ctgActRemoveTbl(SCtgMetaAction *action) { int32_t ctgActRemoveTbl(SCtgMetaAction *action) {
int32_t code = 0; int32_t code = 0;
SCtgRemoveTblMsg *msg = action->data; SCtgRemoveTblMsg *msg = action->data;
SCatalog* pCtg = msg->pCtg; SCatalog *pCtg = msg->pCtg;
SCtgDBCache *dbCache = NULL; SCtgDBCache *dbCache = NULL;
ctgGetDBCache(pCtg, msg->dbFName, &dbCache); ctgGetDBCache(pCtg, msg->dbFName, &dbCache);
...@@ -2280,7 +2264,8 @@ int32_t ctgActRemoveTbl(SCtgMetaAction *action) { ...@@ -2280,7 +2264,8 @@ int32_t ctgActRemoveTbl(SCtgMetaAction *action) {
} }
if (dbCache->dbId != msg->dbId) { if (dbCache->dbId != msg->dbId) {
ctgDebug("dbId already modified, dbFName:%s, current:%"PRIx64", dbId:%"PRIx64", tbName:%s", msg->dbFName, dbCache->dbId, msg->dbId, msg->tbName); ctgDebug("dbId already modified, dbFName:%s, current:%" PRIx64 ", dbId:%" PRIx64 ", tbName:%s", msg->dbFName,
dbCache->dbId, msg->dbId, msg->tbName);
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
} }
...@@ -2306,10 +2291,11 @@ _return: ...@@ -2306,10 +2291,11 @@ _return:
int32_t ctgActUpdateUser(SCtgMetaAction *action) { int32_t ctgActUpdateUser(SCtgMetaAction *action) {
int32_t code = 0; int32_t code = 0;
SCtgUpdateUserMsg *msg = action->data; SCtgUpdateUserMsg *msg = action->data;
SCatalog* pCtg = msg->pCtg; SCatalog *pCtg = msg->pCtg;
if (NULL == pCtg->userCache) { if (NULL == pCtg->userCache) {
pCtg->userCache = taosHashInit(gCtgMgmt.cfg.maxUserCacheNum, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), false, HASH_ENTRY_LOCK); pCtg->userCache = taosHashInit(gCtgMgmt.cfg.maxUserCacheNum, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY),
false, HASH_ENTRY_LOCK);
if (NULL == pCtg->userCache) { if (NULL == pCtg->userCache) {
ctgError("taosHashInit %d user cache failed", gCtgMgmt.cfg.maxUserCacheNum); ctgError("taosHashInit %d user cache failed", gCtgMgmt.cfg.maxUserCacheNum);
CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY); CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY);
...@@ -2326,7 +2312,7 @@ int32_t ctgActUpdateUser(SCtgMetaAction *action) { ...@@ -2326,7 +2312,7 @@ int32_t ctgActUpdateUser(SCtgMetaAction *action) {
userAuth.readDbs = msg->userAuth.readDbs; userAuth.readDbs = msg->userAuth.readDbs;
userAuth.writeDbs = msg->userAuth.writeDbs; userAuth.writeDbs = msg->userAuth.writeDbs;
if (taosHashPut(pCtg->userCache, msg->userAuth.user, strlen(msg->userAuth.user), &userAuth, sizeof(userAuth))) { if (taosHashPut(pCtg->userCache, msg->userAuth.user, sizeof(msg->userAuth.user), &userAuth, sizeof(userAuth))) {
ctgError("taosHashPut user %s to cache failed", msg->userAuth.user); ctgError("taosHashPut user %s to cache failed", msg->userAuth.user);
CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY); CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY);
} }
...@@ -2356,7 +2342,6 @@ int32_t ctgActUpdateUser(SCtgMetaAction *action) { ...@@ -2356,7 +2342,6 @@ int32_t ctgActUpdateUser(SCtgMetaAction *action) {
_return: _return:
taosHashCleanup(msg->userAuth.createdDbs); taosHashCleanup(msg->userAuth.createdDbs);
taosHashCleanup(msg->userAuth.readDbs); taosHashCleanup(msg->userAuth.readDbs);
taosHashCleanup(msg->userAuth.writeDbs); taosHashCleanup(msg->userAuth.writeDbs);
...@@ -2366,8 +2351,7 @@ _return: ...@@ -2366,8 +2351,7 @@ _return:
CTG_RET(code); CTG_RET(code);
} }
void *ctgUpdateThreadFunc(void *param) {
void* ctgUpdateThreadFunc(void* param) {
setThreadName("catalog"); setThreadName("catalog");
qInfo("catalog update thread started"); qInfo("catalog update thread started");
...@@ -2379,7 +2363,7 @@ void* ctgUpdateThreadFunc(void* param) { ...@@ -2379,7 +2363,7 @@ void* ctgUpdateThreadFunc(void* param) {
qError("ctg tsem_wait failed, error:%s", tstrerror(TAOS_SYSTEM_ERROR(errno))); qError("ctg tsem_wait failed, error:%s", tstrerror(TAOS_SYSTEM_ERROR(errno)));
} }
if (atomic_load_8((int8_t*)&gCtgMgmt.exit)) { if (atomic_load_8((int8_t *)&gCtgMgmt.exit)) {
tsem_post(&gCtgMgmt.queue.rspSem); tsem_post(&gCtgMgmt.queue.rspSem);
break; break;
} }
...@@ -2410,7 +2394,6 @@ void* ctgUpdateThreadFunc(void* param) { ...@@ -2410,7 +2394,6 @@ void* ctgUpdateThreadFunc(void* param) {
return NULL; return NULL;
} }
int32_t ctgStartUpdateThread() { int32_t ctgStartUpdateThread() {
TdThreadAttr thAttr; TdThreadAttr thAttr;
taosThreadAttrInit(&thAttr); taosThreadAttrInit(&thAttr);
...@@ -2425,11 +2408,12 @@ int32_t ctgStartUpdateThread() { ...@@ -2425,11 +2408,12 @@ int32_t ctgStartUpdateThread() {
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
} }
int32_t ctgGetTableDistVgInfo(SCatalog* pCtg, void *pRpc, const SEpSet* pMgmtEps, const SName* pTableName, SArray** pVgList) { int32_t ctgGetTableDistVgInfo(SCatalog *pCtg, void *pRpc, const SEpSet *pMgmtEps, const SName *pTableName,
SArray **pVgList) {
STableMeta *tbMeta = NULL; STableMeta *tbMeta = NULL;
int32_t code = 0; int32_t code = 0;
SVgroupInfo vgroupInfo = {0}; SVgroupInfo vgroupInfo = {0};
SCtgDBCache* dbCache = NULL; SCtgDBCache *dbCache = NULL;
SArray *vgList = NULL; SArray *vgList = NULL;
SDBVgInfo *vgInfo = NULL; SDBVgInfo *vgInfo = NULL;
...@@ -2507,7 +2491,7 @@ int32_t catalogInit(SCatalogCfg *cfg) { ...@@ -2507,7 +2491,7 @@ int32_t catalogInit(SCatalogCfg *cfg) {
CTG_ERR_RET(TSDB_CODE_CTG_INVALID_INPUT); CTG_ERR_RET(TSDB_CODE_CTG_INVALID_INPUT);
} }
atomic_store_8((int8_t*)&gCtgMgmt.exit, false); atomic_store_8((int8_t *)&gCtgMgmt.exit, false);
if (cfg) { if (cfg) {
memcpy(&gCtgMgmt.cfg, cfg, sizeof(*cfg)); memcpy(&gCtgMgmt.cfg, cfg, sizeof(*cfg));
...@@ -2534,7 +2518,8 @@ int32_t catalogInit(SCatalogCfg *cfg) { ...@@ -2534,7 +2518,8 @@ int32_t catalogInit(SCatalogCfg *cfg) {
gCtgMgmt.cfg.stbRentSec = CTG_DEFAULT_RENT_SECOND; gCtgMgmt.cfg.stbRentSec = CTG_DEFAULT_RENT_SECOND;
} }
gCtgMgmt.pCluster = taosHashInit(CTG_DEFAULT_CACHE_CLUSTER_NUMBER, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BIGINT), false, HASH_ENTRY_LOCK); gCtgMgmt.pCluster = taosHashInit(CTG_DEFAULT_CACHE_CLUSTER_NUMBER, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BIGINT),
false, HASH_ENTRY_LOCK);
if (NULL == gCtgMgmt.pCluster) { if (NULL == gCtgMgmt.pCluster) {
qError("taosHashInit %d cluster cache failed", CTG_DEFAULT_CACHE_CLUSTER_NUMBER); qError("taosHashInit %d cluster cache failed", CTG_DEFAULT_CACHE_CLUSTER_NUMBER);
CTG_ERR_RET(TSDB_CODE_CTG_INTERNAL_ERROR); CTG_ERR_RET(TSDB_CODE_CTG_INTERNAL_ERROR);
...@@ -2559,18 +2544,19 @@ int32_t catalogInit(SCatalogCfg *cfg) { ...@@ -2559,18 +2544,19 @@ int32_t catalogInit(SCatalogCfg *cfg) {
CTG_ERR_RET(ctgStartUpdateThread()); CTG_ERR_RET(ctgStartUpdateThread());
qDebug("catalog initialized, maxDb:%u, maxTbl:%u, dbRentSec:%u, stbRentSec:%u", gCtgMgmt.cfg.maxDBCacheNum, gCtgMgmt.cfg.maxTblCacheNum, gCtgMgmt.cfg.dbRentSec, gCtgMgmt.cfg.stbRentSec); qDebug("catalog initialized, maxDb:%u, maxTbl:%u, dbRentSec:%u, stbRentSec:%u", gCtgMgmt.cfg.maxDBCacheNum,
gCtgMgmt.cfg.maxTblCacheNum, gCtgMgmt.cfg.dbRentSec, gCtgMgmt.cfg.stbRentSec);
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
} }
int32_t catalogGetHandle(uint64_t clusterId, SCatalog** catalogHandle) { int32_t catalogGetHandle(uint64_t clusterId, SCatalog **catalogHandle) {
if (NULL == catalogHandle) { if (NULL == catalogHandle) {
CTG_ERR_RET(TSDB_CODE_CTG_INVALID_INPUT); CTG_ERR_RET(TSDB_CODE_CTG_INVALID_INPUT);
} }
if (NULL == gCtgMgmt.pCluster) { if (NULL == gCtgMgmt.pCluster) {
qError("catalog cluster cache are not ready, clusterId:%"PRIx64, clusterId); qError("catalog cluster cache are not ready, clusterId:%" PRIx64, clusterId);
CTG_ERR_RET(TSDB_CODE_CTG_NOT_READY); CTG_ERR_RET(TSDB_CODE_CTG_NOT_READY);
} }
...@@ -2578,11 +2564,11 @@ int32_t catalogGetHandle(uint64_t clusterId, SCatalog** catalogHandle) { ...@@ -2578,11 +2564,11 @@ int32_t catalogGetHandle(uint64_t clusterId, SCatalog** catalogHandle) {
SCatalog *clusterCtg = NULL; SCatalog *clusterCtg = NULL;
while (true) { while (true) {
SCatalog **ctg = (SCatalog **)taosHashGet(gCtgMgmt.pCluster, (char*)&clusterId, sizeof(clusterId)); SCatalog **ctg = (SCatalog **)taosHashGet(gCtgMgmt.pCluster, (char *)&clusterId, sizeof(clusterId));
if (ctg && (*ctg)) { if (ctg && (*ctg)) {
*catalogHandle = *ctg; *catalogHandle = *ctg;
qDebug("got catalog handle from cache, clusterId:%"PRIx64", CTG:%p", clusterId, *ctg); qDebug("got catalog handle from cache, clusterId:%" PRIx64 ", CTG:%p", clusterId, *ctg);
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
} }
...@@ -2597,7 +2583,8 @@ int32_t catalogGetHandle(uint64_t clusterId, SCatalog** catalogHandle) { ...@@ -2597,7 +2583,8 @@ int32_t catalogGetHandle(uint64_t clusterId, SCatalog** catalogHandle) {
CTG_ERR_JRET(ctgMetaRentInit(&clusterCtg->dbRent, gCtgMgmt.cfg.dbRentSec, CTG_RENT_DB)); CTG_ERR_JRET(ctgMetaRentInit(&clusterCtg->dbRent, gCtgMgmt.cfg.dbRentSec, CTG_RENT_DB));
CTG_ERR_JRET(ctgMetaRentInit(&clusterCtg->stbRent, gCtgMgmt.cfg.stbRentSec, CTG_RENT_STABLE)); CTG_ERR_JRET(ctgMetaRentInit(&clusterCtg->stbRent, gCtgMgmt.cfg.stbRentSec, CTG_RENT_STABLE));
clusterCtg->dbCache = taosHashInit(gCtgMgmt.cfg.maxDBCacheNum, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), false, HASH_ENTRY_LOCK); clusterCtg->dbCache = taosHashInit(gCtgMgmt.cfg.maxDBCacheNum, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY),
false, HASH_ENTRY_LOCK);
if (NULL == clusterCtg->dbCache) { if (NULL == clusterCtg->dbCache) {
qError("taosHashInit %d dbCache failed", CTG_DEFAULT_CACHE_DB_NUMBER); qError("taosHashInit %d dbCache failed", CTG_DEFAULT_CACHE_DB_NUMBER);
CTG_ERR_JRET(TSDB_CODE_CTG_MEM_ERROR); CTG_ERR_JRET(TSDB_CODE_CTG_MEM_ERROR);
...@@ -2610,11 +2597,11 @@ int32_t catalogGetHandle(uint64_t clusterId, SCatalog** catalogHandle) { ...@@ -2610,11 +2597,11 @@ int32_t catalogGetHandle(uint64_t clusterId, SCatalog** catalogHandle) {
continue; continue;
} }
qError("taosHashPut CTG to cache failed, clusterId:%"PRIx64, clusterId); qError("taosHashPut CTG to cache failed, clusterId:%" PRIx64, clusterId);
CTG_ERR_JRET(TSDB_CODE_CTG_INTERNAL_ERROR); CTG_ERR_JRET(TSDB_CODE_CTG_INTERNAL_ERROR);
} }
qDebug("add CTG to cache, clusterId:%"PRIx64", CTG:%p", clusterId, clusterCtg); qDebug("add CTG to cache, clusterId:%" PRIx64 ", CTG:%p", clusterId, clusterCtg);
break; break;
} }
...@@ -2632,13 +2619,13 @@ _return: ...@@ -2632,13 +2619,13 @@ _return:
CTG_RET(code); CTG_RET(code);
} }
void catalogFreeHandle(SCatalog* pCtg) { void catalogFreeHandle(SCatalog *pCtg) {
if (NULL == pCtg) { if (NULL == pCtg) {
return; return;
} }
if (taosHashRemove(gCtgMgmt.pCluster, &pCtg->clusterId, sizeof(pCtg->clusterId))) { if (taosHashRemove(gCtgMgmt.pCluster, &pCtg->clusterId, sizeof(pCtg->clusterId))) {
ctgWarn("taosHashRemove from cluster failed, may already be freed, clusterId:%"PRIx64, pCtg->clusterId); ctgWarn("taosHashRemove from cluster failed, may already be freed, clusterId:%" PRIx64, pCtg->clusterId);
return; return;
} }
...@@ -2648,10 +2635,10 @@ void catalogFreeHandle(SCatalog* pCtg) { ...@@ -2648,10 +2635,10 @@ void catalogFreeHandle(SCatalog* pCtg) {
ctgFreeHandle(pCtg); ctgFreeHandle(pCtg);
ctgInfo("handle freed, culsterId:%"PRIx64, clusterId); ctgInfo("handle freed, culsterId:%" PRIx64, clusterId);
} }
int32_t catalogGetDBVgVersion(SCatalog* pCtg, const char* dbFName, int32_t* version, int64_t* dbId, int32_t *tableNum) { int32_t catalogGetDBVgVersion(SCatalog *pCtg, const char *dbFName, int32_t *version, int64_t *dbId, int32_t *tableNum) {
CTG_API_ENTER(); CTG_API_ENTER();
if (NULL == pCtg || NULL == dbFName || NULL == version || NULL == dbId) { if (NULL == pCtg || NULL == dbFName || NULL == version || NULL == dbId) {
...@@ -2684,14 +2671,15 @@ _return: ...@@ -2684,14 +2671,15 @@ _return:
CTG_API_LEAVE(code); CTG_API_LEAVE(code);
} }
int32_t catalogGetDBVgInfo(SCatalog* pCtg, void *pRpc, const SEpSet* pMgmtEps, const char* dbFName, SArray** vgroupList) { int32_t catalogGetDBVgInfo(SCatalog *pCtg, void *pRpc, const SEpSet *pMgmtEps, const char *dbFName,
SArray **vgroupList) {
CTG_API_ENTER(); CTG_API_ENTER();
if (NULL == pCtg || NULL == dbFName || NULL == pRpc || NULL == pMgmtEps || NULL == vgroupList) { if (NULL == pCtg || NULL == dbFName || NULL == pRpc || NULL == pMgmtEps || NULL == vgroupList) {
CTG_API_LEAVE(TSDB_CODE_CTG_INVALID_INPUT); CTG_API_LEAVE(TSDB_CODE_CTG_INVALID_INPUT);
} }
SCtgDBCache* dbCache = NULL; SCtgDBCache *dbCache = NULL;
int32_t code = 0; int32_t code = 0;
SArray *vgList = NULL; SArray *vgList = NULL;
SHashObj *vgHash = NULL; SHashObj *vgHash = NULL;
...@@ -2723,8 +2711,7 @@ _return: ...@@ -2723,8 +2711,7 @@ _return:
CTG_API_LEAVE(code); CTG_API_LEAVE(code);
} }
int32_t catalogUpdateDBVgInfo(SCatalog *pCtg, const char *dbFName, uint64_t dbId, SDBVgInfo *dbInfo) {
int32_t catalogUpdateDBVgInfo(SCatalog* pCtg, const char* dbFName, uint64_t dbId, SDBVgInfo* dbInfo) {
CTG_API_ENTER(); CTG_API_ENTER();
int32_t code = 0; int32_t code = 0;
...@@ -2741,8 +2728,7 @@ _return: ...@@ -2741,8 +2728,7 @@ _return:
CTG_API_LEAVE(code); CTG_API_LEAVE(code);
} }
int32_t catalogRemoveDB(SCatalog *pCtg, const char *dbFName, uint64_t dbId) {
int32_t catalogRemoveDB(SCatalog* pCtg, const char* dbFName, uint64_t dbId) {
CTG_API_ENTER(); CTG_API_ENTER();
int32_t code = 0; int32_t code = 0;
...@@ -2764,11 +2750,9 @@ _return: ...@@ -2764,11 +2750,9 @@ _return:
CTG_API_LEAVE(code); CTG_API_LEAVE(code);
} }
int32_t catalogUpdateVgEpSet(SCatalog* pCtg, const char* dbFName, int32_t vgId, SEpSet *epSet) { int32_t catalogUpdateVgEpSet(SCatalog *pCtg, const char *dbFName, int32_t vgId, SEpSet *epSet) { return 0; }
return 0;
}
int32_t catalogRemoveTableMeta(SCatalog* pCtg, const SName* pTableName) { int32_t catalogRemoveTableMeta(SCatalog *pCtg, const SName *pTableName) {
CTG_API_ENTER(); CTG_API_ENTER();
int32_t code = 0; int32_t code = 0;
...@@ -2800,7 +2784,6 @@ int32_t catalogRemoveTableMeta(SCatalog* pCtg, const SName* pTableName) { ...@@ -2800,7 +2784,6 @@ int32_t catalogRemoveTableMeta(SCatalog* pCtg, const SName* pTableName) {
CTG_ERR_JRET(ctgPushRmTblMsgInQueue(pCtg, dbFName, dbId, pTableName->tname, true)); CTG_ERR_JRET(ctgPushRmTblMsgInQueue(pCtg, dbFName, dbId, pTableName->tname, true));
} }
_return: _return:
taosMemoryFreeClear(tblMeta); taosMemoryFreeClear(tblMeta);
...@@ -2808,8 +2791,7 @@ _return: ...@@ -2808,8 +2791,7 @@ _return:
CTG_API_LEAVE(code); CTG_API_LEAVE(code);
} }
int32_t catalogRemoveStbMeta(SCatalog *pCtg, const char *dbFName, uint64_t dbId, const char *stbName, uint64_t suid) {
int32_t catalogRemoveStbMeta(SCatalog* pCtg, const char* dbFName, uint64_t dbId, const char* stbName, uint64_t suid) {
CTG_API_ENTER(); CTG_API_ENTER();
int32_t code = 0; int32_t code = 0;
...@@ -2831,23 +2813,26 @@ _return: ...@@ -2831,23 +2813,26 @@ _return:
CTG_API_LEAVE(code); CTG_API_LEAVE(code);
} }
int32_t catalogGetIndexMeta(SCatalog* pCtg, void *pTrans, const SEpSet* pMgmtEps, const SName* pTableName, const char *pIndexName, SIndexMeta** pIndexMeta) { int32_t catalogGetIndexMeta(SCatalog *pCtg, void *pTrans, const SEpSet *pMgmtEps, const SName *pTableName,
const char *pIndexName, SIndexMeta **pIndexMeta) {
return 0; return 0;
} }
int32_t catalogGetTableMeta(SCatalog* pCtg, void *pTrans, const SEpSet* pMgmtEps, const SName* pTableName, STableMeta** pTableMeta) { int32_t catalogGetTableMeta(SCatalog *pCtg, void *pTrans, const SEpSet *pMgmtEps, const SName *pTableName,
STableMeta **pTableMeta) {
CTG_API_ENTER(); CTG_API_ENTER();
CTG_API_LEAVE(ctgGetTableMeta(pCtg, pTrans, pMgmtEps, pTableName, pTableMeta, CTG_FLAG_UNKNOWN_STB)); CTG_API_LEAVE(ctgGetTableMeta(pCtg, pTrans, pMgmtEps, pTableName, pTableMeta, CTG_FLAG_UNKNOWN_STB));
} }
int32_t catalogGetSTableMeta(SCatalog* pCtg, void * pTrans, const SEpSet* pMgmtEps, const SName* pTableName, STableMeta** pTableMeta) { int32_t catalogGetSTableMeta(SCatalog *pCtg, void *pTrans, const SEpSet *pMgmtEps, const SName *pTableName,
STableMeta **pTableMeta) {
CTG_API_ENTER(); CTG_API_ENTER();
CTG_API_LEAVE(ctgGetTableMeta(pCtg, pTrans, pMgmtEps, pTableName, pTableMeta, CTG_FLAG_STB)); CTG_API_LEAVE(ctgGetTableMeta(pCtg, pTrans, pMgmtEps, pTableName, pTableMeta, CTG_FLAG_STB));
} }
int32_t catalogUpdateSTableMeta(SCatalog* pCtg, STableMetaRsp *rspMsg) { int32_t catalogUpdateSTableMeta(SCatalog *pCtg, STableMetaRsp *rspMsg) {
CTG_API_ENTER(); CTG_API_ENTER();
if (NULL == pCtg || NULL == rspMsg) { if (NULL == pCtg || NULL == rspMsg) {
...@@ -2883,9 +2868,8 @@ _return: ...@@ -2883,9 +2868,8 @@ _return:
CTG_API_LEAVE(code); CTG_API_LEAVE(code);
} }
int32_t ctgGetTbSverFromCache(SCatalog *pCtg, const SName *pTableName, int32_t *sver, int32_t *tbType, uint64_t *suid,
char *stbName) {
int32_t ctgGetTbSverFromCache(SCatalog* pCtg, const SName* pTableName, int32_t* sver, int32_t *tbType, uint64_t *suid, char* stbName) {
*sver = -1; *sver = -1;
if (NULL == pCtg->dbCache) { if (NULL == pCtg->dbCache) {
...@@ -2904,7 +2888,7 @@ int32_t ctgGetTbSverFromCache(SCatalog* pCtg, const SName* pTableName, int32_t* ...@@ -2904,7 +2888,7 @@ int32_t ctgGetTbSverFromCache(SCatalog* pCtg, const SName* pTableName, int32_t*
} }
CTG_LOCK(CTG_READ, &dbCache->tbCache.metaLock); CTG_LOCK(CTG_READ, &dbCache->tbCache.metaLock);
STableMeta* tbMeta = taosHashGet(dbCache->tbCache.metaCache, pTableName->tname, strlen(pTableName->tname)); STableMeta *tbMeta = taosHashGet(dbCache->tbCache.metaCache, pTableName->tname, strlen(pTableName->tname));
if (tbMeta) { if (tbMeta) {
*tbType = tbMeta->tableType; *tbType = tbMeta->tableType;
*suid = tbMeta->suid; *suid = tbMeta->suid;
...@@ -2934,19 +2918,20 @@ int32_t ctgGetTbSverFromCache(SCatalog* pCtg, const SName* pTableName, int32_t* ...@@ -2934,19 +2918,20 @@ int32_t ctgGetTbSverFromCache(SCatalog* pCtg, const SName* pTableName, int32_t*
if (NULL == stbMeta || NULL == *stbMeta) { if (NULL == stbMeta || NULL == *stbMeta) {
CTG_UNLOCK(CTG_READ, &dbCache->tbCache.stbLock); CTG_UNLOCK(CTG_READ, &dbCache->tbCache.stbLock);
ctgReleaseDBCache(pCtg, dbCache); ctgReleaseDBCache(pCtg, dbCache);
ctgDebug("stb not in stbCache, suid:%"PRIx64, *suid); ctgDebug("stb not in stbCache, suid:%" PRIx64, *suid);
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
} }
if ((*stbMeta)->suid != *suid) { if ((*stbMeta)->suid != *suid) {
CTG_UNLOCK(CTG_READ, &dbCache->tbCache.stbLock); CTG_UNLOCK(CTG_READ, &dbCache->tbCache.stbLock);
ctgReleaseDBCache(pCtg, dbCache); ctgReleaseDBCache(pCtg, dbCache);
ctgError("stable suid in stbCache mis-match, expected suid:%"PRIx64 ",actual suid:%"PRIx64, *suid, (*stbMeta)->suid); ctgError("stable suid in stbCache mis-match, expected suid:%" PRIx64 ",actual suid:%" PRIx64, *suid,
(*stbMeta)->suid);
CTG_ERR_RET(TSDB_CODE_CTG_INTERNAL_ERROR); CTG_ERR_RET(TSDB_CODE_CTG_INTERNAL_ERROR);
} }
size_t nameLen = 0; size_t nameLen = 0;
char* name = taosHashGetKey(*stbMeta, &nameLen); char *name = taosHashGetKey(*stbMeta, &nameLen);
strncpy(stbName, name, nameLen); strncpy(stbName, name, nameLen);
stbName[nameLen] = 0; stbName[nameLen] = 0;
...@@ -2962,7 +2947,7 @@ int32_t ctgGetTbSverFromCache(SCatalog* pCtg, const SName* pTableName, int32_t* ...@@ -2962,7 +2947,7 @@ int32_t ctgGetTbSverFromCache(SCatalog* pCtg, const SName* pTableName, int32_t*
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
} }
int32_t catalogChkTbMetaVersion(SCatalog* pCtg, void *pTrans, const SEpSet* pMgmtEps, SArray* pTables) { int32_t catalogChkTbMetaVersion(SCatalog *pCtg, void *pTrans, const SEpSet *pMgmtEps, SArray *pTables) {
CTG_API_ENTER(); CTG_API_ENTER();
if (NULL == pCtg || NULL == pTrans || NULL == pMgmtEps || NULL == pTables) { if (NULL == pCtg || NULL == pTrans || NULL == pMgmtEps || NULL == pTables) {
...@@ -2973,7 +2958,7 @@ int32_t catalogChkTbMetaVersion(SCatalog* pCtg, void *pTrans, const SEpSet* pMgm ...@@ -2973,7 +2958,7 @@ int32_t catalogChkTbMetaVersion(SCatalog* pCtg, void *pTrans, const SEpSet* pMgm
int32_t sver = 0; int32_t sver = 0;
int32_t tbNum = taosArrayGetSize(pTables); int32_t tbNum = taosArrayGetSize(pTables);
for (int32_t i = 0; i < tbNum; ++i) { for (int32_t i = 0; i < tbNum; ++i) {
STbSVersion* pTb = (STbSVersion*)taosArrayGet(pTables, i); STbSVersion *pTb = (STbSVersion *)taosArrayGet(pTables, i);
tNameFromString(&name, pTb->tbFName, T_NAME_ACCT | T_NAME_DB | T_NAME_TABLE); tNameFromString(&name, pTb->tbFName, T_NAME_ACCT | T_NAME_DB | T_NAME_TABLE);
if (CTG_IS_SYS_DBNAME(name.dbname)) { if (CTG_IS_SYS_DBNAME(name.dbname)) {
...@@ -3006,8 +2991,7 @@ int32_t catalogChkTbMetaVersion(SCatalog* pCtg, void *pTrans, const SEpSet* pMgm ...@@ -3006,8 +2991,7 @@ int32_t catalogChkTbMetaVersion(SCatalog* pCtg, void *pTrans, const SEpSet* pMgm
CTG_API_LEAVE(TSDB_CODE_SUCCESS); CTG_API_LEAVE(TSDB_CODE_SUCCESS);
} }
int32_t catalogRefreshDBVgInfo(SCatalog *pCtg, void *pTrans, const SEpSet *pMgmtEps, const char *dbFName) {
int32_t catalogRefreshDBVgInfo(SCatalog* pCtg, void *pTrans, const SEpSet* pMgmtEps, const char* dbFName) {
CTG_API_ENTER(); CTG_API_ENTER();
if (NULL == pCtg || NULL == pTrans || NULL == pMgmtEps || NULL == dbFName) { if (NULL == pCtg || NULL == pTrans || NULL == pMgmtEps || NULL == dbFName) {
...@@ -3017,23 +3001,28 @@ int32_t catalogRefreshDBVgInfo(SCatalog* pCtg, void *pTrans, const SEpSet* pMgmt ...@@ -3017,23 +3001,28 @@ int32_t catalogRefreshDBVgInfo(SCatalog* pCtg, void *pTrans, const SEpSet* pMgmt
CTG_API_LEAVE(ctgRefreshDBVgInfo(pCtg, pTrans, pMgmtEps, dbFName)); CTG_API_LEAVE(ctgRefreshDBVgInfo(pCtg, pTrans, pMgmtEps, dbFName));
} }
int32_t catalogRefreshTableMeta(SCatalog* pCtg, void *pTrans, const SEpSet* pMgmtEps, const SName* pTableName, int32_t isSTable) { int32_t catalogRefreshTableMeta(SCatalog *pCtg, void *pTrans, const SEpSet *pMgmtEps, const SName *pTableName,
int32_t isSTable) {
CTG_API_ENTER(); CTG_API_ENTER();
if (NULL == pCtg || NULL == pTrans || NULL == pMgmtEps || NULL == pTableName) { if (NULL == pCtg || NULL == pTrans || NULL == pMgmtEps || NULL == pTableName) {
CTG_API_LEAVE(TSDB_CODE_CTG_INVALID_INPUT); CTG_API_LEAVE(TSDB_CODE_CTG_INVALID_INPUT);
} }
CTG_API_LEAVE(ctgRefreshTblMeta(pCtg, pTrans, pMgmtEps, pTableName, CTG_FLAG_FORCE_UPDATE | CTG_FLAG_MAKE_STB(isSTable), NULL, true)); CTG_API_LEAVE(ctgRefreshTblMeta(pCtg, pTrans, pMgmtEps, pTableName,
CTG_FLAG_FORCE_UPDATE | CTG_FLAG_MAKE_STB(isSTable), NULL, true));
} }
int32_t catalogRefreshGetTableMeta(SCatalog* pCtg, void *pTrans, const SEpSet* pMgmtEps, const SName* pTableName, STableMeta** pTableMeta, int32_t isSTable) { int32_t catalogRefreshGetTableMeta(SCatalog *pCtg, void *pTrans, const SEpSet *pMgmtEps, const SName *pTableName,
STableMeta **pTableMeta, int32_t isSTable) {
CTG_API_ENTER(); CTG_API_ENTER();
CTG_API_LEAVE(ctgGetTableMeta(pCtg, pTrans, pMgmtEps, pTableName, pTableMeta, CTG_FLAG_FORCE_UPDATE | CTG_FLAG_MAKE_STB(isSTable))); CTG_API_LEAVE(ctgGetTableMeta(pCtg, pTrans, pMgmtEps, pTableName, pTableMeta,
CTG_FLAG_FORCE_UPDATE | CTG_FLAG_MAKE_STB(isSTable)));
} }
int32_t catalogGetTableDistVgInfo(SCatalog* pCtg, void *pRpc, const SEpSet* pMgmtEps, const SName* pTableName, SArray** pVgList) { int32_t catalogGetTableDistVgInfo(SCatalog *pCtg, void *pRpc, const SEpSet *pMgmtEps, const SName *pTableName,
SArray **pVgList) {
CTG_API_ENTER(); CTG_API_ENTER();
if (NULL == pCtg || NULL == pRpc || NULL == pMgmtEps || NULL == pTableName || NULL == pVgList) { if (NULL == pCtg || NULL == pRpc || NULL == pMgmtEps || NULL == pTableName || NULL == pVgList) {
...@@ -3051,7 +3040,8 @@ int32_t catalogGetTableDistVgInfo(SCatalog* pCtg, void *pRpc, const SEpSet* pMgm ...@@ -3051,7 +3040,8 @@ int32_t catalogGetTableDistVgInfo(SCatalog* pCtg, void *pRpc, const SEpSet* pMgm
code = ctgGetTableDistVgInfo(pCtg, pRpc, pMgmtEps, pTableName, pVgList); code = ctgGetTableDistVgInfo(pCtg, pRpc, pMgmtEps, pTableName, pVgList);
if (code) { if (code) {
if (TSDB_CODE_CTG_VG_META_MISMATCH == code) { if (TSDB_CODE_CTG_VG_META_MISMATCH == code) {
CTG_ERR_JRET(ctgRefreshTblMeta(pCtg, pRpc, pMgmtEps, pTableName, CTG_FLAG_FORCE_UPDATE | CTG_FLAG_MAKE_STB(CTG_FLAG_UNKNOWN_STB), NULL, true)); CTG_ERR_JRET(ctgRefreshTblMeta(pCtg, pRpc, pMgmtEps, pTableName,
CTG_FLAG_FORCE_UPDATE | CTG_FLAG_MAKE_STB(CTG_FLAG_UNKNOWN_STB), NULL, true));
char dbFName[TSDB_DB_FNAME_LEN] = {0}; char dbFName[TSDB_DB_FNAME_LEN] = {0};
tNameGetFullDbName(pTableName, dbFName); tNameGetFullDbName(pTableName, dbFName);
...@@ -3069,8 +3059,8 @@ _return: ...@@ -3069,8 +3059,8 @@ _return:
CTG_API_LEAVE(code); CTG_API_LEAVE(code);
} }
int32_t catalogGetTableHashVgroup(SCatalog *pCtg, void *pTrans, const SEpSet *pMgmtEps, const SName *pTableName,
int32_t catalogGetTableHashVgroup(SCatalog *pCtg, void *pTrans, const SEpSet *pMgmtEps, const SName *pTableName, SVgroupInfo *pVgroup) { SVgroupInfo *pVgroup) {
CTG_API_ENTER(); CTG_API_ENTER();
if (CTG_IS_SYS_DBNAME(pTableName->dbname)) { if (CTG_IS_SYS_DBNAME(pTableName->dbname)) {
...@@ -3078,7 +3068,7 @@ int32_t catalogGetTableHashVgroup(SCatalog *pCtg, void *pTrans, const SEpSet *pM ...@@ -3078,7 +3068,7 @@ int32_t catalogGetTableHashVgroup(SCatalog *pCtg, void *pTrans, const SEpSet *pM
CTG_API_LEAVE(TSDB_CODE_CTG_INVALID_INPUT); CTG_API_LEAVE(TSDB_CODE_CTG_INVALID_INPUT);
} }
SCtgDBCache* dbCache = NULL; SCtgDBCache *dbCache = NULL;
int32_t code = 0; int32_t code = 0;
char db[TSDB_DB_FNAME_LEN] = {0}; char db[TSDB_DB_FNAME_LEN] = {0};
tNameGetFullDbName(pTableName, db); tNameGetFullDbName(pTableName, db);
...@@ -3103,8 +3093,8 @@ _return: ...@@ -3103,8 +3093,8 @@ _return:
CTG_API_LEAVE(code); CTG_API_LEAVE(code);
} }
int32_t catalogGetAllMeta(SCatalog *pCtg, void *pTrans, const SEpSet *pMgmtEps, const SCatalogReq *pReq,
int32_t catalogGetAllMeta(SCatalog* pCtg, void *pTrans, const SEpSet* pMgmtEps, const SCatalogReq* pReq, SMetaData* pRsp) { SMetaData *pRsp) {
CTG_API_ENTER(); CTG_API_ENTER();
if (NULL == pCtg || NULL == pTrans || NULL == pMgmtEps || NULL == pReq || NULL == pRsp) { if (NULL == pCtg || NULL == pTrans || NULL == pMgmtEps || NULL == pReq || NULL == pRsp) {
...@@ -3164,7 +3154,7 @@ _return: ...@@ -3164,7 +3154,7 @@ _return:
CTG_API_LEAVE(code); CTG_API_LEAVE(code);
} }
int32_t catalogGetQnodeList(SCatalog* pCtg, void *pRpc, const SEpSet* pMgmtEps, SArray* pQnodeList) { int32_t catalogGetQnodeList(SCatalog *pCtg, void *pRpc, const SEpSet *pMgmtEps, SArray *pQnodeList) {
CTG_API_ENTER(); CTG_API_ENTER();
int32_t code = 0; int32_t code = 0;
...@@ -3179,7 +3169,7 @@ _return: ...@@ -3179,7 +3169,7 @@ _return:
CTG_API_LEAVE(TSDB_CODE_SUCCESS); CTG_API_LEAVE(TSDB_CODE_SUCCESS);
} }
int32_t catalogGetExpiredSTables(SCatalog* pCtg, SSTableMetaVersion **stables, uint32_t *num) { int32_t catalogGetExpiredSTables(SCatalog *pCtg, SSTableMetaVersion **stables, uint32_t *num) {
CTG_API_ENTER(); CTG_API_ENTER();
if (NULL == pCtg || NULL == stables || NULL == num) { if (NULL == pCtg || NULL == stables || NULL == num) {
...@@ -3189,7 +3179,7 @@ int32_t catalogGetExpiredSTables(SCatalog* pCtg, SSTableMetaVersion **stables, u ...@@ -3189,7 +3179,7 @@ int32_t catalogGetExpiredSTables(SCatalog* pCtg, SSTableMetaVersion **stables, u
CTG_API_LEAVE(ctgMetaRentGet(&pCtg->stbRent, (void **)stables, num, sizeof(SSTableMetaVersion))); CTG_API_LEAVE(ctgMetaRentGet(&pCtg->stbRent, (void **)stables, num, sizeof(SSTableMetaVersion)));
} }
int32_t catalogGetExpiredDBs(SCatalog* pCtg, SDbVgVersion **dbs, uint32_t *num) { int32_t catalogGetExpiredDBs(SCatalog *pCtg, SDbVgVersion **dbs, uint32_t *num) {
CTG_API_ENTER(); CTG_API_ENTER();
if (NULL == pCtg || NULL == dbs || NULL == num) { if (NULL == pCtg || NULL == dbs || NULL == num) {
...@@ -3199,7 +3189,7 @@ int32_t catalogGetExpiredDBs(SCatalog* pCtg, SDbVgVersion **dbs, uint32_t *num) ...@@ -3199,7 +3189,7 @@ int32_t catalogGetExpiredDBs(SCatalog* pCtg, SDbVgVersion **dbs, uint32_t *num)
CTG_API_LEAVE(ctgMetaRentGet(&pCtg->dbRent, (void **)dbs, num, sizeof(SDbVgVersion))); CTG_API_LEAVE(ctgMetaRentGet(&pCtg->dbRent, (void **)dbs, num, sizeof(SDbVgVersion)));
} }
int32_t catalogGetExpiredUsers(SCatalog* pCtg, SUserAuthVersion **users, uint32_t *num) { int32_t catalogGetExpiredUsers(SCatalog *pCtg, SUserAuthVersion **users, uint32_t *num) {
CTG_API_ENTER(); CTG_API_ENTER();
if (NULL == pCtg || NULL == users || NULL == num) { if (NULL == pCtg || NULL == users || NULL == num) {
...@@ -3227,8 +3217,7 @@ int32_t catalogGetExpiredUsers(SCatalog* pCtg, SUserAuthVersion **users, uint32_ ...@@ -3227,8 +3217,7 @@ int32_t catalogGetExpiredUsers(SCatalog* pCtg, SUserAuthVersion **users, uint32_
CTG_API_LEAVE(TSDB_CODE_SUCCESS); CTG_API_LEAVE(TSDB_CODE_SUCCESS);
} }
int32_t catalogGetDBCfg(SCatalog *pCtg, void *pRpc, const SEpSet *pMgmtEps, const char *dbFName, SDbCfgInfo *pDbCfg) {
int32_t catalogGetDBCfg(SCatalog* pCtg, void *pRpc, const SEpSet* pMgmtEps, const char* dbFName, SDbCfgInfo* pDbCfg) {
CTG_API_ENTER(); CTG_API_ENTER();
if (NULL == pCtg || NULL == pRpc || NULL == pMgmtEps || NULL == dbFName || NULL == pDbCfg) { if (NULL == pCtg || NULL == pRpc || NULL == pMgmtEps || NULL == dbFName || NULL == pDbCfg) {
...@@ -3238,7 +3227,8 @@ int32_t catalogGetDBCfg(SCatalog* pCtg, void *pRpc, const SEpSet* pMgmtEps, cons ...@@ -3238,7 +3227,8 @@ int32_t catalogGetDBCfg(SCatalog* pCtg, void *pRpc, const SEpSet* pMgmtEps, cons
CTG_API_LEAVE(ctgGetDBCfgFromMnode(pCtg, pRpc, pMgmtEps, dbFName, pDbCfg)); CTG_API_LEAVE(ctgGetDBCfgFromMnode(pCtg, pRpc, pMgmtEps, dbFName, pDbCfg));
} }
int32_t catalogGetIndexInfo(SCatalog* pCtg, void *pRpc, const SEpSet* pMgmtEps, const char* indexName, SIndexInfo* pInfo) { int32_t catalogGetIndexInfo(SCatalog *pCtg, void *pRpc, const SEpSet *pMgmtEps, const char *indexName,
SIndexInfo *pInfo) {
CTG_API_ENTER(); CTG_API_ENTER();
if (NULL == pCtg || NULL == pRpc || NULL == pMgmtEps || NULL == indexName || NULL == pInfo) { if (NULL == pCtg || NULL == pRpc || NULL == pMgmtEps || NULL == indexName || NULL == pInfo) {
...@@ -3248,7 +3238,7 @@ int32_t catalogGetIndexInfo(SCatalog* pCtg, void *pRpc, const SEpSet* pMgmtEps, ...@@ -3248,7 +3238,7 @@ int32_t catalogGetIndexInfo(SCatalog* pCtg, void *pRpc, const SEpSet* pMgmtEps,
CTG_API_LEAVE(ctgGetIndexInfoFromMnode(pCtg, pRpc, pMgmtEps, indexName, pInfo)); CTG_API_LEAVE(ctgGetIndexInfoFromMnode(pCtg, pRpc, pMgmtEps, indexName, pInfo));
} }
int32_t catalogGetUdfInfo(SCatalog* pCtg, void *pRpc, const SEpSet* pMgmtEps, const char* funcName, SFuncInfo** pInfo) { int32_t catalogGetUdfInfo(SCatalog *pCtg, void *pRpc, const SEpSet *pMgmtEps, const char *funcName, SFuncInfo **pInfo) {
CTG_API_ENTER(); CTG_API_ENTER();
if (NULL == pCtg || NULL == pRpc || NULL == pMgmtEps || NULL == funcName || NULL == pInfo) { if (NULL == pCtg || NULL == pRpc || NULL == pMgmtEps || NULL == funcName || NULL == pInfo) {
...@@ -3272,7 +3262,8 @@ _return: ...@@ -3272,7 +3262,8 @@ _return:
CTG_API_LEAVE(code); CTG_API_LEAVE(code);
} }
int32_t catalogChkAuth(SCatalog* pCtg, void *pRpc, const SEpSet* pMgmtEps, const char* user, const char* dbFName, AUTH_TYPE type, bool *pass) { int32_t catalogChkAuth(SCatalog *pCtg, void *pRpc, const SEpSet *pMgmtEps, const char *user, const char *dbFName,
AUTH_TYPE type, bool *pass) {
CTG_API_ENTER(); CTG_API_ENTER();
if (NULL == pCtg || NULL == pRpc || NULL == pMgmtEps || NULL == user || NULL == dbFName || NULL == pass) { if (NULL == pCtg || NULL == pRpc || NULL == pMgmtEps || NULL == user || NULL == dbFName || NULL == pass) {
...@@ -3287,7 +3278,7 @@ _return: ...@@ -3287,7 +3278,7 @@ _return:
CTG_API_LEAVE(code); CTG_API_LEAVE(code);
} }
int32_t catalogUpdateUserAuthInfo(SCatalog* pCtg, SGetUserAuthRsp* pAuth) { int32_t catalogUpdateUserAuthInfo(SCatalog *pCtg, SGetUserAuthRsp *pAuth) {
CTG_API_ENTER(); CTG_API_ENTER();
if (NULL == pCtg || NULL == pAuth) { if (NULL == pCtg || NULL == pAuth) {
...@@ -3297,15 +3288,14 @@ int32_t catalogUpdateUserAuthInfo(SCatalog* pCtg, SGetUserAuthRsp* pAuth) { ...@@ -3297,15 +3288,14 @@ int32_t catalogUpdateUserAuthInfo(SCatalog* pCtg, SGetUserAuthRsp* pAuth) {
CTG_API_LEAVE(ctgPushUpdateUserMsgInQueue(pCtg, pAuth, false)); CTG_API_LEAVE(ctgPushUpdateUserMsgInQueue(pCtg, pAuth, false));
} }
void catalogDestroy(void) { void catalogDestroy(void) {
qInfo("start to destroy catalog"); qInfo("start to destroy catalog");
if (NULL == gCtgMgmt.pCluster || atomic_load_8((int8_t*)&gCtgMgmt.exit)) { if (NULL == gCtgMgmt.pCluster || atomic_load_8((int8_t *)&gCtgMgmt.exit)) {
return; return;
} }
atomic_store_8((int8_t*)&gCtgMgmt.exit, true); atomic_store_8((int8_t *)&gCtgMgmt.exit, true);
if (tsem_post(&gCtgMgmt.queue.reqSem)) { if (tsem_post(&gCtgMgmt.queue.reqSem)) {
qError("tsem_post failed, error:%s", tstrerror(TAOS_SYSTEM_ERROR(errno))); qError("tsem_post failed, error:%s", tstrerror(TAOS_SYSTEM_ERROR(errno)));
...@@ -3341,5 +3331,3 @@ void catalogDestroy(void) { ...@@ -3341,5 +3331,3 @@ void catalogDestroy(void) {
qInfo("catalog destroyed"); qInfo("catalog destroyed");
} }
...@@ -972,9 +972,10 @@ SOperatorInfo* createStreamScanOperatorInfo(void* streamReadHandle, void* pDataR ...@@ -972,9 +972,10 @@ SOperatorInfo* createStreamScanOperatorInfo(void* streamReadHandle, void* pDataR
} }
pInfo->primaryTsIndex = 0; // TODO(liuyao) get it from physical plan pInfo->primaryTsIndex = 0; // TODO(liuyao) get it from physical plan
if (pSTInfo->interval.interval > 0) {
pInfo->pUpdateInfo = updateInfoInitP(&pSTInfo->interval, 10000); // TODO(liuyao) get watermark from physical plan pInfo->pUpdateInfo = updateInfoInitP(&pSTInfo->interval, 10000); // TODO(liuyao) get watermark from physical plan
if (pInfo->pUpdateInfo == NULL) { } else {
goto _error; pInfo->pUpdateInfo = NULL;
} }
pInfo->readHandle = *pHandle; pInfo->readHandle = *pHandle;
......
...@@ -241,7 +241,7 @@ alter_table_clause(A) ::= ...@@ -241,7 +241,7 @@ alter_table_clause(A) ::=
alter_table_clause(A) ::= alter_table_clause(A) ::=
full_table_name(B) RENAME TAG column_name(C) column_name(D). { A = createAlterTableRenameCol(pCxt, B, TSDB_ALTER_TABLE_UPDATE_TAG_NAME, &C, &D); } full_table_name(B) RENAME TAG column_name(C) column_name(D). { A = createAlterTableRenameCol(pCxt, B, TSDB_ALTER_TABLE_UPDATE_TAG_NAME, &C, &D); }
alter_table_clause(A) ::= alter_table_clause(A) ::=
full_table_name(B) SET TAG column_name(C) NK_EQ literal(D). { A = createAlterTableSetTag(pCxt, B, &C, releaseRawExprNode(pCxt, D)); } full_table_name(B) SET TAG column_name(C) NK_EQ signed_literal(D). { A = createAlterTableSetTag(pCxt, B, &C, D); }
%type multi_create_clause { SNodeList* } %type multi_create_clause { SNodeList* }
%destructor multi_create_clause { nodesDestroyList($$); } %destructor multi_create_clause { nodesDestroyList($$); }
...@@ -448,7 +448,7 @@ agg_func_opt(A) ::= AGGREGATE. ...@@ -448,7 +448,7 @@ agg_func_opt(A) ::= AGGREGATE.
%type bufsize_opt { int32_t } %type bufsize_opt { int32_t }
%destructor bufsize_opt { } %destructor bufsize_opt { }
bufsize_opt(A) ::= . { A = 0; } bufsize_opt(A) ::= . { A = 0; }
bufsize_opt(A) ::= BUFSIZE NK_INTEGER(B). { A = strtol(B.z, NULL, 10); } bufsize_opt(A) ::= BUFSIZE NK_INTEGER(B). { A = taosStr2Int32(B.z, NULL, 10); }
/************************************************ create/drop stream **************************************************/ /************************************************ create/drop stream **************************************************/
cmd ::= CREATE STREAM not_exists_opt(E) stream_name(A) cmd ::= CREATE STREAM not_exists_opt(E) stream_name(A)
......
...@@ -694,8 +694,22 @@ static EDealRes translateValue(STranslateContext* pCxt, SValueNode* pVal) { ...@@ -694,8 +694,22 @@ static EDealRes translateValue(STranslateContext* pCxt, SValueNode* pVal) {
return translateValueImpl(pCxt, pVal, pVal->node.resType); return translateValueImpl(pCxt, pVal, pVal->node.resType);
} }
static EDealRes translateOperator(STranslateContext* pCxt, SOperatorNode* pOp) { static bool isMultiResFunc(SNode* pNode) {
if (nodesIsUnaryOp(pOp)) { if (NULL == pNode) {
return false;
}
if (QUERY_NODE_FUNCTION != nodeType(pNode) || !fmIsMultiResFunc(((SFunctionNode*)pNode)->funcId)) {
return false;
}
SNodeList* pParameterList = ((SFunctionNode*)pNode)->pParameterList;
if (LIST_LENGTH(pParameterList) > 1) {
return true;
}
SNode* pParam = nodesListGetNode(pParameterList, 0);
return (QUERY_NODE_COLUMN == nodeType(pParam) ? 0 == strcmp(((SColumnNode*)pParam)->colName, "*") : false);
}
static EDealRes translateUnaryOperator(STranslateContext* pCxt, SOperatorNode* pOp) {
if (OP_TYPE_MINUS == pOp->opType) { if (OP_TYPE_MINUS == pOp->opType) {
if (!IS_MATHABLE_TYPE(((SExprNode*)(pOp->pLeft))->resType.type)) { if (!IS_MATHABLE_TYPE(((SExprNode*)(pOp->pLeft))->resType.type)) {
return generateDealNodeErrMsg(pCxt, TSDB_CODE_PAR_WRONG_VALUE_TYPE, ((SExprNode*)(pOp->pLeft))->aliasName); return generateDealNodeErrMsg(pCxt, TSDB_CODE_PAR_WRONG_VALUE_TYPE, ((SExprNode*)(pOp->pLeft))->aliasName);
...@@ -707,10 +721,11 @@ static EDealRes translateOperator(STranslateContext* pCxt, SOperatorNode* pOp) { ...@@ -707,10 +721,11 @@ static EDealRes translateOperator(STranslateContext* pCxt, SOperatorNode* pOp) {
pOp->node.resType.bytes = tDataTypes[TSDB_DATA_TYPE_BOOL].bytes; pOp->node.resType.bytes = tDataTypes[TSDB_DATA_TYPE_BOOL].bytes;
} }
return DEAL_RES_CONTINUE; return DEAL_RES_CONTINUE;
} }
static EDealRes translateArithmeticOperator(STranslateContext* pCxt, SOperatorNode* pOp) {
SDataType ldt = ((SExprNode*)(pOp->pLeft))->resType; SDataType ldt = ((SExprNode*)(pOp->pLeft))->resType;
SDataType rdt = ((SExprNode*)(pOp->pRight))->resType; SDataType rdt = ((SExprNode*)(pOp->pRight))->resType;
if (nodesIsArithmeticOp(pOp)) {
if (TSDB_DATA_TYPE_JSON == ldt.type || TSDB_DATA_TYPE_BLOB == ldt.type || TSDB_DATA_TYPE_JSON == rdt.type || if (TSDB_DATA_TYPE_JSON == ldt.type || TSDB_DATA_TYPE_BLOB == ldt.type || TSDB_DATA_TYPE_JSON == rdt.type ||
TSDB_DATA_TYPE_BLOB == rdt.type) { TSDB_DATA_TYPE_BLOB == rdt.type) {
return generateDealNodeErrMsg(pCxt, TSDB_CODE_PAR_WRONG_VALUE_TYPE, ((SExprNode*)(pOp->pRight))->aliasName); return generateDealNodeErrMsg(pCxt, TSDB_CODE_PAR_WRONG_VALUE_TYPE, ((SExprNode*)(pOp->pRight))->aliasName);
...@@ -731,7 +746,12 @@ static EDealRes translateOperator(STranslateContext* pCxt, SOperatorNode* pOp) { ...@@ -731,7 +746,12 @@ static EDealRes translateOperator(STranslateContext* pCxt, SOperatorNode* pOp) {
pOp->node.resType.type = TSDB_DATA_TYPE_DOUBLE; pOp->node.resType.type = TSDB_DATA_TYPE_DOUBLE;
pOp->node.resType.bytes = tDataTypes[TSDB_DATA_TYPE_DOUBLE].bytes; pOp->node.resType.bytes = tDataTypes[TSDB_DATA_TYPE_DOUBLE].bytes;
} }
} else if (nodesIsComparisonOp(pOp)) { return DEAL_RES_CONTINUE;
}
static EDealRes translateComparisonOperator(STranslateContext* pCxt, SOperatorNode* pOp) {
SDataType ldt = ((SExprNode*)(pOp->pLeft))->resType;
SDataType rdt = ((SExprNode*)(pOp->pRight))->resType;
if (TSDB_DATA_TYPE_BLOB == ldt.type || TSDB_DATA_TYPE_JSON == rdt.type || TSDB_DATA_TYPE_BLOB == rdt.type) { if (TSDB_DATA_TYPE_BLOB == ldt.type || TSDB_DATA_TYPE_JSON == rdt.type || TSDB_DATA_TYPE_BLOB == rdt.type) {
return generateDealNodeErrMsg(pCxt, TSDB_CODE_PAR_WRONG_VALUE_TYPE, ((SExprNode*)(pOp->pRight))->aliasName); return generateDealNodeErrMsg(pCxt, TSDB_CODE_PAR_WRONG_VALUE_TYPE, ((SExprNode*)(pOp->pRight))->aliasName);
} }
...@@ -748,12 +768,36 @@ static EDealRes translateOperator(STranslateContext* pCxt, SOperatorNode* pOp) { ...@@ -748,12 +768,36 @@ static EDealRes translateOperator(STranslateContext* pCxt, SOperatorNode* pOp) {
} }
pOp->node.resType.type = TSDB_DATA_TYPE_BOOL; pOp->node.resType.type = TSDB_DATA_TYPE_BOOL;
pOp->node.resType.bytes = tDataTypes[TSDB_DATA_TYPE_BOOL].bytes; pOp->node.resType.bytes = tDataTypes[TSDB_DATA_TYPE_BOOL].bytes;
} else if (nodesIsJsonOp(pOp)) { return DEAL_RES_CONTINUE;
}
static EDealRes translateJsonOperator(STranslateContext* pCxt, SOperatorNode* pOp) {
SDataType ldt = ((SExprNode*)(pOp->pLeft))->resType;
SDataType rdt = ((SExprNode*)(pOp->pRight))->resType;
if (TSDB_DATA_TYPE_JSON != ldt.type || TSDB_DATA_TYPE_BINARY != rdt.type) { if (TSDB_DATA_TYPE_JSON != ldt.type || TSDB_DATA_TYPE_BINARY != rdt.type) {
return generateDealNodeErrMsg(pCxt, TSDB_CODE_PAR_WRONG_VALUE_TYPE, ((SExprNode*)(pOp->pRight))->aliasName); return generateDealNodeErrMsg(pCxt, TSDB_CODE_PAR_WRONG_VALUE_TYPE, ((SExprNode*)(pOp->pRight))->aliasName);
} }
pOp->node.resType.type = TSDB_DATA_TYPE_JSON; pOp->node.resType.type = TSDB_DATA_TYPE_JSON;
pOp->node.resType.bytes = tDataTypes[TSDB_DATA_TYPE_JSON].bytes; pOp->node.resType.bytes = tDataTypes[TSDB_DATA_TYPE_JSON].bytes;
return DEAL_RES_CONTINUE;
}
static EDealRes translateOperator(STranslateContext* pCxt, SOperatorNode* pOp) {
if (isMultiResFunc(pOp->pLeft)) {
return generateDealNodeErrMsg(pCxt, TSDB_CODE_PAR_WRONG_VALUE_TYPE, ((SExprNode*)(pOp->pLeft))->aliasName);
}
if (isMultiResFunc(pOp->pRight)) {
return generateDealNodeErrMsg(pCxt, TSDB_CODE_PAR_WRONG_VALUE_TYPE, ((SExprNode*)(pOp->pRight))->aliasName);
}
if (nodesIsUnaryOp(pOp)) {
return translateUnaryOperator(pCxt, pOp);
} else if (nodesIsArithmeticOp(pOp)) {
return translateArithmeticOperator(pCxt, pOp);
} else if (nodesIsComparisonOp(pOp)) {
return translateComparisonOperator(pCxt, pOp);
} else if (nodesIsJsonOp(pOp)) {
return translateJsonOperator(pCxt, pOp);
} }
return DEAL_RES_CONTINUE; return DEAL_RES_CONTINUE;
} }
...@@ -808,6 +852,13 @@ static bool hasInvalidFuncNesting(SNodeList* pParameterList) { ...@@ -808,6 +852,13 @@ static bool hasInvalidFuncNesting(SNodeList* pParameterList) {
} }
static EDealRes translateFunction(STranslateContext* pCxt, SFunctionNode* pFunc) { static EDealRes translateFunction(STranslateContext* pCxt, SFunctionNode* pFunc) {
SNode* pParam = NULL;
FOREACH(pParam, pFunc->pParameterList) {
if (isMultiResFunc(pParam)) {
return generateDealNodeErrMsg(pCxt, TSDB_CODE_PAR_WRONG_VALUE_TYPE, ((SExprNode*)pParam)->aliasName);
}
}
SFmGetFuncInfoParam param = {.pCtg = pCxt->pParseCxt->pCatalog, SFmGetFuncInfoParam param = {.pCtg = pCxt->pParseCxt->pCatalog,
.pRpc = pCxt->pParseCxt->pTransporter, .pRpc = pCxt->pParseCxt->pTransporter,
.pMgmtEps = &pCxt->pParseCxt->mgmtEpSet, .pMgmtEps = &pCxt->pParseCxt->mgmtEpSet,
...@@ -926,9 +977,10 @@ typedef struct SCheckExprForGroupByCxt { ...@@ -926,9 +977,10 @@ typedef struct SCheckExprForGroupByCxt {
STranslateContext* pTranslateCxt; STranslateContext* pTranslateCxt;
int32_t selectFuncNum; int32_t selectFuncNum;
bool hasSelectValFunc; bool hasSelectValFunc;
bool hasOtherAggFunc;
} SCheckExprForGroupByCxt; } SCheckExprForGroupByCxt;
static EDealRes rewriteColToSelectValFunc(STranslateContext* pCxt, bool* pHasSelectValFunc, SNode** pNode) { static EDealRes rewriteColToSelectValFunc(STranslateContext* pCxt, SNode** pNode) {
SFunctionNode* pFunc = nodesMakeNode(QUERY_NODE_FUNCTION); SFunctionNode* pFunc = nodesMakeNode(QUERY_NODE_FUNCTION);
if (NULL == pFunc) { if (NULL == pFunc) {
pCxt->errCode = TSDB_CODE_OUT_OF_MEMORY; pCxt->errCode = TSDB_CODE_OUT_OF_MEMORY;
...@@ -942,9 +994,6 @@ static EDealRes rewriteColToSelectValFunc(STranslateContext* pCxt, bool* pHasSel ...@@ -942,9 +994,6 @@ static EDealRes rewriteColToSelectValFunc(STranslateContext* pCxt, bool* pHasSel
} }
if (TSDB_CODE_SUCCESS == pCxt->errCode) { if (TSDB_CODE_SUCCESS == pCxt->errCode) {
*pNode = (SNode*)pFunc; *pNode = (SNode*)pFunc;
if (NULL != pHasSelectValFunc) {
*pHasSelectValFunc = true;
}
} else { } else {
nodesDestroyNode(pFunc); nodesDestroyNode(pFunc);
} }
...@@ -956,8 +1005,12 @@ static EDealRes doCheckExprForGroupBy(SNode** pNode, void* pContext) { ...@@ -956,8 +1005,12 @@ static EDealRes doCheckExprForGroupBy(SNode** pNode, void* pContext) {
if (!nodesIsExprNode(*pNode) || isAliasColumn(*pNode)) { if (!nodesIsExprNode(*pNode) || isAliasColumn(*pNode)) {
return DEAL_RES_CONTINUE; return DEAL_RES_CONTINUE;
} }
pCxt->selectFuncNum += isSelectFunc(*pNode) ? 1 : 0; if (isSelectFunc(*pNode)) {
if (pCxt->selectFuncNum > 1 && pCxt->hasSelectValFunc) { ++(pCxt->selectFuncNum);
} else if (isAggFunc(*pNode)) {
pCxt->hasOtherAggFunc = true;
}
if ((pCxt->selectFuncNum > 1 && pCxt->hasSelectValFunc) || (pCxt->hasOtherAggFunc && pCxt->hasSelectValFunc)) {
return generateDealNodeErrMsg(pCxt->pTranslateCxt, getGroupByErrorCode(pCxt->pTranslateCxt)); return generateDealNodeErrMsg(pCxt->pTranslateCxt, getGroupByErrorCode(pCxt->pTranslateCxt));
} }
if (isAggFunc(*pNode) && !isDistinctOrderBy(pCxt->pTranslateCxt)) { if (isAggFunc(*pNode) && !isDistinctOrderBy(pCxt->pTranslateCxt)) {
...@@ -970,10 +1023,11 @@ static EDealRes doCheckExprForGroupBy(SNode** pNode, void* pContext) { ...@@ -970,10 +1023,11 @@ static EDealRes doCheckExprForGroupBy(SNode** pNode, void* pContext) {
} }
} }
if (isScanPseudoColumnFunc(*pNode) || QUERY_NODE_COLUMN == nodeType(*pNode)) { if (isScanPseudoColumnFunc(*pNode) || QUERY_NODE_COLUMN == nodeType(*pNode)) {
if (pCxt->selectFuncNum > 1) { if (pCxt->selectFuncNum > 1 || pCxt->hasOtherAggFunc) {
return generateDealNodeErrMsg(pCxt->pTranslateCxt, getGroupByErrorCode(pCxt->pTranslateCxt)); return generateDealNodeErrMsg(pCxt->pTranslateCxt, getGroupByErrorCode(pCxt->pTranslateCxt));
} else { } else {
return rewriteColToSelectValFunc(pCxt->pTranslateCxt, &pCxt->hasSelectValFunc, pNode); pCxt->hasSelectValFunc = true;
return rewriteColToSelectValFunc(pCxt->pTranslateCxt, pNode);
} }
} }
if (isAggFunc(*pNode) && isDistinctOrderBy(pCxt->pTranslateCxt)) { if (isAggFunc(*pNode) && isDistinctOrderBy(pCxt->pTranslateCxt)) {
...@@ -983,7 +1037,8 @@ static EDealRes doCheckExprForGroupBy(SNode** pNode, void* pContext) { ...@@ -983,7 +1037,8 @@ static EDealRes doCheckExprForGroupBy(SNode** pNode, void* pContext) {
} }
static int32_t checkExprForGroupBy(STranslateContext* pCxt, SNode** pNode) { static int32_t checkExprForGroupBy(STranslateContext* pCxt, SNode** pNode) {
SCheckExprForGroupByCxt cxt = {.pTranslateCxt = pCxt, .selectFuncNum = 0, .hasSelectValFunc = false}; SCheckExprForGroupByCxt cxt = {
.pTranslateCxt = pCxt, .selectFuncNum = 0, .hasSelectValFunc = false, .hasOtherAggFunc = false};
nodesRewriteExpr(pNode, doCheckExprForGroupBy, &cxt); nodesRewriteExpr(pNode, doCheckExprForGroupBy, &cxt);
if (cxt.selectFuncNum != 1 && cxt.hasSelectValFunc) { if (cxt.selectFuncNum != 1 && cxt.hasSelectValFunc) {
return generateSyntaxErrMsg(&pCxt->msgBuf, getGroupByErrorCode(pCxt)); return generateSyntaxErrMsg(&pCxt->msgBuf, getGroupByErrorCode(pCxt));
...@@ -995,7 +1050,8 @@ static int32_t checkExprListForGroupBy(STranslateContext* pCxt, SNodeList* pList ...@@ -995,7 +1050,8 @@ static int32_t checkExprListForGroupBy(STranslateContext* pCxt, SNodeList* pList
if (NULL == getGroupByList(pCxt)) { if (NULL == getGroupByList(pCxt)) {
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
} }
SCheckExprForGroupByCxt cxt = {.pTranslateCxt = pCxt, .selectFuncNum = 0, .hasSelectValFunc = false}; SCheckExprForGroupByCxt cxt = {
.pTranslateCxt = pCxt, .selectFuncNum = 0, .hasSelectValFunc = false, .hasOtherAggFunc = false};
nodesRewriteExprs(pList, doCheckExprForGroupBy, &cxt); nodesRewriteExprs(pList, doCheckExprForGroupBy, &cxt);
if (cxt.selectFuncNum != 1 && cxt.hasSelectValFunc) { if (cxt.selectFuncNum != 1 && cxt.hasSelectValFunc) {
return generateSyntaxErrMsg(&pCxt->msgBuf, getGroupByErrorCode(pCxt)); return generateSyntaxErrMsg(&pCxt->msgBuf, getGroupByErrorCode(pCxt));
...@@ -1008,7 +1064,7 @@ static EDealRes rewriteColsToSelectValFuncImpl(SNode** pNode, void* pContext) { ...@@ -1008,7 +1064,7 @@ static EDealRes rewriteColsToSelectValFuncImpl(SNode** pNode, void* pContext) {
return DEAL_RES_IGNORE_CHILD; return DEAL_RES_IGNORE_CHILD;
} }
if (isScanPseudoColumnFunc(*pNode) || QUERY_NODE_COLUMN == nodeType(*pNode)) { if (isScanPseudoColumnFunc(*pNode) || QUERY_NODE_COLUMN == nodeType(*pNode)) {
return rewriteColToSelectValFunc((STranslateContext*)pContext, NULL, pNode); return rewriteColToSelectValFunc((STranslateContext*)pContext, pNode);
} }
return DEAL_RES_CONTINUE; return DEAL_RES_CONTINUE;
} }
...@@ -1027,11 +1083,16 @@ typedef struct CheckAggColCoexistCxt { ...@@ -1027,11 +1083,16 @@ typedef struct CheckAggColCoexistCxt {
bool existCol; bool existCol;
bool existNonstdFunc; bool existNonstdFunc;
int32_t selectFuncNum; int32_t selectFuncNum;
bool existOtherAggFunc;
} CheckAggColCoexistCxt; } CheckAggColCoexistCxt;
static EDealRes doCheckAggColCoexist(SNode* pNode, void* pContext) { static EDealRes doCheckAggColCoexist(SNode* pNode, void* pContext) {
CheckAggColCoexistCxt* pCxt = (CheckAggColCoexistCxt*)pContext; CheckAggColCoexistCxt* pCxt = (CheckAggColCoexistCxt*)pContext;
pCxt->selectFuncNum += isSelectFunc(pNode) ? 1 : 0; if (isSelectFunc(pNode)) {
++(pCxt->selectFuncNum);
} else if (isAggFunc(pNode)) {
pCxt->existOtherAggFunc = true;
}
if (isAggFunc(pNode)) { if (isAggFunc(pNode)) {
pCxt->existAggFunc = true; pCxt->existAggFunc = true;
return DEAL_RES_IGNORE_CHILD; return DEAL_RES_IGNORE_CHILD;
...@@ -1050,13 +1111,17 @@ static int32_t checkAggColCoexist(STranslateContext* pCxt, SSelectStmt* pSelect) ...@@ -1050,13 +1111,17 @@ static int32_t checkAggColCoexist(STranslateContext* pCxt, SSelectStmt* pSelect)
if (NULL != pSelect->pGroupByList) { if (NULL != pSelect->pGroupByList) {
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
} }
CheckAggColCoexistCxt cxt = { CheckAggColCoexistCxt cxt = {.pTranslateCxt = pCxt,
.pTranslateCxt = pCxt, .existAggFunc = false, .existCol = false, .existNonstdFunc = false}; .existAggFunc = false,
.existCol = false,
.existNonstdFunc = false,
.selectFuncNum = 0,
.existOtherAggFunc = false};
nodesWalkExprs(pSelect->pProjectionList, doCheckAggColCoexist, &cxt); nodesWalkExprs(pSelect->pProjectionList, doCheckAggColCoexist, &cxt);
if (!pSelect->isDistinct) { if (!pSelect->isDistinct) {
nodesWalkExprs(pSelect->pOrderByList, doCheckAggColCoexist, &cxt); nodesWalkExprs(pSelect->pOrderByList, doCheckAggColCoexist, &cxt);
} }
if (1 == cxt.selectFuncNum) { if (1 == cxt.selectFuncNum && !cxt.existOtherAggFunc) {
return rewriteColsToSelectValFunc(pCxt, pSelect); return rewriteColsToSelectValFunc(pCxt, pSelect);
} }
if ((cxt.selectFuncNum > 1 || cxt.existAggFunc || NULL != pSelect->pWindow) && cxt.existCol) { if ((cxt.selectFuncNum > 1 || cxt.existAggFunc || NULL != pSelect->pWindow) && cxt.existCol) {
...@@ -1230,18 +1295,6 @@ static int32_t createAllColumns(STranslateContext* pCxt, SNodeList** pCols) { ...@@ -1230,18 +1295,6 @@ static int32_t createAllColumns(STranslateContext* pCxt, SNodeList** pCols) {
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
} }
static bool isMultiResFunc(SNode* pNode) {
if (QUERY_NODE_FUNCTION != nodeType(pNode) || !fmIsMultiResFunc(((SFunctionNode*)pNode)->funcId)) {
return false;
}
SNodeList* pParameterList = ((SFunctionNode*)pNode)->pParameterList;
if (LIST_LENGTH(pParameterList) > 1) {
return true;
}
SNode* pParam = nodesListGetNode(pParameterList, 0);
return (QUERY_NODE_COLUMN == nodeType(pParam) ? 0 == strcmp(((SColumnNode*)pParam)->colName, "*") : false);
}
static SNode* createMultiResFunc(SFunctionNode* pSrcFunc, SExprNode* pExpr) { static SNode* createMultiResFunc(SFunctionNode* pSrcFunc, SExprNode* pExpr) {
SFunctionNode* pFunc = nodesMakeNode(QUERY_NODE_FUNCTION); SFunctionNode* pFunc = nodesMakeNode(QUERY_NODE_FUNCTION);
if (NULL == pFunc) { if (NULL == pFunc) {
...@@ -1872,7 +1925,7 @@ static SNode* createSetOperProject(const char* pTableAlias, SNode* pNode) { ...@@ -1872,7 +1925,7 @@ static SNode* createSetOperProject(const char* pTableAlias, SNode* pNode) {
} }
static bool dataTypeEqual(const SDataType* l, const SDataType* r) { static bool dataTypeEqual(const SDataType* l, const SDataType* r) {
return (l->type == r->type && l->bytes == l->bytes && l->precision == r->precision && l->scale == l->scale); return (l->type == r->type && l->bytes == r->bytes && l->precision == r->precision && l->scale == r->scale);
} }
static int32_t createCastFunc(STranslateContext* pCxt, SNode* pExpr, SDataType dt, SNode** pCast) { static int32_t createCastFunc(STranslateContext* pCxt, SNode* pExpr, SDataType dt, SNode** pCast) {
...@@ -2726,8 +2779,11 @@ static int32_t buildCreateStbReq(STranslateContext* pCxt, SCreateTableStmt* pStm ...@@ -2726,8 +2779,11 @@ static int32_t buildCreateStbReq(STranslateContext* pCxt, SCreateTableStmt* pStm
SName tableName; SName tableName;
tNameExtractFullName(toName(pCxt->pParseCxt->acctId, pStmt->dbName, pStmt->tableName, &tableName), pReq->name); tNameExtractFullName(toName(pCxt->pParseCxt->acctId, pStmt->dbName, pStmt->tableName, &tableName), pReq->name);
int32_t code = collectUseTable(&tableName, pCxt->pTables);
return buildRollupAst(pCxt, pStmt, pReq); if (TSDB_CODE_SUCCESS == code) {
code = buildRollupAst(pCxt, pStmt, pReq);
}
return code;
} }
static int32_t translateCreateSuperTable(STranslateContext* pCxt, SCreateTableStmt* pStmt) { static int32_t translateCreateSuperTable(STranslateContext* pCxt, SCreateTableStmt* pStmt) {
...@@ -4032,13 +4088,18 @@ static int32_t createValueFromFunction(STranslateContext* pCxt, SFunctionNode* p ...@@ -4032,13 +4088,18 @@ static int32_t createValueFromFunction(STranslateContext* pCxt, SFunctionNode* p
return scalarCalculateConstants((SNode*)pFunc, (SNode**)pVal); return scalarCalculateConstants((SNode*)pFunc, (SNode**)pVal);
} }
static int32_t colDataBytesToValueDataBytes(uint8_t type, int32_t bytes) {
if (TSDB_DATA_TYPE_VARCHAR == type || TSDB_DATA_TYPE_BINARY == type || TSDB_DATA_TYPE_VARBINARY == type) {
return bytes - VARSTR_HEADER_SIZE;
} else if (TSDB_DATA_TYPE_NCHAR == type) {
return (bytes - VARSTR_HEADER_SIZE) / TSDB_NCHAR_SIZE;
}
return bytes;
}
static SDataType schemaToDataType(SSchema* pSchema) { static SDataType schemaToDataType(SSchema* pSchema) {
SDataType dt = {.type = pSchema->type, .bytes = pSchema->bytes, .precision = 0, .scale = 0}; SDataType dt = {.type = pSchema->type, .bytes = pSchema->bytes, .precision = 0, .scale = 0};
if (TSDB_DATA_TYPE_VARCHAR == dt.type || TSDB_DATA_TYPE_BINARY == dt.type || TSDB_DATA_TYPE_VARBINARY == dt.type) { dt.bytes = colDataBytesToValueDataBytes(pSchema->type, pSchema->bytes);
dt.bytes -= VARSTR_HEADER_SIZE;
} else if (TSDB_DATA_TYPE_NCHAR == dt.type) {
dt.bytes = (dt.bytes - VARSTR_HEADER_SIZE) / TSDB_NCHAR_SIZE;
}
return dt; return dt;
} }
...@@ -4440,7 +4501,8 @@ static int32_t buildUpdateColReq(STranslateContext* pCxt, SAlterTableStmt* pStmt ...@@ -4440,7 +4501,8 @@ static int32_t buildUpdateColReq(STranslateContext* pCxt, SAlterTableStmt* pStmt
SSchema* pSchema = getColSchema(pTableMeta, pStmt->colName); SSchema* pSchema = getColSchema(pTableMeta, pStmt->colName);
if (NULL == pSchema) { if (NULL == pSchema) {
return generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_COLUMN, pStmt->colName); return generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_COLUMN, pStmt->colName);
} else if (!IS_VAR_DATA_TYPE(pSchema->type) || pSchema->bytes >= pReq->colModBytes) { } else if (!IS_VAR_DATA_TYPE(pSchema->type) || pSchema->type != pStmt->dataType.type ||
pSchema->bytes >= pReq->colModBytes) {
return generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_MODIFY_COL); return generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_MODIFY_COL);
} }
......
...@@ -211,540 +211,538 @@ typedef union { ...@@ -211,540 +211,538 @@ typedef union {
** yy_default[] Default action for each state. ** yy_default[] Default action for each state.
** **
*********** Begin parsing tables **********************************************/ *********** Begin parsing tables **********************************************/
#define YY_ACTTAB_COUNT (2167) #define YY_ACTTAB_COUNT (2154)
static const YYACTIONTYPE yy_action[] = { static const YYACTIONTYPE yy_action[] = {
/* 0 */ 383, 76, 384, 1380, 391, 519, 384, 1380, 1631, 28, /* 0 */ 1467, 1777, 1777, 1646, 383, 1634, 384, 1380, 292, 11,
/* 10 */ 223, 1467, 35, 33, 113, 1463, 343, 347, 1646, 1777, /* 10 */ 10, 343, 35, 33, 1776, 146, 24, 923, 1774, 1774,
/* 20 */ 301, 1470, 1159, 1627, 1635, 1633, 36, 34, 32, 31, /* 20 */ 301, 391, 1159, 384, 1380, 1631, 36, 34, 32, 31,
/* 30 */ 30, 1729, 1776, 1478, 94, 522, 1774, 93, 92, 91, /* 30 */ 30, 1662, 26, 36, 34, 32, 31, 30, 518, 503,
/* 40 */ 90, 89, 88, 87, 86, 85, 1662, 1157, 1523, 292, /* 40 */ 1627, 1633, 36, 34, 32, 31, 30, 1157, 1346, 502,
/* 50 */ 32, 31, 30, 503, 291, 1726, 1777, 479, 14, 1521, /* 50 */ 1777, 522, 130, 1617, 1360, 927, 928, 518, 14, 483,
/* 60 */ 35, 33, 1285, 502, 1165, 518, 1631, 1617, 301, 145, /* 60 */ 35, 33, 1285, 145, 1165, 28, 223, 1774, 301, 1675,
/* 70 */ 1159, 349, 274, 1774, 398, 36, 34, 32, 31, 30, /* 70 */ 1159, 349, 80, 1647, 505, 1649, 1650, 501, 77, 522,
/* 80 */ 1, 1627, 1634, 1633, 1675, 112, 24, 132, 1647, 505, /* 80 */ 1, 62, 1715, 1777, 1181, 519, 273, 1711, 518, 1261,
/* 90 */ 1649, 1650, 501, 522, 522, 1157, 36, 34, 32, 31, /* 90 */ 1634, 113, 398, 309, 108, 1157, 1775, 104, 1777, 1470,
/* 100 */ 30, 61, 601, 1247, 271, 483, 14, 519, 35, 33, /* 100 */ 1774, 1646, 601, 1473, 419, 271, 14, 317, 35, 33,
/* 110 */ 597, 596, 1165, 1158, 108, 518, 301, 305, 1159, 104, /* 110 */ 1631, 147, 1165, 1158, 1478, 1774, 301, 38, 1159, 36,
/* 120 */ 1181, 274, 1473, 110, 939, 128, 419, 130, 2, 1360, /* 120 */ 34, 32, 31, 30, 388, 1627, 1633, 56, 2, 1662,
/* 130 */ 54, 484, 1791, 1480, 1777, 1478, 519, 69, 212, 1722, /* 130 */ 1181, 36, 34, 32, 31, 30, 522, 503, 36, 34,
/* 140 */ 478, 1348, 477, 1157, 1196, 1777, 1777, 146, 104, 417, /* 140 */ 32, 31, 30, 1157, 55, 1523, 1777, 502, 39, 131,
/* 150 */ 601, 1774, 1247, 1248, 14, 424, 1160, 1471, 147, 1775, /* 150 */ 601, 1617, 291, 1435, 14, 1371, 1160, 1521, 1662, 145,
/* 160 */ 1165, 1158, 1774, 1774, 1478, 103, 102, 101, 100, 99, /* 160 */ 1165, 1158, 559, 1774, 1450, 274, 472, 1675, 140, 1341,
/* 170 */ 98, 97, 96, 95, 1253, 38, 2, 554, 1163, 1164, /* 170 */ 132, 1647, 505, 1649, 1650, 501, 2, 522, 1163, 1164,
/* 180 */ 54, 1209, 1210, 1212, 1213, 1214, 1215, 1216, 498, 520, /* 180 */ 1517, 1209, 1210, 1212, 1213, 1214, 1215, 1216, 498, 520,
/* 190 */ 1224, 1225, 1226, 1227, 1228, 1229, 553, 552, 601, 551, /* 190 */ 1224, 1225, 1226, 1227, 1228, 1229, 1247, 1410, 601, 519,
/* 200 */ 550, 549, 1248, 495, 1160, 342, 1309, 341, 148, 1158, /* 200 */ 1299, 471, 1183, 55, 1160, 1617, 1456, 1196, 148, 1158,
/* 210 */ 27, 299, 1242, 1243, 1244, 1245, 1246, 1250, 1251, 1252, /* 210 */ 473, 347, 447, 94, 484, 1791, 93, 92, 91, 90,
/* 220 */ 131, 1183, 506, 1253, 1435, 304, 1163, 1164, 1568, 1209, /* 220 */ 89, 88, 87, 86, 85, 1729, 1163, 1164, 1478, 1209,
/* 230 */ 1210, 1212, 1213, 1214, 1215, 1216, 498, 520, 1224, 1225, /* 230 */ 1210, 1212, 1213, 1214, 1215, 1216, 498, 520, 1224, 1225,
/* 240 */ 1226, 1227, 1228, 1229, 1407, 465, 1307, 1308, 1310, 1311, /* 240 */ 1226, 1227, 1228, 1229, 1454, 148, 1248, 479, 1523, 1726,
/* 250 */ 55, 54, 1160, 36, 34, 32, 31, 30, 148, 27, /* 250 */ 1340, 1777, 1160, 597, 596, 306, 1309, 433, 432, 55,
/* 260 */ 299, 1242, 1243, 1244, 1245, 1246, 1250, 1251, 1252, 63, /* 260 */ 1521, 1523, 431, 398, 145, 109, 428, 1253, 1774, 427,
/* 270 */ 289, 479, 1284, 188, 1163, 1164, 1346, 1209, 1210, 1212, /* 270 */ 426, 425, 148, 1522, 1163, 1164, 112, 1209, 1210, 1212,
/* 280 */ 1213, 1214, 1215, 1216, 498, 520, 1224, 1225, 1226, 1227, /* 280 */ 1213, 1214, 1215, 1216, 498, 520, 1224, 1225, 1226, 1227,
/* 290 */ 1228, 1229, 35, 33, 36, 34, 32, 31, 30, 112, /* 290 */ 1228, 1229, 35, 33, 1349, 465, 1307, 1308, 1310, 1311,
/* 300 */ 301, 1456, 1159, 148, 577, 576, 575, 316, 148, 574, /* 300 */ 301, 556, 1159, 27, 299, 1242, 1243, 1244, 1245, 1246,
/* 310 */ 573, 572, 114, 567, 566, 565, 564, 563, 562, 561, /* 310 */ 1250, 1251, 1252, 110, 939, 94, 62, 1469, 93, 92,
/* 320 */ 560, 121, 1299, 1239, 1523, 313, 54, 1157, 991, 1662, /* 320 */ 91, 90, 89, 88, 87, 86, 85, 1157, 143, 1722,
/* 330 */ 306, 1646, 1559, 1561, 317, 1521, 472, 110, 140, 311, /* 330 */ 1723, 148, 1727, 519, 1184, 519, 479, 1631, 1474, 417,
/* 340 */ 35, 33, 1230, 473, 1165, 993, 923, 128, 301, 1517, /* 340 */ 35, 33, 1230, 506, 1165, 348, 304, 104, 301, 1568,
/* 350 */ 1159, 481, 142, 1722, 1723, 1480, 1727, 26, 398, 1662, /* 350 */ 1159, 55, 1627, 1633, 424, 36, 34, 32, 31, 30,
/* 360 */ 8, 36, 34, 32, 31, 30, 503, 36, 34, 32, /* 360 */ 8, 479, 1478, 522, 1478, 112, 36, 34, 32, 31,
/* 370 */ 31, 30, 471, 468, 1777, 1157, 502, 1410, 314, 148, /* 370 */ 30, 1556, 433, 432, 1635, 1157, 154, 431, 156, 1646,
/* 380 */ 1617, 556, 601, 462, 927, 928, 128, 145, 35, 33, /* 380 */ 109, 428, 601, 519, 427, 426, 425, 148, 35, 33,
/* 390 */ 334, 1774, 1165, 1158, 1480, 518, 301, 1675, 1159, 53, /* 390 */ 112, 556, 1165, 1158, 1631, 358, 301, 305, 1159, 1523,
/* 400 */ 268, 1647, 505, 1649, 1650, 501, 382, 522, 9, 386, /* 400 */ 60, 274, 110, 59, 1182, 128, 312, 1662, 9, 1627,
/* 410 */ 336, 332, 1029, 545, 544, 543, 1033, 542, 1035, 1036, /* 410 */ 1633, 1521, 1478, 1185, 1480, 503, 481, 142, 1722, 1723,
/* 420 */ 541, 1038, 538, 1157, 1044, 535, 1046, 1047, 532, 529, /* 420 */ 522, 1727, 468, 1157, 1196, 502, 342, 110, 341, 1617,
/* 430 */ 601, 36, 34, 32, 31, 30, 1160, 433, 432, 548, /* 430 */ 601, 313, 1247, 64, 289, 1397, 1160, 188, 1559, 1561,
/* 440 */ 1165, 1158, 431, 474, 469, 109, 428, 1454, 519, 427, /* 440 */ 1165, 1158, 144, 1722, 1723, 1675, 1727, 548, 263, 1647,
/* 450 */ 426, 425, 1185, 1469, 148, 39, 9, 1729, 1163, 1164, /* 450 */ 505, 1649, 1650, 501, 1370, 522, 9, 434, 1163, 1164,
/* 460 */ 348, 1209, 1210, 1212, 1213, 1214, 1215, 1216, 498, 520, /* 460 */ 334, 1209, 1210, 1212, 1213, 1214, 1215, 1216, 498, 520,
/* 470 */ 1224, 1225, 1226, 1227, 1228, 1229, 1478, 1283, 601, 1292, /* 470 */ 1224, 1225, 1226, 1227, 1228, 1229, 283, 311, 601, 148,
/* 480 */ 1235, 1725, 433, 432, 1160, 1183, 1183, 431, 148, 1158, /* 480 */ 336, 332, 1248, 1120, 1160, 128, 475, 455, 148, 1158,
/* 490 */ 109, 428, 1523, 447, 427, 426, 425, 1341, 312, 1637, /* 490 */ 373, 1122, 474, 469, 1480, 1463, 519, 36, 34, 32,
/* 500 */ 1196, 1159, 1617, 1521, 556, 455, 1163, 1164, 309, 1209, /* 500 */ 31, 30, 1369, 1253, 1617, 1465, 1163, 1164, 359, 1209,
/* 510 */ 1210, 1212, 1213, 1214, 1215, 1216, 498, 520, 1224, 1225, /* 510 */ 1210, 1212, 1213, 1214, 1215, 1216, 498, 520, 1224, 1225,
/* 520 */ 1226, 1227, 1228, 1229, 154, 1631, 1157, 36, 34, 32, /* 520 */ 1226, 1227, 1228, 1229, 284, 1478, 282, 281, 1368, 421,
/* 530 */ 31, 30, 1160, 1777, 390, 1639, 1523, 386, 388, 1371, /* 530 */ 558, 1292, 1160, 423, 158, 157, 456, 1183, 214, 27,
/* 540 */ 1627, 1634, 1633, 1165, 1181, 373, 145, 1522, 59, 1370, /* 540 */ 299, 1242, 1243, 1244, 1245, 1246, 1250, 1251, 1252, 1646,
/* 550 */ 1774, 58, 522, 456, 1163, 1164, 1646, 1209, 1210, 1212, /* 550 */ 382, 1121, 1617, 386, 1163, 1164, 422, 1209, 1210, 1212,
/* 560 */ 1213, 1214, 1215, 1216, 498, 520, 1224, 1225, 1226, 1227, /* 560 */ 1213, 1214, 1215, 1216, 498, 520, 1224, 1225, 1226, 1227,
/* 570 */ 1228, 1229, 35, 33, 270, 519, 1181, 214, 1340, 61, /* 570 */ 1228, 1229, 35, 33, 270, 1777, 1181, 1662, 1617, 519,
/* 580 */ 301, 601, 1159, 366, 1662, 519, 378, 358, 1617, 158, /* 580 */ 301, 314, 1159, 366, 1249, 482, 378, 1461, 145, 128,
/* 590 */ 157, 503, 1158, 1777, 128, 1369, 174, 516, 1617, 1729, /* 590 */ 554, 397, 1774, 390, 423, 502, 386, 1235, 1480, 1617,
/* 600 */ 1474, 502, 1481, 1478, 379, 1617, 145, 1157, 139, 519, /* 600 */ 940, 54, 939, 1183, 379, 1254, 70, 1157, 1478, 553,
/* 610 */ 1774, 483, 1368, 1478, 415, 411, 407, 403, 173, 283, /* 610 */ 552, 1367, 551, 550, 549, 1675, 1366, 422, 81, 1647,
/* 620 */ 485, 359, 1675, 1724, 1165, 259, 1647, 505, 1649, 1650, /* 620 */ 505, 1649, 1650, 501, 1165, 522, 1365, 1471, 1715, 941,
/* 630 */ 501, 519, 522, 1120, 940, 1160, 939, 1478, 479, 445, /* 630 */ 127, 1186, 294, 1711, 141, 1407, 32, 31, 30, 191,
/* 640 */ 2, 1122, 62, 397, 1617, 171, 1367, 1211, 1211, 11, /* 640 */ 2, 25, 1029, 545, 544, 543, 1033, 542, 1035, 1036,
/* 650 */ 10, 1777, 443, 1366, 430, 429, 7, 1163, 1164, 1478, /* 650 */ 541, 1038, 538, 1743, 1044, 535, 1046, 1047, 532, 529,
/* 660 */ 127, 1617, 601, 941, 147, 1365, 112, 284, 1774, 282, /* 660 */ 497, 1617, 601, 1364, 1363, 1362, 1617, 1359, 1358, 1357,
/* 670 */ 281, 1184, 421, 1158, 377, 1364, 423, 372, 371, 370, /* 670 */ 1356, 1355, 1354, 1158, 377, 1353, 1617, 372, 371, 370,
/* 680 */ 369, 368, 365, 364, 363, 362, 361, 357, 356, 355, /* 680 */ 369, 368, 365, 364, 363, 362, 361, 357, 356, 355,
/* 690 */ 354, 353, 352, 351, 350, 1617, 1183, 519, 519, 422, /* 690 */ 354, 353, 352, 351, 350, 577, 576, 575, 316, 1211,
/* 700 */ 519, 1121, 1617, 170, 110, 165, 1455, 167, 479, 1475, /* 700 */ 574, 573, 572, 114, 567, 566, 565, 564, 563, 562,
/* 710 */ 1597, 1186, 517, 1249, 1617, 1363, 1160, 1362, 1359, 143, /* 710 */ 561, 560, 121, 1617, 1617, 1617, 1160, 1617, 1617, 1617,
/* 720 */ 1722, 1723, 487, 1727, 1617, 1478, 1478, 163, 1478, 1261, /* 720 */ 1617, 1617, 1617, 1352, 7, 1617, 128, 1351, 430, 429,
/* 730 */ 1646, 1358, 1357, 1356, 1254, 490, 112, 1355, 1163, 1164, /* 730 */ 1646, 571, 569, 1560, 1561, 1481, 927, 928, 1163, 1164,
/* 740 */ 1182, 1209, 1210, 1212, 1213, 1214, 1215, 1216, 498, 520, /* 740 */ 1729, 1209, 1210, 1212, 1213, 1214, 1215, 1216, 498, 520,
/* 750 */ 1224, 1225, 1226, 1227, 1228, 1229, 519, 246, 1662, 519, /* 750 */ 1224, 1225, 1226, 1227, 1228, 1229, 199, 129, 1662, 519,
/* 760 */ 1508, 1354, 1353, 1352, 1617, 503, 1617, 1617, 236, 1556, /* 760 */ 1284, 1646, 252, 1729, 1725, 1211, 503, 991, 1159, 519,
/* 770 */ 25, 315, 571, 569, 110, 502, 156, 927, 928, 1617, /* 770 */ 1183, 1475, 1606, 1617, 250, 53, 502, 1617, 52, 506,
/* 780 */ 1617, 1617, 1617, 1351, 1478, 483, 1617, 1478, 506, 144, /* 780 */ 1617, 1597, 1734, 1280, 993, 1569, 483, 1724, 1478, 1662,
/* 790 */ 1722, 1723, 1606, 1727, 1569, 559, 1675, 1450, 554, 79, /* 790 */ 1144, 1145, 487, 1157, 479, 159, 1675, 482, 1478, 80,
/* 800 */ 1647, 505, 1649, 1650, 501, 1646, 522, 423, 570, 1715, /* 800 */ 1647, 505, 1649, 1650, 501, 246, 522, 502, 1508, 1715,
/* 810 */ 1617, 1617, 1617, 273, 1711, 1560, 1561, 553, 552, 1397, /* 810 */ 1165, 1617, 519, 273, 1711, 570, 454, 324, 179, 55,
/* 820 */ 551, 550, 549, 1734, 1280, 1777, 1280, 558, 179, 1392, /* 820 */ 1168, 177, 485, 112, 516, 1777, 181, 1675, 490, 180,
/* 830 */ 422, 177, 1617, 1662, 1144, 1145, 199, 324, 147, 1465, /* 830 */ 81, 1647, 505, 1649, 1650, 501, 1637, 522, 145, 519,
/* 840 */ 503, 434, 1774, 181, 129, 1390, 180, 1461, 337, 252, /* 840 */ 1715, 1478, 1774, 483, 294, 1711, 141, 183, 601, 185,
/* 850 */ 502, 436, 183, 185, 1617, 182, 184, 118, 1211, 45, /* 850 */ 182, 517, 184, 445, 495, 337, 79, 1646, 215, 1158,
/* 860 */ 483, 250, 52, 46, 272, 51, 1646, 439, 202, 11, /* 860 */ 110, 519, 519, 547, 461, 1742, 443, 964, 1478, 47,
/* 870 */ 10, 1675, 1343, 1344, 79, 1647, 505, 1649, 1650, 501, /* 870 */ 272, 118, 1639, 236, 315, 212, 1722, 478, 1392, 477,
/* 880 */ 438, 522, 159, 37, 1715, 37, 191, 37, 273, 1711, /* 880 */ 11, 10, 1777, 1390, 965, 1662, 1171, 58, 57, 346,
/* 890 */ 225, 497, 75, 116, 1662, 446, 547, 457, 454, 1306, /* 890 */ 1478, 1478, 153, 503, 1280, 147, 1361, 340, 46, 1774,
/* 900 */ 1777, 482, 71, 1361, 117, 1168, 54, 488, 204, 187, /* 900 */ 436, 1167, 1160, 502, 202, 439, 37, 1617, 1436, 269,
/* 910 */ 1436, 502, 118, 145, 1167, 1617, 1453, 1774, 218, 1646, /* 910 */ 37, 457, 330, 37, 326, 322, 150, 225, 1343, 1344,
/* 920 */ 45, 441, 491, 1255, 209, 1217, 435, 1115, 466, 1663, /* 920 */ 1646, 1455, 116, 1675, 1163, 1164, 81, 1647, 505, 1649,
/* 930 */ 227, 186, 1675, 511, 448, 80, 1647, 505, 1649, 1650, /* 930 */ 1650, 501, 1211, 522, 218, 117, 1715, 466, 1306, 76,
/* 940 */ 501, 527, 522, 78, 233, 1715, 117, 1662, 1381, 294, /* 940 */ 294, 1711, 1790, 448, 204, 118, 1255, 148, 1662, 72,
/* 950 */ 1711, 141, 1022, 416, 503, 50, 1518, 480, 49, 1745, /* 950 */ 1217, 1749, 1663, 1115, 1381, 46, 503, 227, 527, 209,
/* 960 */ 245, 217, 220, 215, 502, 118, 3, 1181, 1617, 461, /* 960 */ 416, 174, 511, 480, 1518, 1283, 502, 1170, 1745, 217,
/* 970 */ 1742, 1171, 1646, 119, 57, 56, 346, 222, 117, 153, /* 970 */ 1617, 117, 1646, 139, 1239, 233, 220, 488, 222, 415,
/* 980 */ 1170, 1050, 319, 323, 340, 1675, 1054, 964, 263, 1647, /* 980 */ 411, 407, 403, 173, 118, 1022, 1675, 119, 117, 81,
/* 990 */ 505, 1649, 1650, 501, 279, 522, 269, 991, 280, 330, /* 990 */ 1647, 505, 1649, 1650, 501, 245, 522, 1453, 1050, 1715,
/* 1000 */ 1662, 326, 322, 150, 965, 1061, 241, 482, 554, 1128, /* 1000 */ 1662, 3, 1181, 294, 1711, 1790, 319, 63, 503, 323,
/* 1010 */ 360, 155, 1558, 1059, 367, 374, 375, 502, 120, 376, /* 1010 */ 171, 1054, 991, 554, 1772, 491, 280, 279, 502, 241,
/* 1020 */ 380, 1617, 1187, 381, 389, 1190, 475, 553, 552, 392, /* 1020 */ 1128, 155, 1617, 360, 1061, 1558, 367, 1059, 120, 375,
/* 1030 */ 551, 550, 549, 393, 148, 162, 164, 1189, 1675, 1349, /* 1030 */ 374, 1646, 553, 552, 380, 551, 550, 549, 1675, 1187,
/* 1040 */ 394, 80, 1647, 505, 1649, 1650, 501, 1646, 522, 166, /* 1040 */ 376, 81, 1647, 505, 1649, 1650, 501, 438, 522, 381,
/* 1050 */ 395, 1715, 1188, 396, 169, 294, 1711, 141, 60, 399, /* 1050 */ 389, 1715, 1190, 162, 392, 294, 1711, 1790, 393, 1662,
/* 1060 */ 94, 172, 420, 93, 92, 91, 90, 89, 88, 87, /* 1060 */ 1189, 164, 446, 394, 166, 395, 1733, 503, 170, 1188,
/* 1070 */ 86, 85, 1468, 418, 288, 1662, 1743, 1165, 176, 1464, /* 1070 */ 165, 396, 167, 399, 169, 61, 187, 502, 418, 172,
/* 1080 */ 1646, 84, 503, 178, 122, 1601, 123, 242, 189, 1466, /* 1080 */ 1165, 1617, 1646, 420, 1468, 176, 1464, 483, 441, 554,
/* 1090 */ 1462, 124, 502, 125, 449, 1186, 1617, 450, 192, 453, /* 1090 */ 84, 242, 163, 435, 288, 1601, 178, 1675, 186, 1646,
/* 1100 */ 1746, 243, 194, 467, 458, 197, 1756, 509, 1662, 6, /* 1100 */ 259, 1647, 505, 1649, 1650, 501, 122, 522, 553, 552,
/* 1110 */ 459, 1755, 476, 1675, 1736, 503, 80, 1647, 505, 1649, /* 1110 */ 1662, 551, 550, 549, 123, 1466, 1462, 124, 503, 125,
/* 1120 */ 1650, 501, 464, 522, 293, 502, 1715, 200, 470, 1617, /* 1120 */ 449, 189, 51, 453, 450, 50, 1777, 1662, 502, 243,
/* 1130 */ 294, 1711, 1790, 463, 203, 5, 208, 1280, 135, 210, /* 1130 */ 458, 192, 1617, 194, 1186, 503, 197, 459, 483, 147,
/* 1140 */ 111, 1749, 1646, 1185, 40, 492, 1675, 295, 1730, 80, /* 1140 */ 1746, 467, 509, 1774, 1756, 502, 6, 200, 1675, 1617,
/* 1150 */ 1647, 505, 1649, 1650, 501, 216, 522, 1567, 489, 1715, /* 1150 */ 463, 259, 1647, 505, 1649, 1650, 501, 1646, 522, 464,
/* 1160 */ 18, 1566, 211, 294, 1711, 1790, 512, 229, 507, 244, /* 1160 */ 476, 5, 1736, 203, 1755, 1675, 293, 210, 82, 1647,
/* 1170 */ 1662, 508, 303, 513, 1772, 514, 70, 503, 231, 1696, /* 1170 */ 505, 1649, 1650, 501, 1280, 522, 111, 1777, 1715, 470,
/* 1180 */ 68, 525, 1793, 1479, 247, 1451, 238, 502, 600, 1611, /* 1180 */ 208, 1185, 1714, 1711, 1348, 1662, 40, 211, 492, 1646,
/* 1190 */ 290, 1617, 47, 1773, 249, 134, 1646, 253, 251, 1610, /* 1190 */ 145, 1773, 135, 503, 1774, 1730, 295, 489, 18, 1567,
/* 1200 */ 486, 219, 260, 318, 221, 1646, 254, 1607, 1675, 493, /* 1200 */ 1793, 507, 508, 502, 1566, 512, 303, 1617, 103, 102,
/* 1210 */ 320, 80, 1647, 505, 1649, 1650, 501, 321, 522, 1153, /* 1210 */ 101, 100, 99, 98, 97, 96, 95, 1662, 216, 479,
/* 1220 */ 1154, 1715, 151, 325, 1662, 294, 1711, 1790, 1605, 327, /* 1220 */ 1696, 513, 229, 1675, 219, 500, 82, 1647, 505, 1649,
/* 1230 */ 328, 503, 1604, 1662, 329, 331, 1733, 1603, 333, 1602, /* 1230 */ 1650, 501, 514, 522, 231, 502, 1715, 69, 486, 1617,
/* 1240 */ 503, 502, 335, 1587, 152, 1617, 338, 339, 1131, 1130, /* 1240 */ 494, 1711, 1646, 493, 221, 244, 1479, 71, 112, 525,
/* 1250 */ 502, 1581, 1580, 344, 1617, 1579, 345, 1578, 1098, 1646, /* 1250 */ 1451, 247, 600, 238, 48, 1675, 134, 253, 267, 1647,
/* 1260 */ 483, 1551, 1675, 1550, 1549, 132, 1647, 505, 1649, 1650, /* 1260 */ 505, 1649, 1650, 501, 499, 522, 496, 1687, 483, 290,
/* 1270 */ 501, 1675, 522, 1548, 259, 1647, 505, 1649, 1650, 501, /* 1270 */ 1662, 260, 249, 254, 251, 1611, 1610, 318, 503, 1607,
/* 1280 */ 1547, 522, 1546, 1545, 1544, 1543, 1542, 1662, 1541, 1540, /* 1280 */ 320, 321, 1153, 1154, 151, 110, 325, 1605, 502, 327,
/* 1290 */ 1539, 1538, 1537, 1536, 503, 1535, 1534, 1533, 115, 1646, /* 1290 */ 328, 329, 1617, 1604, 331, 1603, 333, 1602, 335, 1646,
/* 1300 */ 1777, 1532, 1531, 1530, 502, 1529, 1528, 1527, 1617, 1100, /* 1300 */ 212, 1722, 478, 1587, 477, 152, 339, 1777, 1675, 338,
/* 1310 */ 1792, 1526, 1525, 145, 1524, 1409, 1377, 1774, 1646, 160, /* 1310 */ 1131, 82, 1647, 505, 1649, 1650, 501, 1581, 522, 1130,
/* 1320 */ 1376, 385, 138, 401, 930, 1675, 1595, 1662, 81, 1647, /* 1320 */ 145, 1715, 1580, 344, 1774, 345, 1712, 1662, 604, 1579,
/* 1330 */ 505, 1649, 1650, 501, 503, 522, 106, 929, 1715, 405, /* 1330 */ 1578, 1551, 1098, 1550, 1549, 503, 1548, 1547, 1546, 1545,
/* 1340 */ 1402, 107, 1714, 1711, 502, 1589, 1662, 1573, 1617, 1564, /* 1340 */ 1544, 1543, 240, 1100, 115, 502, 1646, 1542, 1541, 1617,
/* 1350 */ 1457, 161, 387, 500, 168, 1408, 1406, 958, 402, 1404, /* 1350 */ 1540, 1539, 462, 1538, 105, 1537, 1536, 1535, 1534, 1533,
/* 1360 */ 1400, 406, 410, 502, 414, 1675, 400, 1617, 81, 1647, /* 1360 */ 593, 589, 585, 581, 239, 1675, 1532, 1531, 268, 1647,
/* 1370 */ 505, 1649, 1650, 501, 1646, 522, 404, 408, 1715, 409, /* 1370 */ 505, 1649, 1650, 501, 1662, 522, 1530, 1529, 1528, 1527,
/* 1380 */ 412, 413, 494, 1711, 1675, 1389, 1388, 267, 1647, 505, /* 1380 */ 1526, 1525, 503, 1524, 1409, 1646, 1377, 138, 78, 160,
/* 1390 */ 1649, 1650, 501, 499, 522, 496, 1687, 1375, 1459, 1065, /* 1390 */ 1376, 234, 502, 1595, 1589, 1573, 1617, 106, 385, 930,
/* 1400 */ 1064, 1458, 1662, 604, 990, 989, 568, 83, 988, 503, /* 1400 */ 161, 929, 107, 1564, 1457, 387, 168, 1408, 1406, 401,
/* 1410 */ 987, 570, 1398, 984, 983, 175, 285, 240, 982, 502, /* 1410 */ 400, 958, 1675, 1662, 1404, 132, 1647, 505, 1649, 1650,
/* 1420 */ 437, 286, 1391, 1617, 1393, 287, 440, 1374, 442, 105, /* 1420 */ 501, 503, 522, 1402, 1400, 515, 402, 1389, 406, 404,
/* 1430 */ 1373, 444, 1594, 1646, 82, 593, 589, 585, 581, 239, /* 1430 */ 1388, 502, 175, 405, 410, 1617, 1646, 414, 298, 408,
/* 1440 */ 1675, 1588, 1138, 81, 1647, 505, 1649, 1650, 501, 1572, /* 1440 */ 1375, 409, 1459, 1458, 413, 412, 1398, 1064, 1065, 990,
/* 1450 */ 522, 451, 1571, 1715, 1563, 64, 196, 4, 1712, 37, /* 1450 */ 460, 1675, 989, 195, 268, 1647, 505, 1649, 1650, 501,
/* 1460 */ 15, 1662, 201, 77, 43, 207, 234, 48, 503, 1305, /* 1460 */ 1792, 522, 45, 988, 1662, 1646, 987, 568, 1393, 570,
/* 1470 */ 133, 205, 22, 41, 1298, 206, 452, 193, 502, 1637, /* 1470 */ 285, 1136, 500, 190, 286, 1391, 984, 287, 983, 1374,
/* 1480 */ 65, 198, 1617, 23, 16, 298, 1277, 1646, 1276, 213, /* 1480 */ 982, 440, 502, 437, 442, 1373, 1617, 444, 1594, 83,
/* 1490 */ 136, 308, 307, 126, 42, 1329, 1334, 17, 1323, 1675, /* 1490 */ 1588, 1138, 451, 1662, 1572, 1571, 126, 1646, 1563, 4,
/* 1500 */ 515, 1173, 268, 1647, 505, 1649, 1650, 501, 1328, 522, /* 1500 */ 65, 503, 1675, 196, 37, 267, 1647, 505, 1649, 1650,
/* 1510 */ 296, 1333, 13, 1332, 297, 1662, 10, 1646, 19, 1219, /* 1510 */ 501, 502, 522, 49, 1688, 1617, 452, 193, 300, 15,
/* 1520 */ 1240, 1218, 500, 29, 137, 460, 1166, 12, 195, 149, /* 1520 */ 201, 43, 1305, 206, 41, 1662, 1298, 133, 207, 205,
/* 1530 */ 20, 1204, 502, 504, 1562, 21, 1617, 230, 224, 1303, /* 1530 */ 22, 1675, 23, 503, 268, 1647, 505, 1649, 1650, 501,
/* 1540 */ 226, 71, 228, 1165, 1175, 1662, 1136, 510, 190, 66, /* 1540 */ 1637, 522, 1277, 502, 66, 213, 198, 1617, 1276, 42,
/* 1550 */ 1646, 232, 503, 1675, 67, 1636, 267, 1647, 505, 1649, /* 1550 */ 302, 136, 1334, 1646, 16, 17, 13, 1323, 1329, 10,
/* 1560 */ 1650, 501, 502, 522, 235, 1688, 1617, 1678, 521, 300, /* 1560 */ 1328, 19, 296, 1675, 1333, 1332, 268, 1647, 505, 1649,
/* 1570 */ 1221, 44, 524, 1051, 526, 310, 528, 530, 1662, 1048, /* 1570 */ 1650, 501, 297, 522, 1219, 137, 149, 29, 1204, 510,
/* 1580 */ 1646, 523, 531, 1675, 1045, 503, 268, 1647, 505, 1649, /* 1580 */ 1218, 1662, 12, 20, 1646, 21, 226, 1240, 1562, 503,
/* 1590 */ 1650, 501, 1169, 522, 533, 502, 1039, 534, 536, 1617, /* 1590 */ 504, 224, 230, 232, 72, 1636, 235, 1303, 1175, 502,
/* 1600 */ 1037, 537, 302, 539, 540, 1028, 1060, 1058, 1662, 1043, /* 1600 */ 1221, 228, 67, 1617, 68, 526, 1678, 521, 44, 310,
/* 1610 */ 1646, 1042, 479, 72, 1041, 503, 1675, 1040, 546, 268, /* 1610 */ 1051, 1048, 1662, 1646, 524, 528, 530, 531, 533, 1675,
/* 1620 */ 1647, 505, 1649, 1650, 501, 502, 522, 1057, 73, 1617, /* 1620 */ 503, 1045, 255, 1647, 505, 1649, 1650, 501, 534, 522,
/* 1630 */ 74, 1056, 956, 555, 997, 1174, 557, 237, 1662, 978, /* 1630 */ 502, 1039, 536, 537, 1617, 1037, 539, 1043, 1042, 540,
/* 1640 */ 112, 977, 976, 973, 975, 503, 1675, 974, 972, 255, /* 1640 */ 1041, 1662, 1040, 1028, 73, 74, 1060, 75, 1057, 503,
/* 1650 */ 1647, 505, 1649, 1650, 501, 502, 522, 1177, 971, 1617, /* 1650 */ 1675, 1056, 546, 262, 1647, 505, 1649, 1650, 501, 502,
/* 1660 */ 483, 1646, 994, 992, 968, 967, 966, 963, 520, 1224, /* 1660 */ 522, 956, 1646, 1617, 555, 557, 237, 997, 308, 307,
/* 1670 */ 1225, 962, 961, 1405, 578, 579, 1675, 1646, 110, 262, /* 1670 */ 978, 977, 973, 1646, 1058, 976, 994, 975, 1173, 1675,
/* 1680 */ 1647, 505, 1649, 1650, 501, 580, 522, 1403, 582, 1662, /* 1680 */ 974, 972, 264, 1647, 505, 1649, 1650, 501, 971, 522,
/* 1690 */ 583, 584, 1401, 212, 1722, 478, 503, 477, 586, 588, /* 1690 */ 1662, 992, 968, 967, 966, 963, 962, 1405, 503, 961,
/* 1700 */ 1777, 1399, 587, 591, 592, 1662, 502, 590, 1387, 595, /* 1700 */ 578, 1662, 579, 1166, 580, 1403, 582, 583, 502, 503,
/* 1710 */ 1617, 594, 503, 145, 1386, 1372, 598, 1774, 599, 1347, /* 1710 */ 584, 1401, 1617, 586, 587, 588, 1399, 590, 592, 502,
/* 1720 */ 1161, 248, 502, 602, 1646, 603, 1617, 1675, 1347, 1347, /* 1720 */ 1165, 591, 1387, 1617, 1646, 1386, 594, 1372, 1675, 595,
/* 1730 */ 264, 1647, 505, 1649, 1650, 501, 1347, 522, 1347, 1347, /* 1730 */ 598, 256, 1647, 505, 1649, 1650, 501, 1161, 522, 1675,
/* 1740 */ 1347, 1347, 1646, 1675, 1347, 1347, 256, 1647, 505, 1649, /* 1740 */ 599, 603, 265, 1647, 505, 1649, 1650, 501, 248, 522,
/* 1750 */ 1650, 501, 1662, 522, 1347, 1347, 1347, 1646, 1347, 503, /* 1750 */ 602, 1347, 1662, 1646, 1347, 1347, 1347, 1347, 523, 1347,
/* 1760 */ 1347, 1347, 1347, 1347, 1347, 1347, 1347, 1347, 1347, 502, /* 1760 */ 503, 1347, 1347, 1347, 1347, 1347, 1347, 1347, 1347, 1169,
/* 1770 */ 1662, 1347, 1347, 1617, 1347, 1347, 1347, 503, 1347, 1347, /* 1770 */ 502, 1347, 1347, 1347, 1617, 1347, 1347, 1347, 1347, 1347,
/* 1780 */ 1347, 1347, 1347, 1347, 1347, 1662, 1347, 502, 1347, 1347, /* 1780 */ 1347, 1662, 1347, 1347, 1347, 1646, 1347, 1347, 1347, 503,
/* 1790 */ 1675, 1617, 503, 265, 1647, 505, 1649, 1650, 501, 1347, /* 1790 */ 1675, 1347, 1347, 257, 1647, 505, 1649, 1650, 501, 502,
/* 1800 */ 522, 1347, 502, 1347, 1646, 1347, 1617, 1347, 1675, 1347, /* 1800 */ 522, 1347, 1347, 1617, 1347, 1347, 1347, 1347, 1347, 1347,
/* 1810 */ 1347, 257, 1647, 505, 1649, 1650, 501, 1347, 522, 1347, /* 1810 */ 1347, 1347, 1174, 1662, 1347, 1347, 1347, 1347, 1347, 1675,
/* 1820 */ 1646, 1347, 1347, 1675, 1347, 1347, 266, 1647, 505, 1649, /* 1820 */ 1347, 503, 266, 1647, 505, 1649, 1650, 501, 1347, 522,
/* 1830 */ 1650, 501, 1662, 522, 1347, 1347, 1347, 1347, 1347, 503, /* 1830 */ 1347, 502, 1347, 1347, 1177, 1617, 1347, 1347, 1347, 1347,
/* 1840 */ 1347, 1347, 1347, 1347, 1347, 1347, 1347, 1347, 1662, 502, /* 1840 */ 1347, 1646, 1347, 1347, 1347, 520, 1224, 1225, 1347, 1347,
/* 1850 */ 1347, 1347, 1347, 1617, 1347, 503, 1347, 1347, 1347, 1347, /* 1850 */ 1347, 1675, 1347, 1347, 258, 1647, 505, 1649, 1650, 501,
/* 1860 */ 1347, 1347, 1347, 1347, 1347, 502, 1347, 1646, 1347, 1617, /* 1860 */ 1347, 522, 1347, 1347, 1347, 1347, 1347, 1347, 1347, 1662,
/* 1870 */ 1675, 1347, 1347, 258, 1647, 505, 1649, 1650, 501, 1347, /* 1870 */ 1347, 1347, 1646, 1347, 1347, 1347, 1347, 503, 1347, 1347,
/* 1880 */ 522, 1347, 1347, 1347, 1347, 1347, 1675, 1347, 1347, 1658, /* 1880 */ 1347, 1347, 1347, 1347, 1347, 1347, 1347, 502, 1347, 1347,
/* 1890 */ 1647, 505, 1649, 1650, 501, 1662, 522, 1646, 1347, 1347, /* 1890 */ 1347, 1617, 1347, 1347, 1347, 1347, 1347, 1347, 1347, 1347,
/* 1900 */ 1347, 1347, 503, 1347, 1347, 1347, 1347, 1347, 1347, 1347, /* 1900 */ 1662, 1646, 1347, 1347, 1347, 1347, 1347, 1675, 503, 1347,
/* 1910 */ 1347, 1347, 502, 1347, 1347, 1347, 1617, 1347, 1347, 1347, /* 1910 */ 1658, 1647, 505, 1649, 1650, 501, 1347, 522, 502, 1347,
/* 1920 */ 1347, 1347, 1347, 1347, 1347, 1662, 1347, 1347, 1347, 1347, /* 1920 */ 1347, 1347, 1617, 1347, 1347, 1347, 1347, 1347, 1347, 1662,
/* 1930 */ 1347, 1347, 503, 1675, 1347, 1347, 1657, 1647, 505, 1649, /* 1930 */ 1347, 1347, 1646, 1347, 1347, 1347, 1347, 503, 1675, 1347,
/* 1940 */ 1650, 501, 502, 522, 1347, 1347, 1617, 1646, 1347, 1347, /* 1940 */ 1347, 1657, 1647, 505, 1649, 1650, 501, 502, 522, 1347,
/* 1950 */ 1347, 1347, 1347, 1347, 1347, 1347, 1347, 1347, 1347, 1347, /* 1950 */ 1347, 1617, 1347, 1347, 1347, 1347, 1347, 1347, 1347, 1347,
/* 1960 */ 1347, 1347, 1347, 1675, 1347, 1347, 1656, 1647, 505, 1649, /* 1960 */ 1662, 1646, 1347, 1347, 1347, 1347, 1347, 1675, 503, 1347,
/* 1970 */ 1650, 501, 1347, 522, 1347, 1662, 1347, 1646, 1347, 1347, /* 1970 */ 1656, 1647, 505, 1649, 1650, 501, 1347, 522, 502, 1347,
/* 1980 */ 1347, 1347, 503, 1347, 1347, 1347, 1347, 1347, 1347, 1347, /* 1980 */ 1347, 1347, 1617, 1347, 1347, 1347, 1347, 1347, 1347, 1662,
/* 1990 */ 1347, 1347, 502, 1347, 1347, 1347, 1617, 1347, 1347, 1347, /* 1990 */ 1347, 1347, 1347, 1347, 1347, 1347, 1347, 503, 1675, 1347,
/* 2000 */ 1347, 1347, 1347, 1347, 1347, 1662, 1347, 1347, 1347, 1347, /* 2000 */ 1347, 277, 1647, 505, 1649, 1650, 501, 502, 522, 1347,
/* 2010 */ 1347, 1347, 503, 1675, 1347, 1347, 277, 1647, 505, 1649, /* 2010 */ 1347, 1617, 1646, 1347, 1347, 1347, 1347, 1347, 1347, 1347,
/* 2020 */ 1650, 501, 502, 522, 1347, 1347, 1617, 1646, 1347, 1347, /* 2020 */ 1347, 1347, 1347, 1646, 1347, 1347, 1347, 1675, 1347, 1347,
/* 2030 */ 1347, 1347, 1347, 1347, 1347, 1347, 1646, 1347, 1347, 1347, /* 2030 */ 276, 1647, 505, 1649, 1650, 501, 1347, 522, 1347, 1347,
/* 2040 */ 1347, 1347, 1347, 1675, 1347, 1347, 276, 1647, 505, 1649, /* 2040 */ 1662, 1347, 1347, 1347, 1347, 1347, 1347, 1347, 503, 1347,
/* 2050 */ 1650, 501, 1347, 522, 1347, 1662, 1347, 1347, 1347, 1347, /* 2050 */ 1347, 1662, 1347, 1347, 1347, 1347, 1347, 1347, 502, 503,
/* 2060 */ 1347, 1347, 503, 1347, 1662, 1347, 1347, 1347, 1347, 1347, /* 2060 */ 1347, 1347, 1617, 1347, 1347, 1347, 1347, 1347, 1347, 502,
/* 2070 */ 1347, 503, 502, 1347, 1347, 1347, 1617, 1347, 1347, 1347, /* 2070 */ 1347, 1347, 1347, 1617, 1347, 1347, 1347, 1646, 1675, 1347,
/* 2080 */ 1347, 502, 1347, 1347, 1347, 1617, 1347, 1347, 1347, 1347, /* 2080 */ 1347, 278, 1647, 505, 1649, 1650, 501, 1347, 522, 1675,
/* 2090 */ 1646, 1347, 1347, 1675, 1347, 1347, 278, 1647, 505, 1649, /* 2090 */ 1347, 1347, 275, 1647, 505, 1649, 1650, 501, 1347, 522,
/* 2100 */ 1650, 501, 1675, 522, 1347, 275, 1647, 505, 1649, 1650, /* 2100 */ 1347, 1347, 1347, 1347, 1347, 1662, 1347, 1347, 1347, 1347,
/* 2110 */ 501, 1347, 522, 1347, 1347, 1347, 1347, 1347, 1662, 1347, /* 2110 */ 1347, 1347, 1347, 503, 1347, 1347, 1347, 1347, 1347, 1347,
/* 2120 */ 1347, 1347, 1347, 1347, 1347, 503, 1347, 1347, 1347, 1347, /* 2120 */ 1347, 1347, 1347, 502, 1347, 1347, 1347, 1617, 1347, 1347,
/* 2130 */ 1347, 1347, 1347, 1347, 1347, 502, 1347, 1347, 1347, 1617, /* 2130 */ 1347, 1347, 1347, 1347, 1347, 1347, 1347, 1347, 1347, 1347,
/* 2140 */ 1347, 1347, 1347, 1347, 1347, 1347, 1347, 1347, 1347, 1347, /* 2140 */ 1347, 1347, 1347, 1675, 1347, 1347, 261, 1647, 505, 1649,
/* 2150 */ 1347, 1347, 1347, 1347, 1347, 1347, 1675, 1347, 1347, 261, /* 2150 */ 1650, 501, 1347, 522,
/* 2160 */ 1647, 505, 1649, 1650, 501, 1347, 522,
}; };
static const YYCODETYPE yy_lookahead[] = { static const YYCODETYPE yy_lookahead[] = {
/* 0 */ 244, 251, 246, 247, 244, 248, 246, 247, 290, 321, /* 0 */ 270, 336, 336, 241, 244, 271, 246, 247, 274, 1,
/* 10 */ 322, 270, 12, 13, 264, 270, 296, 260, 241, 336, /* 10 */ 2, 297, 12, 13, 349, 349, 2, 4, 353, 353,
/* 20 */ 20, 271, 22, 305, 306, 307, 12, 13, 14, 15, /* 20 */ 20, 244, 22, 246, 247, 291, 12, 13, 14, 15,
/* 30 */ 16, 308, 349, 276, 21, 317, 353, 24, 25, 26, /* 30 */ 16, 269, 2, 12, 13, 14, 15, 16, 20, 277,
/* 40 */ 27, 28, 29, 30, 31, 32, 269, 47, 269, 273, /* 40 */ 306, 307, 12, 13, 14, 15, 16, 47, 238, 287,
/* 50 */ 14, 15, 16, 276, 275, 332, 336, 248, 58, 280, /* 50 */ 336, 317, 240, 291, 242, 42, 43, 20, 58, 297,
/* 60 */ 12, 13, 14, 286, 64, 20, 290, 290, 20, 349, /* 60 */ 12, 13, 14, 349, 64, 321, 322, 353, 20, 307,
/* 70 */ 22, 248, 58, 353, 57, 12, 13, 14, 15, 16, /* 70 */ 22, 248, 310, 311, 312, 313, 314, 315, 251, 317,
/* 80 */ 80, 305, 306, 307, 307, 276, 2, 310, 311, 312, /* 80 */ 80, 253, 320, 336, 20, 248, 324, 325, 20, 81,
/* 90 */ 313, 314, 315, 317, 317, 47, 12, 13, 14, 15, /* 90 */ 271, 264, 57, 274, 266, 47, 349, 260, 336, 272,
/* 100 */ 16, 253, 102, 89, 281, 296, 58, 248, 12, 13, /* 100 */ 353, 241, 102, 275, 267, 282, 58, 297, 12, 13,
/* 110 */ 249, 250, 64, 113, 266, 20, 20, 261, 22, 260, /* 110 */ 291, 349, 64, 113, 277, 353, 20, 80, 22, 12,
/* 120 */ 20, 58, 274, 314, 22, 269, 267, 240, 80, 242, /* 120 */ 13, 14, 15, 16, 14, 306, 307, 4, 80, 269,
/* 130 */ 80, 354, 355, 277, 336, 276, 248, 251, 329, 330, /* 130 */ 20, 12, 13, 14, 15, 16, 317, 277, 12, 13,
/* 140 */ 331, 0, 333, 47, 81, 336, 336, 349, 260, 47, /* 140 */ 14, 15, 16, 47, 80, 269, 336, 287, 80, 254,
/* 150 */ 102, 353, 89, 139, 58, 267, 156, 271, 349, 349, /* 150 */ 102, 291, 276, 258, 58, 241, 156, 281, 269, 349,
/* 160 */ 64, 113, 353, 353, 276, 24, 25, 26, 27, 28, /* 160 */ 64, 113, 257, 353, 259, 58, 277, 307, 268, 148,
/* 170 */ 29, 30, 31, 32, 160, 80, 80, 92, 178, 179, /* 170 */ 310, 311, 312, 313, 314, 315, 80, 317, 178, 179,
/* 180 */ 80, 181, 182, 183, 184, 185, 186, 187, 188, 189, /* 180 */ 280, 181, 182, 183, 184, 185, 186, 187, 188, 189,
/* 190 */ 190, 191, 192, 193, 194, 195, 111, 112, 102, 114, /* 190 */ 190, 191, 192, 193, 194, 195, 89, 0, 102, 248,
/* 200 */ 115, 116, 139, 58, 156, 155, 178, 157, 208, 113, /* 200 */ 81, 312, 20, 80, 156, 291, 0, 81, 208, 113,
/* 210 */ 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, /* 210 */ 20, 260, 297, 21, 354, 355, 24, 25, 26, 27,
/* 220 */ 254, 20, 286, 160, 258, 289, 178, 179, 292, 181, /* 220 */ 28, 29, 30, 31, 32, 308, 178, 179, 277, 181,
/* 230 */ 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, /* 230 */ 182, 183, 184, 185, 186, 187, 188, 189, 190, 191,
/* 240 */ 192, 193, 194, 195, 0, 217, 218, 219, 220, 221, /* 240 */ 192, 193, 194, 195, 0, 208, 139, 248, 269, 332,
/* 250 */ 4, 80, 156, 12, 13, 14, 15, 16, 208, 196, /* 250 */ 229, 336, 156, 249, 250, 276, 178, 60, 61, 80,
/* 260 */ 197, 198, 199, 200, 201, 202, 203, 204, 205, 165, /* 260 */ 281, 269, 65, 57, 349, 68, 69, 160, 353, 72,
/* 270 */ 166, 248, 4, 169, 178, 179, 238, 181, 182, 183, /* 270 */ 73, 74, 208, 281, 178, 179, 277, 181, 182, 183,
/* 280 */ 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, /* 280 */ 184, 185, 186, 187, 188, 189, 190, 191, 192, 193,
/* 290 */ 194, 195, 12, 13, 12, 13, 14, 15, 16, 276, /* 290 */ 194, 195, 12, 13, 0, 217, 218, 219, 220, 221,
/* 300 */ 20, 0, 22, 208, 60, 61, 62, 63, 208, 65, /* 300 */ 20, 57, 22, 196, 197, 198, 199, 200, 201, 202,
/* 310 */ 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, /* 310 */ 203, 204, 205, 314, 22, 21, 253, 271, 24, 25,
/* 320 */ 76, 77, 81, 178, 269, 278, 80, 47, 47, 269, /* 320 */ 26, 27, 28, 29, 30, 31, 32, 47, 329, 330,
/* 330 */ 275, 241, 285, 286, 296, 280, 276, 314, 268, 261, /* 330 */ 331, 208, 333, 248, 20, 248, 248, 291, 275, 47,
/* 340 */ 12, 13, 14, 20, 64, 64, 4, 269, 20, 279, /* 340 */ 12, 13, 14, 287, 64, 260, 290, 260, 20, 293,
/* 350 */ 22, 328, 329, 330, 331, 277, 333, 2, 57, 269, /* 350 */ 22, 80, 306, 307, 267, 12, 13, 14, 15, 16,
/* 360 */ 80, 12, 13, 14, 15, 16, 276, 12, 13, 14, /* 360 */ 80, 248, 277, 317, 277, 277, 12, 13, 14, 15,
/* 370 */ 15, 16, 312, 143, 336, 47, 286, 0, 261, 208, /* 370 */ 16, 277, 60, 61, 271, 47, 55, 65, 284, 241,
/* 380 */ 290, 57, 102, 293, 42, 43, 269, 349, 12, 13, /* 380 */ 68, 69, 102, 248, 72, 73, 74, 208, 12, 13,
/* 390 */ 151, 353, 64, 113, 277, 20, 20, 307, 22, 3, /* 390 */ 277, 57, 64, 113, 291, 260, 20, 261, 22, 269,
/* 400 */ 310, 311, 312, 313, 314, 315, 245, 317, 80, 248, /* 400 */ 79, 58, 314, 82, 20, 269, 276, 269, 80, 306,
/* 410 */ 171, 172, 93, 94, 95, 96, 97, 98, 99, 100, /* 410 */ 307, 281, 277, 20, 278, 277, 328, 329, 330, 331,
/* 420 */ 101, 102, 103, 47, 105, 106, 107, 108, 109, 110, /* 420 */ 317, 333, 143, 47, 81, 287, 155, 314, 157, 291,
/* 430 */ 102, 12, 13, 14, 15, 16, 156, 60, 61, 91, /* 430 */ 102, 279, 89, 165, 166, 0, 156, 169, 286, 287,
/* 440 */ 64, 113, 65, 213, 214, 68, 69, 0, 248, 72, /* 440 */ 64, 113, 329, 330, 331, 307, 333, 91, 310, 311,
/* 450 */ 73, 74, 20, 241, 208, 80, 80, 308, 178, 179, /* 450 */ 312, 313, 314, 315, 241, 317, 80, 22, 178, 179,
/* 460 */ 260, 181, 182, 183, 184, 185, 186, 187, 188, 189, /* 460 */ 151, 181, 182, 183, 184, 185, 186, 187, 188, 189,
/* 470 */ 190, 191, 192, 193, 194, 195, 276, 209, 102, 14, /* 470 */ 190, 191, 192, 193, 194, 195, 35, 261, 102, 208,
/* 480 */ 14, 332, 60, 61, 156, 20, 20, 65, 208, 113, /* 480 */ 171, 172, 139, 79, 156, 269, 348, 248, 208, 113,
/* 490 */ 68, 69, 269, 296, 72, 73, 74, 148, 275, 44, /* 490 */ 75, 87, 213, 214, 278, 270, 248, 12, 13, 14,
/* 500 */ 81, 22, 290, 280, 57, 248, 178, 179, 273, 181, /* 500 */ 15, 16, 241, 160, 291, 270, 178, 179, 260, 181,
/* 510 */ 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, /* 510 */ 182, 183, 184, 185, 186, 187, 188, 189, 190, 191,
/* 520 */ 192, 193, 194, 195, 55, 290, 47, 12, 13, 14, /* 520 */ 192, 193, 194, 195, 83, 277, 85, 86, 241, 88,
/* 530 */ 15, 16, 156, 336, 245, 80, 269, 248, 14, 241, /* 530 */ 64, 14, 156, 92, 119, 120, 297, 20, 145, 196,
/* 540 */ 305, 306, 307, 64, 20, 75, 349, 280, 79, 241, /* 540 */ 197, 198, 199, 200, 201, 202, 203, 204, 205, 241,
/* 550 */ 353, 82, 317, 296, 178, 179, 241, 181, 182, 183, /* 550 */ 245, 147, 291, 248, 178, 179, 115, 181, 182, 183,
/* 560 */ 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, /* 560 */ 184, 185, 186, 187, 188, 189, 190, 191, 192, 193,
/* 570 */ 194, 195, 12, 13, 18, 248, 20, 145, 229, 253, /* 570 */ 194, 195, 12, 13, 18, 336, 20, 269, 291, 248,
/* 580 */ 20, 102, 22, 27, 269, 248, 30, 260, 290, 119, /* 580 */ 20, 261, 22, 27, 139, 277, 30, 270, 349, 269,
/* 590 */ 120, 276, 113, 336, 269, 241, 33, 260, 290, 308, /* 590 */ 92, 260, 353, 245, 92, 287, 248, 14, 278, 291,
/* 600 */ 274, 286, 277, 276, 48, 290, 349, 47, 45, 248, /* 600 */ 20, 3, 22, 20, 48, 160, 251, 47, 277, 111,
/* 610 */ 353, 296, 241, 276, 51, 52, 53, 54, 55, 35, /* 610 */ 112, 241, 114, 115, 116, 307, 241, 115, 310, 311,
/* 620 */ 224, 260, 307, 332, 64, 310, 311, 312, 313, 314, /* 620 */ 312, 313, 314, 315, 64, 317, 241, 272, 320, 49,
/* 630 */ 315, 248, 317, 79, 20, 156, 22, 276, 248, 21, /* 630 */ 145, 20, 324, 325, 326, 0, 14, 15, 16, 270,
/* 640 */ 80, 87, 79, 260, 290, 82, 241, 182, 182, 1, /* 640 */ 80, 196, 93, 94, 95, 96, 97, 98, 99, 100,
/* 650 */ 2, 336, 34, 241, 255, 256, 37, 178, 179, 276, /* 650 */ 101, 102, 103, 345, 105, 106, 107, 108, 109, 110,
/* 660 */ 145, 290, 102, 49, 349, 241, 276, 83, 353, 85, /* 660 */ 270, 291, 102, 241, 241, 241, 291, 241, 241, 241,
/* 670 */ 86, 20, 88, 113, 118, 241, 92, 121, 122, 123, /* 670 */ 241, 241, 241, 113, 118, 241, 291, 121, 122, 123,
/* 680 */ 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, /* 680 */ 124, 125, 126, 127, 128, 129, 130, 131, 132, 133,
/* 690 */ 134, 135, 136, 137, 138, 290, 20, 248, 248, 115, /* 690 */ 134, 135, 136, 137, 138, 60, 61, 62, 63, 182,
/* 700 */ 248, 147, 290, 140, 314, 142, 0, 144, 248, 260, /* 700 */ 65, 66, 67, 68, 69, 70, 71, 72, 73, 74,
/* 710 */ 260, 20, 260, 139, 290, 241, 156, 241, 241, 329, /* 710 */ 75, 76, 77, 291, 291, 291, 156, 291, 291, 291,
/* 720 */ 330, 331, 41, 333, 290, 276, 276, 164, 276, 81, /* 720 */ 291, 291, 291, 241, 37, 291, 269, 241, 255, 256,
/* 730 */ 241, 241, 241, 241, 160, 41, 276, 241, 178, 179, /* 730 */ 241, 255, 256, 286, 287, 278, 42, 43, 178, 179,
/* 740 */ 20, 181, 182, 183, 184, 185, 186, 187, 188, 189, /* 740 */ 308, 181, 182, 183, 184, 185, 186, 187, 188, 189,
/* 750 */ 190, 191, 192, 193, 194, 195, 248, 262, 269, 248, /* 750 */ 190, 191, 192, 193, 194, 195, 145, 18, 269, 248,
/* 760 */ 265, 241, 241, 241, 290, 276, 290, 290, 260, 276, /* 760 */ 4, 241, 23, 308, 332, 182, 277, 47, 22, 248,
/* 770 */ 196, 260, 255, 256, 314, 286, 283, 42, 43, 290, /* 770 */ 20, 260, 0, 291, 35, 36, 287, 291, 39, 287,
/* 780 */ 290, 290, 290, 241, 276, 296, 290, 276, 286, 329, /* 780 */ 291, 260, 206, 207, 64, 293, 297, 332, 277, 269,
/* 790 */ 330, 331, 0, 333, 292, 257, 307, 259, 92, 310, /* 790 */ 167, 168, 41, 47, 248, 56, 307, 277, 277, 310,
/* 800 */ 311, 312, 313, 314, 315, 241, 317, 92, 41, 320, /* 800 */ 311, 312, 313, 314, 315, 262, 317, 287, 265, 320,
/* 810 */ 290, 290, 290, 324, 325, 285, 286, 111, 112, 0, /* 810 */ 64, 291, 248, 324, 325, 41, 300, 45, 84, 80,
/* 820 */ 114, 115, 116, 206, 207, 336, 207, 64, 84, 0, /* 820 */ 47, 87, 224, 277, 260, 336, 84, 307, 41, 87,
/* 830 */ 115, 87, 290, 269, 167, 168, 145, 45, 349, 270, /* 830 */ 310, 311, 312, 313, 314, 315, 44, 317, 349, 248,
/* 840 */ 276, 22, 353, 84, 18, 0, 87, 270, 81, 23, /* 840 */ 320, 277, 353, 297, 324, 325, 326, 84, 102, 84,
/* 850 */ 286, 22, 84, 84, 290, 87, 87, 41, 182, 41, /* 850 */ 87, 260, 87, 21, 58, 81, 117, 241, 338, 113,
/* 860 */ 296, 35, 36, 145, 146, 39, 241, 22, 41, 1, /* 860 */ 314, 248, 248, 270, 344, 345, 34, 47, 277, 145,
/* 870 */ 2, 307, 193, 194, 310, 311, 312, 313, 314, 315, /* 870 */ 146, 41, 80, 260, 260, 329, 330, 331, 0, 333,
/* 880 */ 4, 317, 56, 41, 320, 41, 270, 41, 324, 325, /* 880 */ 1, 2, 336, 0, 64, 269, 113, 148, 149, 150,
/* 890 */ 41, 270, 80, 41, 269, 19, 270, 81, 299, 81, /* 890 */ 277, 277, 153, 277, 207, 349, 242, 158, 41, 353,
/* 900 */ 336, 276, 90, 242, 41, 47, 80, 226, 81, 33, /* 900 */ 22, 47, 156, 287, 41, 22, 41, 291, 258, 170,
/* 910 */ 258, 286, 41, 349, 47, 290, 0, 353, 356, 241, /* 910 */ 41, 81, 173, 41, 175, 176, 177, 41, 193, 194,
/* 920 */ 41, 45, 228, 81, 341, 81, 50, 81, 347, 269, /* 920 */ 241, 0, 41, 307, 178, 179, 310, 311, 312, 313,
/* 930 */ 81, 55, 307, 81, 303, 310, 311, 312, 313, 314, /* 930 */ 314, 315, 182, 317, 356, 41, 320, 347, 81, 80,
/* 940 */ 315, 41, 317, 117, 81, 320, 41, 269, 247, 324, /* 940 */ 324, 325, 326, 304, 81, 41, 81, 208, 269, 90,
/* 950 */ 325, 326, 81, 249, 276, 79, 279, 334, 82, 309, /* 950 */ 81, 335, 269, 81, 247, 41, 277, 81, 41, 341,
/* 960 */ 81, 350, 350, 338, 286, 41, 337, 20, 290, 344, /* 960 */ 249, 33, 81, 334, 280, 209, 287, 113, 309, 350,
/* 970 */ 345, 113, 241, 41, 148, 149, 150, 350, 41, 153, /* 970 */ 291, 41, 241, 45, 178, 81, 350, 226, 350, 51,
/* 980 */ 113, 81, 248, 45, 158, 307, 81, 47, 310, 311, /* 980 */ 52, 53, 54, 55, 41, 81, 307, 41, 41, 310,
/* 990 */ 312, 313, 314, 315, 304, 317, 170, 47, 255, 173, /* 990 */ 311, 312, 313, 314, 315, 81, 317, 0, 81, 320,
/* 1000 */ 269, 175, 176, 177, 64, 81, 297, 276, 92, 154, /* 1000 */ 269, 337, 20, 324, 325, 326, 248, 79, 277, 45,
/* 1010 */ 248, 40, 248, 81, 284, 282, 139, 286, 81, 282, /* 1010 */ 82, 81, 47, 92, 335, 228, 255, 305, 287, 298,
/* 1020 */ 248, 290, 20, 243, 243, 20, 348, 111, 112, 301, /* 1020 */ 154, 40, 291, 248, 81, 248, 285, 81, 81, 139,
/* 1030 */ 114, 115, 116, 286, 208, 253, 253, 20, 307, 0, /* 1030 */ 283, 241, 111, 112, 248, 114, 115, 116, 307, 20,
/* 1040 */ 294, 310, 311, 312, 313, 314, 315, 241, 317, 253, /* 1040 */ 283, 310, 311, 312, 313, 314, 315, 4, 317, 243,
/* 1050 */ 276, 320, 20, 287, 253, 324, 325, 326, 253, 248, /* 1050 */ 243, 320, 20, 253, 302, 324, 325, 326, 287, 269,
/* 1060 */ 21, 253, 269, 24, 25, 26, 27, 28, 29, 30, /* 1060 */ 20, 253, 19, 295, 253, 277, 335, 277, 140, 20,
/* 1070 */ 31, 32, 269, 243, 243, 269, 345, 64, 269, 269, /* 1070 */ 142, 288, 144, 248, 253, 253, 33, 287, 243, 253,
/* 1080 */ 241, 248, 276, 269, 269, 290, 269, 301, 251, 269, /* 1080 */ 64, 291, 241, 269, 269, 269, 269, 297, 45, 92,
/* 1090 */ 269, 269, 286, 269, 163, 20, 290, 300, 251, 286, /* 1090 */ 248, 302, 164, 50, 243, 291, 269, 307, 55, 241,
/* 1100 */ 309, 294, 251, 216, 276, 251, 346, 215, 269, 223, /* 1100 */ 310, 311, 312, 313, 314, 315, 269, 317, 111, 112,
/* 1110 */ 287, 346, 222, 307, 343, 276, 310, 311, 312, 313, /* 1110 */ 269, 114, 115, 116, 269, 269, 269, 269, 277, 269,
/* 1120 */ 314, 315, 290, 317, 290, 286, 320, 291, 290, 290, /* 1120 */ 163, 251, 79, 287, 301, 82, 336, 269, 287, 295,
/* 1130 */ 324, 325, 326, 211, 291, 210, 342, 207, 340, 339, /* 1130 */ 277, 251, 291, 251, 20, 277, 251, 288, 297, 349,
/* 1140 */ 276, 335, 241, 20, 40, 227, 307, 230, 308, 310, /* 1140 */ 309, 216, 215, 353, 346, 287, 223, 292, 307, 291,
/* 1150 */ 311, 312, 313, 314, 315, 351, 317, 291, 225, 320, /* 1150 */ 211, 310, 311, 312, 313, 314, 315, 241, 317, 291,
/* 1160 */ 80, 291, 327, 324, 325, 326, 142, 276, 290, 265, /* 1160 */ 222, 210, 343, 292, 346, 307, 291, 339, 310, 311,
/* 1170 */ 269, 290, 290, 288, 335, 287, 80, 276, 251, 323, /* 1170 */ 312, 313, 314, 315, 207, 317, 277, 336, 320, 291,
/* 1180 */ 251, 272, 357, 276, 248, 259, 251, 286, 243, 0, /* 1180 */ 342, 20, 324, 325, 0, 269, 40, 327, 227, 241,
/* 1190 */ 295, 290, 298, 352, 252, 302, 241, 263, 239, 0, /* 1190 */ 349, 352, 340, 277, 353, 308, 230, 225, 80, 292,
/* 1200 */ 352, 351, 263, 72, 351, 241, 263, 0, 307, 352, /* 1200 */ 357, 291, 291, 287, 292, 142, 291, 291, 24, 25,
/* 1210 */ 47, 310, 311, 312, 313, 314, 315, 174, 317, 47, /* 1210 */ 26, 27, 28, 29, 30, 31, 32, 269, 351, 248,
/* 1220 */ 47, 320, 47, 174, 269, 324, 325, 326, 0, 47, /* 1220 */ 323, 289, 277, 307, 351, 277, 310, 311, 312, 313,
/* 1230 */ 47, 276, 0, 269, 174, 47, 335, 0, 47, 0, /* 1230 */ 314, 315, 288, 317, 251, 287, 320, 251, 352, 291,
/* 1240 */ 276, 286, 47, 0, 80, 290, 160, 159, 113, 156, /* 1240 */ 324, 325, 241, 352, 351, 265, 277, 80, 277, 273,
/* 1250 */ 286, 0, 0, 152, 290, 0, 151, 0, 44, 241, /* 1250 */ 259, 248, 243, 251, 299, 307, 303, 263, 310, 311,
/* 1260 */ 296, 0, 307, 0, 0, 310, 311, 312, 313, 314, /* 1260 */ 312, 313, 314, 315, 316, 317, 318, 319, 297, 296,
/* 1270 */ 315, 307, 317, 0, 310, 311, 312, 313, 314, 315, /* 1270 */ 269, 263, 252, 263, 239, 0, 0, 72, 277, 0,
/* 1280 */ 0, 317, 0, 0, 0, 0, 0, 269, 0, 0, /* 1280 */ 47, 174, 47, 47, 47, 314, 174, 0, 287, 47,
/* 1290 */ 0, 0, 0, 0, 276, 0, 0, 0, 40, 241, /* 1290 */ 47, 174, 291, 0, 47, 0, 47, 0, 47, 241,
/* 1300 */ 336, 0, 0, 0, 286, 0, 0, 0, 290, 22, /* 1300 */ 329, 330, 331, 0, 333, 80, 159, 336, 307, 160,
/* 1310 */ 355, 0, 0, 349, 0, 0, 0, 353, 241, 40, /* 1310 */ 113, 310, 311, 312, 313, 314, 315, 0, 317, 156,
/* 1320 */ 0, 44, 41, 45, 14, 307, 0, 269, 310, 311, /* 1320 */ 349, 320, 0, 152, 353, 151, 325, 269, 19, 0,
/* 1330 */ 312, 313, 314, 315, 276, 317, 37, 14, 320, 45, /* 1330 */ 0, 0, 44, 0, 0, 277, 0, 0, 0, 0,
/* 1340 */ 0, 37, 324, 325, 286, 0, 269, 0, 290, 0, /* 1340 */ 0, 0, 33, 22, 40, 287, 241, 0, 0, 291,
/* 1350 */ 0, 38, 44, 276, 37, 0, 0, 59, 37, 0, /* 1350 */ 0, 0, 294, 0, 45, 0, 0, 0, 0, 0,
/* 1360 */ 0, 37, 37, 286, 37, 307, 47, 290, 310, 311, /* 1360 */ 51, 52, 53, 54, 55, 307, 0, 0, 310, 311,
/* 1370 */ 312, 313, 314, 315, 241, 317, 47, 47, 320, 45, /* 1370 */ 312, 313, 314, 315, 269, 317, 0, 0, 0, 0,
/* 1380 */ 47, 45, 324, 325, 307, 0, 0, 310, 311, 312, /* 1380 */ 0, 0, 277, 0, 0, 241, 0, 41, 79, 40,
/* 1390 */ 313, 314, 315, 316, 317, 318, 319, 0, 0, 47, /* 1390 */ 0, 82, 287, 0, 0, 0, 291, 37, 44, 14,
/* 1400 */ 22, 0, 269, 19, 47, 47, 41, 89, 47, 276, /* 1400 */ 38, 14, 37, 0, 0, 44, 37, 0, 0, 45,
/* 1410 */ 47, 41, 0, 47, 47, 87, 22, 33, 47, 286, /* 1410 */ 47, 59, 307, 269, 0, 310, 311, 312, 313, 314,
/* 1420 */ 48, 22, 0, 290, 0, 22, 47, 0, 22, 45, /* 1420 */ 315, 277, 317, 0, 0, 116, 37, 0, 37, 47,
/* 1430 */ 0, 22, 0, 241, 20, 51, 52, 53, 54, 55, /* 1430 */ 0, 287, 87, 45, 37, 291, 241, 37, 294, 47,
/* 1440 */ 307, 0, 47, 310, 311, 312, 313, 314, 315, 0, /* 1440 */ 0, 45, 0, 0, 45, 47, 0, 22, 47, 47,
/* 1450 */ 317, 22, 0, 320, 0, 80, 37, 41, 325, 41, /* 1450 */ 141, 307, 47, 144, 310, 311, 312, 313, 314, 315,
/* 1460 */ 212, 269, 81, 79, 41, 44, 82, 145, 276, 81, /* 1460 */ 355, 317, 89, 47, 269, 241, 47, 41, 0, 41,
/* 1470 */ 80, 80, 80, 206, 81, 41, 145, 142, 286, 44, /* 1470 */ 22, 162, 277, 164, 22, 0, 47, 22, 47, 0,
/* 1480 */ 80, 140, 290, 41, 212, 293, 81, 241, 81, 44, /* 1480 */ 47, 47, 287, 48, 22, 0, 291, 22, 0, 20,
/* 1490 */ 44, 12, 13, 161, 41, 47, 81, 41, 81, 307, /* 1490 */ 0, 47, 22, 269, 0, 0, 161, 241, 0, 41,
/* 1500 */ 116, 22, 310, 311, 312, 313, 314, 315, 47, 317, /* 1500 */ 80, 277, 307, 37, 41, 310, 311, 312, 313, 314,
/* 1510 */ 47, 47, 212, 47, 47, 269, 2, 241, 41, 81, /* 1510 */ 315, 287, 317, 145, 319, 291, 145, 142, 294, 212,
/* 1520 */ 178, 81, 276, 80, 44, 141, 47, 80, 144, 44, /* 1520 */ 81, 41, 81, 41, 206, 269, 81, 80, 44, 80,
/* 1530 */ 80, 22, 286, 180, 0, 80, 290, 37, 81, 81, /* 1530 */ 80, 307, 41, 277, 310, 311, 312, 313, 314, 315,
/* 1540 */ 80, 90, 80, 64, 22, 269, 162, 143, 164, 80, /* 1540 */ 44, 317, 81, 287, 80, 44, 140, 291, 81, 41,
/* 1550 */ 241, 140, 276, 307, 80, 44, 310, 311, 312, 313, /* 1550 */ 294, 44, 81, 241, 212, 41, 212, 81, 47, 2,
/* 1560 */ 314, 315, 286, 317, 44, 319, 290, 80, 80, 293, /* 1560 */ 47, 41, 47, 307, 47, 47, 310, 311, 312, 313,
/* 1570 */ 81, 80, 91, 81, 47, 47, 80, 47, 269, 81, /* 1570 */ 314, 315, 47, 317, 81, 44, 44, 80, 22, 143,
/* 1580 */ 241, 102, 80, 307, 81, 276, 310, 311, 312, 313, /* 1580 */ 81, 269, 80, 80, 241, 80, 80, 178, 0, 277,
/* 1590 */ 314, 315, 113, 317, 47, 286, 81, 80, 47, 290, /* 1590 */ 180, 81, 37, 140, 90, 44, 44, 81, 22, 287,
/* 1600 */ 81, 80, 293, 47, 80, 22, 47, 113, 269, 104, /* 1600 */ 81, 80, 80, 291, 80, 47, 80, 80, 80, 47,
/* 1610 */ 241, 104, 248, 80, 104, 276, 307, 104, 92, 310, /* 1610 */ 81, 81, 269, 241, 91, 80, 47, 80, 47, 307,
/* 1620 */ 311, 312, 313, 314, 315, 286, 317, 47, 80, 290, /* 1620 */ 277, 81, 310, 311, 312, 313, 314, 315, 80, 317,
/* 1630 */ 80, 22, 59, 58, 64, 156, 78, 41, 269, 47, /* 1630 */ 287, 81, 47, 80, 291, 81, 47, 104, 104, 80,
/* 1640 */ 276, 47, 47, 22, 47, 276, 307, 47, 47, 310, /* 1640 */ 104, 269, 104, 22, 80, 80, 47, 80, 47, 277,
/* 1650 */ 311, 312, 313, 314, 315, 286, 317, 178, 47, 290, /* 1650 */ 307, 22, 92, 310, 311, 312, 313, 314, 315, 287,
/* 1660 */ 296, 241, 64, 47, 47, 47, 47, 47, 189, 190, /* 1660 */ 317, 59, 241, 291, 58, 78, 41, 64, 12, 13,
/* 1670 */ 191, 47, 47, 0, 47, 45, 307, 241, 314, 310, /* 1670 */ 47, 47, 22, 241, 113, 47, 64, 47, 22, 307,
/* 1680 */ 311, 312, 313, 314, 315, 37, 317, 0, 47, 269, /* 1680 */ 47, 47, 310, 311, 312, 313, 314, 315, 47, 317,
/* 1690 */ 45, 37, 0, 329, 330, 331, 276, 333, 47, 37, /* 1690 */ 269, 47, 47, 47, 47, 47, 47, 0, 277, 47,
/* 1700 */ 336, 0, 45, 45, 37, 269, 286, 47, 0, 46, /* 1700 */ 47, 269, 45, 47, 37, 0, 47, 45, 287, 277,
/* 1710 */ 290, 47, 276, 349, 0, 0, 22, 353, 21, 358, /* 1710 */ 37, 0, 291, 47, 45, 37, 0, 47, 37, 287,
/* 1720 */ 22, 22, 286, 21, 241, 20, 290, 307, 358, 358, /* 1720 */ 64, 45, 0, 291, 241, 0, 47, 0, 307, 46,
/* 1730 */ 310, 311, 312, 313, 314, 315, 358, 317, 358, 358, /* 1730 */ 22, 310, 311, 312, 313, 314, 315, 22, 317, 307,
/* 1740 */ 358, 358, 241, 307, 358, 358, 310, 311, 312, 313, /* 1740 */ 21, 20, 310, 311, 312, 313, 314, 315, 22, 317,
/* 1750 */ 314, 315, 269, 317, 358, 358, 358, 241, 358, 276, /* 1750 */ 21, 358, 269, 241, 358, 358, 358, 358, 102, 358,
/* 1760 */ 358, 358, 358, 358, 358, 358, 358, 358, 358, 286, /* 1760 */ 277, 358, 358, 358, 358, 358, 358, 358, 358, 113,
/* 1770 */ 269, 358, 358, 290, 358, 358, 358, 276, 358, 358, /* 1770 */ 287, 358, 358, 358, 291, 358, 358, 358, 358, 358,
/* 1780 */ 358, 358, 358, 358, 358, 269, 358, 286, 358, 358, /* 1780 */ 358, 269, 358, 358, 358, 241, 358, 358, 358, 277,
/* 1790 */ 307, 290, 276, 310, 311, 312, 313, 314, 315, 358, /* 1790 */ 307, 358, 358, 310, 311, 312, 313, 314, 315, 287,
/* 1800 */ 317, 358, 286, 358, 241, 358, 290, 358, 307, 358, /* 1800 */ 317, 358, 358, 291, 358, 358, 358, 358, 358, 358,
/* 1810 */ 358, 310, 311, 312, 313, 314, 315, 358, 317, 358, /* 1810 */ 358, 358, 156, 269, 358, 358, 358, 358, 358, 307,
/* 1820 */ 241, 358, 358, 307, 358, 358, 310, 311, 312, 313, /* 1820 */ 358, 277, 310, 311, 312, 313, 314, 315, 358, 317,
/* 1830 */ 314, 315, 269, 317, 358, 358, 358, 358, 358, 276, /* 1830 */ 358, 287, 358, 358, 178, 291, 358, 358, 358, 358,
/* 1840 */ 358, 358, 358, 358, 358, 358, 358, 358, 269, 286, /* 1840 */ 358, 241, 358, 358, 358, 189, 190, 191, 358, 358,
/* 1850 */ 358, 358, 358, 290, 358, 276, 358, 358, 358, 358, /* 1850 */ 358, 307, 358, 358, 310, 311, 312, 313, 314, 315,
/* 1860 */ 358, 358, 358, 358, 358, 286, 358, 241, 358, 290, /* 1860 */ 358, 317, 358, 358, 358, 358, 358, 358, 358, 269,
/* 1870 */ 307, 358, 358, 310, 311, 312, 313, 314, 315, 358, /* 1870 */ 358, 358, 241, 358, 358, 358, 358, 277, 358, 358,
/* 1880 */ 317, 358, 358, 358, 358, 358, 307, 358, 358, 310, /* 1880 */ 358, 358, 358, 358, 358, 358, 358, 287, 358, 358,
/* 1890 */ 311, 312, 313, 314, 315, 269, 317, 241, 358, 358, /* 1890 */ 358, 291, 358, 358, 358, 358, 358, 358, 358, 358,
/* 1900 */ 358, 358, 276, 358, 358, 358, 358, 358, 358, 358, /* 1900 */ 269, 241, 358, 358, 358, 358, 358, 307, 277, 358,
/* 1910 */ 358, 358, 286, 358, 358, 358, 290, 358, 358, 358, /* 1910 */ 310, 311, 312, 313, 314, 315, 358, 317, 287, 358,
/* 1920 */ 358, 358, 358, 358, 358, 269, 358, 358, 358, 358, /* 1920 */ 358, 358, 291, 358, 358, 358, 358, 358, 358, 269,
/* 1930 */ 358, 358, 276, 307, 358, 358, 310, 311, 312, 313, /* 1930 */ 358, 358, 241, 358, 358, 358, 358, 277, 307, 358,
/* 1940 */ 314, 315, 286, 317, 358, 358, 290, 241, 358, 358, /* 1940 */ 358, 310, 311, 312, 313, 314, 315, 287, 317, 358,
/* 1950 */ 358, 358, 358, 358, 358, 358, 358, 358, 358, 358, /* 1950 */ 358, 291, 358, 358, 358, 358, 358, 358, 358, 358,
/* 1960 */ 358, 358, 358, 307, 358, 358, 310, 311, 312, 313, /* 1960 */ 269, 241, 358, 358, 358, 358, 358, 307, 277, 358,
/* 1970 */ 314, 315, 358, 317, 358, 269, 358, 241, 358, 358, /* 1970 */ 310, 311, 312, 313, 314, 315, 358, 317, 287, 358,
/* 1980 */ 358, 358, 276, 358, 358, 358, 358, 358, 358, 358, /* 1980 */ 358, 358, 291, 358, 358, 358, 358, 358, 358, 269,
/* 1990 */ 358, 358, 286, 358, 358, 358, 290, 358, 358, 358, /* 1990 */ 358, 358, 358, 358, 358, 358, 358, 277, 307, 358,
/* 2000 */ 358, 358, 358, 358, 358, 269, 358, 358, 358, 358, /* 2000 */ 358, 310, 311, 312, 313, 314, 315, 287, 317, 358,
/* 2010 */ 358, 358, 276, 307, 358, 358, 310, 311, 312, 313, /* 2010 */ 358, 291, 241, 358, 358, 358, 358, 358, 358, 358,
/* 2020 */ 314, 315, 286, 317, 358, 358, 290, 241, 358, 358, /* 2020 */ 358, 358, 358, 241, 358, 358, 358, 307, 358, 358,
/* 2030 */ 358, 358, 358, 358, 358, 358, 241, 358, 358, 358, /* 2030 */ 310, 311, 312, 313, 314, 315, 358, 317, 358, 358,
/* 2040 */ 358, 358, 358, 307, 358, 358, 310, 311, 312, 313, /* 2040 */ 269, 358, 358, 358, 358, 358, 358, 358, 277, 358,
/* 2050 */ 314, 315, 358, 317, 358, 269, 358, 358, 358, 358, /* 2050 */ 358, 269, 358, 358, 358, 358, 358, 358, 287, 277,
/* 2060 */ 358, 358, 276, 358, 269, 358, 358, 358, 358, 358, /* 2060 */ 358, 358, 291, 358, 358, 358, 358, 358, 358, 287,
/* 2070 */ 358, 276, 286, 358, 358, 358, 290, 358, 358, 358, /* 2070 */ 358, 358, 358, 291, 358, 358, 358, 241, 307, 358,
/* 2080 */ 358, 286, 358, 358, 358, 290, 358, 358, 358, 358, /* 2080 */ 358, 310, 311, 312, 313, 314, 315, 358, 317, 307,
/* 2090 */ 241, 358, 358, 307, 358, 358, 310, 311, 312, 313, /* 2090 */ 358, 358, 310, 311, 312, 313, 314, 315, 358, 317,
/* 2100 */ 314, 315, 307, 317, 358, 310, 311, 312, 313, 314, /* 2100 */ 358, 358, 358, 358, 358, 269, 358, 358, 358, 358,
/* 2110 */ 315, 358, 317, 358, 358, 358, 358, 358, 269, 358, /* 2110 */ 358, 358, 358, 277, 358, 358, 358, 358, 358, 358,
/* 2120 */ 358, 358, 358, 358, 358, 276, 358, 358, 358, 358, /* 2120 */ 358, 358, 358, 287, 358, 358, 358, 291, 358, 358,
/* 2130 */ 358, 358, 358, 358, 358, 286, 358, 358, 358, 290, /* 2130 */ 358, 358, 358, 358, 358, 358, 358, 358, 358, 358,
/* 2140 */ 358, 358, 358, 358, 358, 358, 358, 358, 358, 358, /* 2140 */ 358, 358, 358, 307, 358, 358, 310, 311, 312, 313,
/* 2150 */ 358, 358, 358, 358, 358, 358, 307, 358, 358, 310, /* 2150 */ 314, 315, 358, 317,
/* 2160 */ 311, 312, 313, 314, 315, 358, 317,
}; };
#define YY_SHIFT_COUNT (604) #define YY_SHIFT_COUNT (604)
#define YY_SHIFT_MIN (0) #define YY_SHIFT_MIN (0)
#define YY_SHIFT_MAX (1715) #define YY_SHIFT_MAX (1729)
static const unsigned short int yy_shift_ofst[] = { static const unsigned short int yy_shift_ofst[] = {
/* 0 */ 826, 0, 0, 48, 96, 96, 96, 96, 280, 280, /* 0 */ 739, 0, 0, 48, 96, 96, 96, 96, 280, 280,
/* 10 */ 96, 96, 328, 376, 560, 376, 376, 376, 376, 376, /* 10 */ 96, 96, 328, 376, 560, 376, 376, 376, 376, 376,
/* 20 */ 376, 376, 376, 376, 376, 376, 376, 376, 376, 376, /* 20 */ 376, 376, 376, 376, 376, 376, 376, 376, 376, 376,
/* 30 */ 376, 376, 376, 376, 376, 376, 376, 376, 95, 95, /* 30 */ 376, 376, 376, 376, 376, 376, 376, 376, 37, 37,
/* 40 */ 375, 375, 375, 1479, 1479, 1479, 100, 50, 171, 45, /* 40 */ 68, 68, 68, 1656, 1656, 1656, 1656, 64, 271, 179,
/* 50 */ 45, 342, 342, 246, 171, 171, 45, 45, 45, 45, /* 50 */ 18, 18, 13, 13, 123, 179, 179, 18, 18, 18,
/* 60 */ 45, 45, 17, 45, 201, 323, 651, 201, 45, 45, /* 60 */ 18, 18, 18, 35, 18, 182, 190, 314, 182, 18,
/* 70 */ 201, 45, 201, 201, 651, 201, 45, 324, 556, 63, /* 70 */ 18, 182, 18, 182, 182, 314, 182, 18, 334, 556,
/* 80 */ 14, 14, 13, 479, 422, 479, 479, 479, 479, 479, /* 80 */ 343, 107, 107, 192, 312, 746, 746, 746, 746, 746,
/* 90 */ 479, 479, 479, 479, 479, 479, 479, 479, 479, 479, /* 90 */ 746, 746, 746, 746, 746, 746, 746, 746, 746, 746,
/* 100 */ 479, 479, 479, 479, 584, 614, 524, 524, 301, 281, /* 100 */ 746, 746, 746, 746, 441, 580, 110, 110, 206, 720,
/* 110 */ 432, 432, 432, 447, 281, 720, 651, 201, 201, 651, /* 110 */ 393, 393, 393, 244, 720, 384, 314, 182, 182, 314,
/* 120 */ 348, 763, 319, 319, 319, 319, 319, 319, 319, 1384, /* 120 */ 356, 466, 549, 549, 549, 549, 549, 549, 549, 1309,
/* 130 */ 1039, 377, 349, 28, 104, 230, 465, 466, 735, 102, /* 130 */ 294, 197, 21, 78, 268, 279, 517, 583, 694, 292,
/* 140 */ 715, 691, 617, 619, 617, 396, 396, 396, 268, 676, /* 140 */ 502, 611, 576, 687, 576, 598, 598, 598, 756, 750,
/* 150 */ 947, 938, 950, 855, 947, 947, 971, 877, 877, 947, /* 150 */ 982, 964, 965, 866, 982, 982, 981, 890, 890, 982,
/* 160 */ 1002, 1002, 1005, 17, 651, 17, 1017, 17, 720, 1032, /* 160 */ 1019, 1019, 1032, 35, 314, 35, 1040, 35, 384, 1049,
/* 170 */ 17, 17, 947, 17, 1002, 201, 201, 201, 201, 201, /* 170 */ 35, 35, 982, 35, 1019, 182, 182, 182, 182, 182,
/* 180 */ 201, 201, 201, 201, 201, 201, 947, 1002, 1013, 1005, /* 180 */ 182, 182, 182, 182, 182, 182, 982, 1019, 1016, 1032,
/* 190 */ 324, 931, 651, 324, 1017, 324, 720, 1032, 324, 1075, /* 190 */ 334, 957, 314, 334, 1040, 334, 384, 1049, 334, 1114,
/* 200 */ 887, 892, 1013, 887, 892, 1013, 1013, 201, 886, 890, /* 200 */ 925, 927, 1016, 925, 927, 1016, 1016, 182, 923, 938,
/* 210 */ 922, 925, 930, 720, 1123, 1104, 918, 933, 917, 918, /* 210 */ 939, 951, 967, 384, 1161, 1146, 961, 972, 966, 961,
/* 220 */ 933, 918, 933, 1080, 892, 1013, 1013, 892, 1013, 1024, /* 220 */ 972, 961, 972, 1118, 927, 1016, 1016, 927, 1016, 1063,
/* 230 */ 720, 1032, 324, 348, 324, 720, 1096, 763, 947, 324, /* 230 */ 384, 1049, 334, 356, 334, 384, 1167, 466, 982, 334,
/* 240 */ 1002, 2167, 2167, 2167, 2167, 2167, 2167, 2167, 2167, 244, /* 240 */ 1019, 2154, 2154, 2154, 2154, 2154, 2154, 2154, 2154, 635,
/* 250 */ 563, 141, 876, 706, 916, 241, 84, 355, 515, 419, /* 250 */ 928, 1184, 1043, 921, 997, 119, 14, 30, 485, 126,
/* 260 */ 85, 282, 282, 282, 282, 282, 282, 282, 282, 239, /* 260 */ 498, 354, 354, 354, 354, 354, 354, 354, 354, 309,
/* 270 */ 469, 470, 554, 648, 574, 36, 36, 36, 36, 792, /* 270 */ 321, 415, 404, 8, 445, 622, 622, 622, 622, 772,
/* 280 */ 767, 744, 759, 768, 769, 819, 829, 845, 618, 667, /* 280 */ 774, 734, 742, 763, 765, 435, 878, 883, 832, 623,
/* 290 */ 718, 816, 818, 827, 868, 679, 681, 694, 842, 145, /* 290 */ 724, 830, 857, 863, 879, 725, 751, 787, 865, 796,
/* 300 */ 844, 455, 846, 849, 852, 863, 871, 858, 867, 879, /* 300 */ 869, 792, 872, 876, 881, 894, 904, 773, 854, 914,
/* 310 */ 900, 905, 924, 932, 937, 812, 940, 1189, 1199, 1131, /* 310 */ 917, 930, 943, 946, 947, 859, 820, 1275, 1276, 1205,
/* 320 */ 1207, 1163, 1043, 1172, 1173, 1175, 1049, 1228, 1182, 1183, /* 320 */ 1279, 1233, 1107, 1235, 1236, 1237, 1112, 1287, 1242, 1243,
/* 330 */ 1060, 1232, 1188, 1237, 1191, 1239, 1195, 1243, 1164, 1086, /* 330 */ 1117, 1293, 1247, 1295, 1249, 1297, 1251, 1303, 1225, 1149,
/* 340 */ 1088, 1135, 1093, 1251, 1252, 1101, 1105, 1255, 1257, 1214, /* 340 */ 1147, 1197, 1163, 1317, 1322, 1171, 1174, 1329, 1330, 1288,
/* 350 */ 1261, 1263, 1264, 1273, 1280, 1282, 1283, 1284, 1285, 1286, /* 350 */ 1331, 1333, 1334, 1336, 1337, 1338, 1339, 1340, 1341, 1347,
/* 360 */ 1288, 1289, 1290, 1291, 1292, 1293, 1295, 1296, 1258, 1297, /* 360 */ 1348, 1350, 1351, 1353, 1355, 1356, 1357, 1358, 1304, 1359,
/* 370 */ 1301, 1302, 1303, 1305, 1306, 1287, 1307, 1311, 1312, 1314, /* 370 */ 1366, 1367, 1376, 1377, 1378, 1321, 1379, 1380, 1381, 1383,
/* 380 */ 1315, 1316, 1279, 1299, 1281, 1310, 1277, 1323, 1308, 1320, /* 380 */ 1384, 1386, 1349, 1360, 1346, 1385, 1354, 1387, 1361, 1390,
/* 390 */ 1313, 1304, 1326, 1345, 1347, 1349, 1317, 1350, 1298, 1355, /* 390 */ 1362, 1365, 1393, 1394, 1395, 1403, 1369, 1404, 1352, 1407,
/* 400 */ 1356, 1319, 1278, 1321, 1359, 1329, 1294, 1324, 1340, 1330, /* 400 */ 1408, 1363, 1364, 1389, 1414, 1382, 1388, 1391, 1423, 1392,
/* 410 */ 1334, 1325, 1360, 1333, 1336, 1327, 1385, 1386, 1397, 1398, /* 410 */ 1396, 1397, 1424, 1398, 1399, 1400, 1427, 1430, 1440, 1442,
/* 420 */ 1318, 1328, 1352, 1378, 1401, 1357, 1358, 1361, 1363, 1365, /* 420 */ 1373, 1345, 1401, 1425, 1443, 1402, 1405, 1416, 1419, 1426,
/* 430 */ 1370, 1366, 1367, 1371, 1412, 1394, 1424, 1399, 1372, 1422, /* 430 */ 1428, 1429, 1431, 1433, 1446, 1448, 1468, 1452, 1435, 1475,
/* 440 */ 1403, 1379, 1427, 1406, 1430, 1409, 1414, 1432, 1322, 1395, /* 440 */ 1455, 1434, 1479, 1462, 1485, 1465, 1469, 1488, 1368, 1444,
/* 450 */ 1441, 1332, 1429, 1331, 1335, 1449, 1452, 1454, 1375, 1419, /* 450 */ 1490, 1335, 1470, 1371, 1375, 1494, 1495, 1498, 1420, 1466,
/* 460 */ 1341, 1416, 1418, 1248, 1381, 1423, 1388, 1390, 1391, 1392, /* 460 */ 1406, 1458, 1463, 1307, 1439, 1480, 1441, 1447, 1449, 1450,
/* 470 */ 1393, 1434, 1421, 1435, 1400, 1442, 1272, 1405, 1407, 1445, /* 470 */ 1445, 1482, 1484, 1496, 1464, 1491, 1342, 1461, 1467, 1501,
/* 480 */ 1267, 1453, 1446, 1415, 1456, 1300, 1417, 1448, 1461, 1463, /* 480 */ 1318, 1508, 1507, 1471, 1514, 1344, 1476, 1511, 1513, 1515,
/* 490 */ 1464, 1466, 1467, 1417, 1514, 1342, 1477, 1438, 1443, 1440, /* 490 */ 1517, 1518, 1525, 1476, 1557, 1409, 1520, 1493, 1497, 1499,
/* 500 */ 1480, 1447, 1450, 1485, 1509, 1353, 1455, 1457, 1458, 1460, /* 500 */ 1531, 1502, 1503, 1532, 1556, 1410, 1505, 1510, 1516, 1506,
/* 510 */ 1462, 1404, 1469, 1534, 1500, 1411, 1474, 1451, 1511, 1520, /* 510 */ 1521, 1436, 1522, 1588, 1555, 1453, 1524, 1504, 1551, 1552,
/* 520 */ 1487, 1489, 1488, 1522, 1491, 1481, 1492, 1527, 1528, 1496, /* 520 */ 1526, 1519, 1527, 1576, 1528, 1523, 1529, 1558, 1562, 1535,
/* 530 */ 1498, 1530, 1502, 1503, 1547, 1517, 1515, 1551, 1521, 1519, /* 530 */ 1530, 1569, 1537, 1540, 1571, 1548, 1550, 1585, 1553, 1554,
/* 540 */ 1556, 1524, 1505, 1507, 1510, 1513, 1583, 1526, 1533, 1548, /* 540 */ 1589, 1559, 1533, 1534, 1536, 1538, 1621, 1560, 1564, 1565,
/* 550 */ 1559, 1550, 1494, 1580, 1609, 1573, 1575, 1570, 1558, 1596, /* 550 */ 1599, 1567, 1561, 1601, 1629, 1602, 1606, 1603, 1587, 1625,
/* 560 */ 1592, 1594, 1595, 1597, 1600, 1621, 1601, 1611, 1598, 1365, /* 560 */ 1623, 1624, 1628, 1630, 1633, 1650, 1634, 1641, 1612, 1426,
/* 570 */ 1616, 1370, 1617, 1618, 1619, 1620, 1624, 1625, 1673, 1627, /* 570 */ 1644, 1428, 1645, 1646, 1647, 1648, 1649, 1652, 1697, 1653,
/* 580 */ 1630, 1648, 1687, 1641, 1645, 1654, 1692, 1651, 1657, 1662, /* 580 */ 1657, 1667, 1705, 1659, 1662, 1673, 1711, 1666, 1669, 1678,
/* 590 */ 1701, 1660, 1658, 1667, 1708, 1664, 1663, 1714, 1715, 1694, /* 590 */ 1716, 1670, 1676, 1681, 1722, 1679, 1683, 1725, 1727, 1708,
/* 600 */ 1697, 1698, 1699, 1702, 1705, /* 600 */ 1719, 1715, 1726, 1729, 1721,
}; };
#define YY_REDUCE_COUNT (248) #define YY_REDUCE_COUNT (248)
#define YY_REDUCE_MIN (-317) #define YY_REDUCE_MIN (-335)
#define YY_REDUCE_MAX (1849) #define YY_REDUCE_MAX (1836)
static const short yy_reduce_ofst[] = { static const short yy_reduce_ofst[] = {
/* 0 */ 38, 489, 564, 625, 731, 806, 839, 901, 315, 964, /* 0 */ -190, -238, 489, 520, 308, 616, 679, 731, 790, 841,
/* 10 */ 1018, 1058, 1077, -223, 1133, 90, 678, 955, 1192, 1246, /* 10 */ 858, 916, 948, -140, 1001, 1058, 138, 1105, 1144, 1195,
/* 20 */ 1276, 1309, 1339, 1369, 1420, 1436, 1483, 1501, 1516, 1563, /* 20 */ 1224, 1256, 1312, 1343, 1372, 1421, 1432, 1483, 1512, 1544,
/* 30 */ 1579, 1626, 1656, 1706, 1736, 1786, 1795, 1849, -191, 1364, /* 30 */ 1600, 1631, 1660, 1691, 1720, 1771, 1782, 1836, 546, 971,
/* 40 */ 23, 390, 460, -224, 235, -282, 257, -280, 197, -141, /* 40 */ 88, -1, 113, -266, -181, 46, 103, 239, -286, -85,
/* 50 */ -112, -244, -240, -317, -202, -190, -243, 200, 327, 361, /* 50 */ -163, 87, -240, -223, -335, -334, -253, -49, 85, 135,
/* 60 */ 383, 449, -152, 450, -221, 60, -64, -144, 337, 452, /* 60 */ 248, 331, 511, -172, 521, -124, -111, 56, 136, 564,
/* 70 */ 55, 508, 78, 223, 47, 117, 511, -250, -177, -312, /* 70 */ 591, -21, 613, 216, 130, 152, 320, 614, -173, -177,
/* 80 */ -312, -312, -113, 212, -34, 298, 308, 354, 371, 405, /* 80 */ -256, -256, -256, -188, -105, -86, 213, 261, 287, 370,
/* 90 */ 412, 424, 434, 474, 476, 477, 490, 491, 492, 496, /* 90 */ 375, 385, 422, 423, 424, 426, 427, 428, 429, 430,
/* 100 */ 520, 521, 522, 542, 70, -139, 161, 289, 326, 399, /* 100 */ 431, 434, 482, 486, -100, 4, 305, 348, 63, 473,
/* 110 */ -277, 149, 291, -114, 517, 493, 502, 325, 267, 530, /* 110 */ -83, 432, 455, 355, 476, 94, 492, 457, -8, 447,
/* 120 */ 495, 538, -259, -255, 569, 577, 616, 621, 626, 599, /* 120 */ 543, -95, -270, 225, 235, 317, 369, 390, 593, 516,
/* 130 */ 661, 652, 562, 581, 631, 583, 660, 660, 701, 704, /* 130 */ 654, 650, 578, 590, 639, 618, 683, 683, 707, 711,
/* 140 */ 677, 650, 623, 623, 623, 611, 612, 627, 629, 660, /* 140 */ 684, 659, 629, 629, 629, 619, 626, 628, 664, 683,
/* 150 */ 734, 690, 743, 709, 762, 764, 730, 733, 737, 772, /* 150 */ 758, 712, 761, 721, 775, 777, 741, 747, 757, 786,
/* 160 */ 780, 781, 728, 782, 747, 783, 746, 796, 774, 766, /* 160 */ 806, 807, 752, 800, 771, 808, 768, 811, 788, 783,
/* 170 */ 801, 805, 811, 808, 830, 793, 803, 809, 810, 814, /* 170 */ 821, 822, 825, 826, 835, 814, 815, 816, 817, 827,
/* 180 */ 815, 817, 820, 821, 822, 824, 833, 831, 795, 786, /* 180 */ 837, 845, 846, 847, 848, 850, 842, 851, 804, 789,
/* 190 */ 837, 797, 813, 847, 807, 851, 828, 823, 854, 791, /* 190 */ 870, 823, 836, 880, 834, 882, 853, 849, 885, 831,
/* 200 */ 760, 836, 832, 765, 843, 834, 838, 660, 771, 794, /* 200 */ 798, 855, 868, 818, 871, 875, 888, 683, 819, 838,
/* 210 */ 798, 800, 623, 864, 840, 835, 841, 804, 825, 848, /* 210 */ 852, 828, 629, 899, 887, 860, 839, 867, 843, 886,
/* 220 */ 850, 857, 853, 856, 866, 878, 881, 870, 882, 885, /* 220 */ 873, 891, 893, 897, 907, 910, 911, 912, 915, 932,
/* 230 */ 891, 888, 927, 904, 929, 907, 909, 926, 936, 935, /* 230 */ 945, 944, 983, 980, 986, 969, 976, 991, 1003, 1002,
/* 240 */ 945, 894, 893, 895, 934, 939, 943, 942, 959, /* 240 */ 1009, 955, 953, 973, 994, 1008, 1010, 1020, 1035,
}; };
static const YYACTIONTYPE yy_default[] = { static const YYACTIONTYPE yy_default[] = {
/* 0 */ 1345, 1345, 1345, 1345, 1345, 1345, 1345, 1345, 1345, 1345, /* 0 */ 1345, 1345, 1345, 1345, 1345, 1345, 1345, 1345, 1345, 1345,
...@@ -753,9 +751,9 @@ static const YYACTIONTYPE yy_default[] = { ...@@ -753,9 +751,9 @@ static const YYACTIONTYPE yy_default[] = {
/* 30 */ 1345, 1345, 1345, 1345, 1345, 1345, 1345, 1345, 1345, 1345, /* 30 */ 1345, 1345, 1345, 1345, 1345, 1345, 1345, 1345, 1345, 1345,
/* 40 */ 1345, 1345, 1345, 1345, 1345, 1345, 1345, 1345, 1345, 1345, /* 40 */ 1345, 1345, 1345, 1345, 1345, 1345, 1345, 1345, 1345, 1345,
/* 50 */ 1345, 1345, 1345, 1345, 1345, 1345, 1345, 1345, 1345, 1345, /* 50 */ 1345, 1345, 1345, 1345, 1345, 1345, 1345, 1345, 1345, 1345,
/* 60 */ 1345, 1345, 1414, 1345, 1345, 1345, 1345, 1345, 1345, 1345, /* 60 */ 1345, 1345, 1345, 1414, 1345, 1345, 1345, 1345, 1345, 1345,
/* 70 */ 1345, 1345, 1345, 1345, 1345, 1345, 1345, 1412, 1552, 1345, /* 70 */ 1345, 1345, 1345, 1345, 1345, 1345, 1345, 1345, 1412, 1552,
/* 80 */ 1717, 1345, 1345, 1345, 1345, 1345, 1345, 1345, 1345, 1345, /* 80 */ 1345, 1717, 1345, 1345, 1345, 1345, 1345, 1345, 1345, 1345,
/* 90 */ 1345, 1345, 1345, 1345, 1345, 1345, 1345, 1345, 1345, 1345, /* 90 */ 1345, 1345, 1345, 1345, 1345, 1345, 1345, 1345, 1345, 1345,
/* 100 */ 1345, 1345, 1345, 1345, 1345, 1345, 1345, 1345, 1414, 1345, /* 100 */ 1345, 1345, 1345, 1345, 1345, 1345, 1345, 1345, 1414, 1345,
/* 110 */ 1728, 1728, 1728, 1412, 1345, 1345, 1345, 1345, 1345, 1345, /* 110 */ 1728, 1728, 1728, 1412, 1345, 1345, 1345, 1345, 1345, 1345,
...@@ -1423,42 +1421,42 @@ static const char *const yyTokenName[] = { ...@@ -1423,42 +1421,42 @@ static const char *const yyTokenName[] = {
/* 268 */ "alter_table_options", /* 268 */ "alter_table_options",
/* 269 */ "column_name", /* 269 */ "column_name",
/* 270 */ "type_name", /* 270 */ "type_name",
/* 271 */ "create_subtable_clause", /* 271 */ "signed_literal",
/* 272 */ "specific_tags_opt", /* 272 */ "create_subtable_clause",
/* 273 */ "literal_list", /* 273 */ "specific_tags_opt",
/* 274 */ "drop_table_clause", /* 274 */ "literal_list",
/* 275 */ "col_name_list", /* 275 */ "drop_table_clause",
/* 276 */ "table_name", /* 276 */ "col_name_list",
/* 277 */ "column_def", /* 277 */ "table_name",
/* 278 */ "func_name_list", /* 278 */ "column_def",
/* 279 */ "alter_table_option", /* 279 */ "func_name_list",
/* 280 */ "col_name", /* 280 */ "alter_table_option",
/* 281 */ "db_name_cond_opt", /* 281 */ "col_name",
/* 282 */ "like_pattern_opt", /* 282 */ "db_name_cond_opt",
/* 283 */ "table_name_cond", /* 283 */ "like_pattern_opt",
/* 284 */ "from_db_opt", /* 284 */ "table_name_cond",
/* 285 */ "func_name", /* 285 */ "from_db_opt",
/* 286 */ "function_name", /* 286 */ "func_name",
/* 287 */ "index_name", /* 287 */ "function_name",
/* 288 */ "index_options", /* 288 */ "index_name",
/* 289 */ "func_list", /* 289 */ "index_options",
/* 290 */ "duration_literal", /* 290 */ "func_list",
/* 291 */ "sliding_opt", /* 291 */ "duration_literal",
/* 292 */ "func", /* 292 */ "sliding_opt",
/* 293 */ "expression_list", /* 293 */ "func",
/* 294 */ "topic_name", /* 294 */ "expression_list",
/* 295 */ "topic_options", /* 295 */ "topic_name",
/* 296 */ "query_expression", /* 296 */ "topic_options",
/* 297 */ "analyze_opt", /* 297 */ "query_expression",
/* 298 */ "explain_options", /* 298 */ "analyze_opt",
/* 299 */ "agg_func_opt", /* 299 */ "explain_options",
/* 300 */ "bufsize_opt", /* 300 */ "agg_func_opt",
/* 301 */ "stream_name", /* 301 */ "bufsize_opt",
/* 302 */ "stream_options", /* 302 */ "stream_name",
/* 303 */ "into_opt", /* 303 */ "stream_options",
/* 304 */ "dnode_list", /* 304 */ "into_opt",
/* 305 */ "signed", /* 305 */ "dnode_list",
/* 306 */ "signed_literal", /* 306 */ "signed",
/* 307 */ "literal_func", /* 307 */ "literal_func",
/* 308 */ "table_alias", /* 308 */ "table_alias",
/* 309 */ "column_alias", /* 309 */ "column_alias",
...@@ -1638,7 +1636,7 @@ static const char *const yyRuleName[] = { ...@@ -1638,7 +1636,7 @@ static const char *const yyRuleName[] = {
/* 118 */ "alter_table_clause ::= full_table_name DROP TAG column_name", /* 118 */ "alter_table_clause ::= full_table_name DROP TAG column_name",
/* 119 */ "alter_table_clause ::= full_table_name MODIFY TAG column_name type_name", /* 119 */ "alter_table_clause ::= full_table_name MODIFY TAG column_name type_name",
/* 120 */ "alter_table_clause ::= full_table_name RENAME TAG column_name column_name", /* 120 */ "alter_table_clause ::= full_table_name RENAME TAG column_name column_name",
/* 121 */ "alter_table_clause ::= full_table_name SET TAG column_name NK_EQ literal", /* 121 */ "alter_table_clause ::= full_table_name SET TAG column_name NK_EQ signed_literal",
/* 122 */ "multi_create_clause ::= create_subtable_clause", /* 122 */ "multi_create_clause ::= create_subtable_clause",
/* 123 */ "multi_create_clause ::= multi_create_clause create_subtable_clause", /* 123 */ "multi_create_clause ::= multi_create_clause create_subtable_clause",
/* 124 */ "create_subtable_clause ::= not_exists_opt full_table_name USING full_table_name specific_tags_opt TAGS NK_LP literal_list NK_RP table_options", /* 124 */ "create_subtable_clause ::= not_exists_opt full_table_name USING full_table_name specific_tags_opt TAGS NK_LP literal_list NK_RP table_options",
...@@ -2104,26 +2102,26 @@ static void yy_destructor( ...@@ -2104,26 +2102,26 @@ static void yy_destructor(
case 263: /* table_options */ case 263: /* table_options */
case 267: /* alter_table_clause */ case 267: /* alter_table_clause */
case 268: /* alter_table_options */ case 268: /* alter_table_options */
case 271: /* create_subtable_clause */ case 271: /* signed_literal */
case 274: /* drop_table_clause */ case 272: /* create_subtable_clause */
case 277: /* column_def */ case 275: /* drop_table_clause */
case 280: /* col_name */ case 278: /* column_def */
case 281: /* db_name_cond_opt */ case 281: /* col_name */
case 282: /* like_pattern_opt */ case 282: /* db_name_cond_opt */
case 283: /* table_name_cond */ case 283: /* like_pattern_opt */
case 284: /* from_db_opt */ case 284: /* table_name_cond */
case 285: /* func_name */ case 285: /* from_db_opt */
case 288: /* index_options */ case 286: /* func_name */
case 290: /* duration_literal */ case 289: /* index_options */
case 291: /* sliding_opt */ case 291: /* duration_literal */
case 292: /* func */ case 292: /* sliding_opt */
case 295: /* topic_options */ case 293: /* func */
case 296: /* query_expression */ case 296: /* topic_options */
case 298: /* explain_options */ case 297: /* query_expression */
case 302: /* stream_options */ case 299: /* explain_options */
case 303: /* into_opt */ case 303: /* stream_options */
case 305: /* signed */ case 304: /* into_opt */
case 306: /* signed_literal */ case 306: /* signed */
case 307: /* literal_func */ case 307: /* literal_func */
case 310: /* expression */ case 310: /* expression */
case 311: /* pseudo_column */ case 311: /* pseudo_column */
...@@ -2161,7 +2159,7 @@ static void yy_destructor( ...@@ -2161,7 +2159,7 @@ static void yy_destructor(
case 239: /* account_options */ case 239: /* account_options */
case 240: /* alter_account_options */ case 240: /* alter_account_options */
case 242: /* alter_account_option */ case 242: /* alter_account_option */
case 300: /* bufsize_opt */ case 301: /* bufsize_opt */
{ {
} }
...@@ -2172,11 +2170,11 @@ static void yy_destructor( ...@@ -2172,11 +2170,11 @@ static void yy_destructor(
case 249: /* dnode_endpoint */ case 249: /* dnode_endpoint */
case 250: /* dnode_host_name */ case 250: /* dnode_host_name */
case 269: /* column_name */ case 269: /* column_name */
case 276: /* table_name */ case 277: /* table_name */
case 286: /* function_name */ case 287: /* function_name */
case 287: /* index_name */ case 288: /* index_name */
case 294: /* topic_name */ case 295: /* topic_name */
case 301: /* stream_name */ case 302: /* stream_name */
case 308: /* table_alias */ case 308: /* table_alias */
case 309: /* column_alias */ case 309: /* column_alias */
case 315: /* star_func */ case 315: /* star_func */
...@@ -2195,8 +2193,8 @@ static void yy_destructor( ...@@ -2195,8 +2193,8 @@ static void yy_destructor(
break; break;
case 251: /* not_exists_opt */ case 251: /* not_exists_opt */
case 253: /* exists_opt */ case 253: /* exists_opt */
case 297: /* analyze_opt */ case 298: /* analyze_opt */
case 299: /* agg_func_opt */ case 300: /* agg_func_opt */
case 337: /* set_quantifier_opt */ case 337: /* set_quantifier_opt */
{ {
...@@ -2210,13 +2208,13 @@ static void yy_destructor( ...@@ -2210,13 +2208,13 @@ static void yy_destructor(
case 264: /* multi_create_clause */ case 264: /* multi_create_clause */
case 265: /* tags_def */ case 265: /* tags_def */
case 266: /* multi_drop_clause */ case 266: /* multi_drop_clause */
case 272: /* specific_tags_opt */ case 273: /* specific_tags_opt */
case 273: /* literal_list */ case 274: /* literal_list */
case 275: /* col_name_list */ case 276: /* col_name_list */
case 278: /* func_name_list */ case 279: /* func_name_list */
case 289: /* func_list */ case 290: /* func_list */
case 293: /* expression_list */ case 294: /* expression_list */
case 304: /* dnode_list */ case 305: /* dnode_list */
case 316: /* star_func_para_list */ case 316: /* star_func_para_list */
case 318: /* other_para_list */ case 318: /* other_para_list */
case 338: /* select_list */ case 338: /* select_list */
...@@ -2231,7 +2229,7 @@ static void yy_destructor( ...@@ -2231,7 +2229,7 @@ static void yy_destructor(
} }
break; break;
case 258: /* alter_db_option */ case 258: /* alter_db_option */
case 279: /* alter_table_option */ case 280: /* alter_table_option */
{ {
} }
...@@ -2682,21 +2680,21 @@ static const struct { ...@@ -2682,21 +2680,21 @@ static const struct {
{ 267, -4 }, /* (118) alter_table_clause ::= full_table_name DROP TAG column_name */ { 267, -4 }, /* (118) alter_table_clause ::= full_table_name DROP TAG column_name */
{ 267, -5 }, /* (119) alter_table_clause ::= full_table_name MODIFY TAG column_name type_name */ { 267, -5 }, /* (119) alter_table_clause ::= full_table_name MODIFY TAG column_name type_name */
{ 267, -5 }, /* (120) alter_table_clause ::= full_table_name RENAME TAG column_name column_name */ { 267, -5 }, /* (120) alter_table_clause ::= full_table_name RENAME TAG column_name column_name */
{ 267, -6 }, /* (121) alter_table_clause ::= full_table_name SET TAG column_name NK_EQ literal */ { 267, -6 }, /* (121) alter_table_clause ::= full_table_name SET TAG column_name NK_EQ signed_literal */
{ 264, -1 }, /* (122) multi_create_clause ::= create_subtable_clause */ { 264, -1 }, /* (122) multi_create_clause ::= create_subtable_clause */
{ 264, -2 }, /* (123) multi_create_clause ::= multi_create_clause create_subtable_clause */ { 264, -2 }, /* (123) multi_create_clause ::= multi_create_clause create_subtable_clause */
{ 271, -10 }, /* (124) create_subtable_clause ::= not_exists_opt full_table_name USING full_table_name specific_tags_opt TAGS NK_LP literal_list NK_RP table_options */ { 272, -10 }, /* (124) create_subtable_clause ::= not_exists_opt full_table_name USING full_table_name specific_tags_opt TAGS NK_LP literal_list NK_RP table_options */
{ 266, -1 }, /* (125) multi_drop_clause ::= drop_table_clause */ { 266, -1 }, /* (125) multi_drop_clause ::= drop_table_clause */
{ 266, -2 }, /* (126) multi_drop_clause ::= multi_drop_clause drop_table_clause */ { 266, -2 }, /* (126) multi_drop_clause ::= multi_drop_clause drop_table_clause */
{ 274, -2 }, /* (127) drop_table_clause ::= exists_opt full_table_name */ { 275, -2 }, /* (127) drop_table_clause ::= exists_opt full_table_name */
{ 272, 0 }, /* (128) specific_tags_opt ::= */ { 273, 0 }, /* (128) specific_tags_opt ::= */
{ 272, -3 }, /* (129) specific_tags_opt ::= NK_LP col_name_list NK_RP */ { 273, -3 }, /* (129) specific_tags_opt ::= NK_LP col_name_list NK_RP */
{ 260, -1 }, /* (130) full_table_name ::= table_name */ { 260, -1 }, /* (130) full_table_name ::= table_name */
{ 260, -3 }, /* (131) full_table_name ::= db_name NK_DOT table_name */ { 260, -3 }, /* (131) full_table_name ::= db_name NK_DOT table_name */
{ 261, -1 }, /* (132) column_def_list ::= column_def */ { 261, -1 }, /* (132) column_def_list ::= column_def */
{ 261, -3 }, /* (133) column_def_list ::= column_def_list NK_COMMA column_def */ { 261, -3 }, /* (133) column_def_list ::= column_def_list NK_COMMA column_def */
{ 277, -2 }, /* (134) column_def ::= column_name type_name */ { 278, -2 }, /* (134) column_def ::= column_name type_name */
{ 277, -4 }, /* (135) column_def ::= column_name type_name COMMENT NK_STRING */ { 278, -4 }, /* (135) column_def ::= column_name type_name COMMENT NK_STRING */
{ 270, -1 }, /* (136) type_name ::= BOOL */ { 270, -1 }, /* (136) type_name ::= BOOL */
{ 270, -1 }, /* (137) type_name ::= TINYINT */ { 270, -1 }, /* (137) type_name ::= TINYINT */
{ 270, -1 }, /* (138) type_name ::= SMALLINT */ { 270, -1 }, /* (138) type_name ::= SMALLINT */
...@@ -2732,11 +2730,11 @@ static const struct { ...@@ -2732,11 +2730,11 @@ static const struct {
{ 263, -5 }, /* (168) table_options ::= table_options SMA NK_LP col_name_list NK_RP */ { 263, -5 }, /* (168) table_options ::= table_options SMA NK_LP col_name_list NK_RP */
{ 268, -1 }, /* (169) alter_table_options ::= alter_table_option */ { 268, -1 }, /* (169) alter_table_options ::= alter_table_option */
{ 268, -2 }, /* (170) alter_table_options ::= alter_table_options alter_table_option */ { 268, -2 }, /* (170) alter_table_options ::= alter_table_options alter_table_option */
{ 279, -2 }, /* (171) alter_table_option ::= COMMENT NK_STRING */ { 280, -2 }, /* (171) alter_table_option ::= COMMENT NK_STRING */
{ 279, -2 }, /* (172) alter_table_option ::= TTL NK_INTEGER */ { 280, -2 }, /* (172) alter_table_option ::= TTL NK_INTEGER */
{ 275, -1 }, /* (173) col_name_list ::= col_name */ { 276, -1 }, /* (173) col_name_list ::= col_name */
{ 275, -3 }, /* (174) col_name_list ::= col_name_list NK_COMMA col_name */ { 276, -3 }, /* (174) col_name_list ::= col_name_list NK_COMMA col_name */
{ 280, -1 }, /* (175) col_name ::= column_name */ { 281, -1 }, /* (175) col_name ::= column_name */
{ 238, -2 }, /* (176) cmd ::= SHOW DNODES */ { 238, -2 }, /* (176) cmd ::= SHOW DNODES */
{ 238, -2 }, /* (177) cmd ::= SHOW USERS */ { 238, -2 }, /* (177) cmd ::= SHOW USERS */
{ 238, -2 }, /* (178) cmd ::= SHOW DATABASES */ { 238, -2 }, /* (178) cmd ::= SHOW DATABASES */
...@@ -2765,64 +2763,64 @@ static const struct { ...@@ -2765,64 +2763,64 @@ static const struct {
{ 238, -2 }, /* (201) cmd ::= SHOW SNODES */ { 238, -2 }, /* (201) cmd ::= SHOW SNODES */
{ 238, -2 }, /* (202) cmd ::= SHOW CLUSTER */ { 238, -2 }, /* (202) cmd ::= SHOW CLUSTER */
{ 238, -2 }, /* (203) cmd ::= SHOW TRANSACTIONS */ { 238, -2 }, /* (203) cmd ::= SHOW TRANSACTIONS */
{ 281, 0 }, /* (204) db_name_cond_opt ::= */ { 282, 0 }, /* (204) db_name_cond_opt ::= */
{ 281, -2 }, /* (205) db_name_cond_opt ::= db_name NK_DOT */ { 282, -2 }, /* (205) db_name_cond_opt ::= db_name NK_DOT */
{ 282, 0 }, /* (206) like_pattern_opt ::= */ { 283, 0 }, /* (206) like_pattern_opt ::= */
{ 282, -2 }, /* (207) like_pattern_opt ::= LIKE NK_STRING */ { 283, -2 }, /* (207) like_pattern_opt ::= LIKE NK_STRING */
{ 283, -1 }, /* (208) table_name_cond ::= table_name */ { 284, -1 }, /* (208) table_name_cond ::= table_name */
{ 284, 0 }, /* (209) from_db_opt ::= */ { 285, 0 }, /* (209) from_db_opt ::= */
{ 284, -2 }, /* (210) from_db_opt ::= FROM db_name */ { 285, -2 }, /* (210) from_db_opt ::= FROM db_name */
{ 278, -1 }, /* (211) func_name_list ::= func_name */ { 279, -1 }, /* (211) func_name_list ::= func_name */
{ 278, -3 }, /* (212) func_name_list ::= func_name_list NK_COMMA func_name */ { 279, -3 }, /* (212) func_name_list ::= func_name_list NK_COMMA func_name */
{ 285, -1 }, /* (213) func_name ::= function_name */ { 286, -1 }, /* (213) func_name ::= function_name */
{ 238, -8 }, /* (214) cmd ::= CREATE SMA INDEX not_exists_opt index_name ON table_name index_options */ { 238, -8 }, /* (214) cmd ::= CREATE SMA INDEX not_exists_opt index_name ON table_name index_options */
{ 238, -10 }, /* (215) cmd ::= CREATE FULLTEXT INDEX not_exists_opt index_name ON table_name NK_LP col_name_list NK_RP */ { 238, -10 }, /* (215) cmd ::= CREATE FULLTEXT INDEX not_exists_opt index_name ON table_name NK_LP col_name_list NK_RP */
{ 238, -6 }, /* (216) cmd ::= DROP INDEX exists_opt index_name ON table_name */ { 238, -6 }, /* (216) cmd ::= DROP INDEX exists_opt index_name ON table_name */
{ 288, 0 }, /* (217) index_options ::= */ { 289, 0 }, /* (217) index_options ::= */
{ 288, -9 }, /* (218) index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt */ { 289, -9 }, /* (218) index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt */
{ 288, -11 }, /* (219) index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt */ { 289, -11 }, /* (219) index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt */
{ 289, -1 }, /* (220) func_list ::= func */ { 290, -1 }, /* (220) func_list ::= func */
{ 289, -3 }, /* (221) func_list ::= func_list NK_COMMA func */ { 290, -3 }, /* (221) func_list ::= func_list NK_COMMA func */
{ 292, -4 }, /* (222) func ::= function_name NK_LP expression_list NK_RP */ { 293, -4 }, /* (222) func ::= function_name NK_LP expression_list NK_RP */
{ 238, -7 }, /* (223) cmd ::= CREATE TOPIC not_exists_opt topic_name topic_options AS query_expression */ { 238, -7 }, /* (223) cmd ::= CREATE TOPIC not_exists_opt topic_name topic_options AS query_expression */
{ 238, -7 }, /* (224) cmd ::= CREATE TOPIC not_exists_opt topic_name topic_options AS db_name */ { 238, -7 }, /* (224) cmd ::= CREATE TOPIC not_exists_opt topic_name topic_options AS db_name */
{ 238, -4 }, /* (225) cmd ::= DROP TOPIC exists_opt topic_name */ { 238, -4 }, /* (225) cmd ::= DROP TOPIC exists_opt topic_name */
{ 295, 0 }, /* (226) topic_options ::= */ { 296, 0 }, /* (226) topic_options ::= */
{ 295, -3 }, /* (227) topic_options ::= topic_options WITH TABLE */ { 296, -3 }, /* (227) topic_options ::= topic_options WITH TABLE */
{ 295, -3 }, /* (228) topic_options ::= topic_options WITH SCHEMA */ { 296, -3 }, /* (228) topic_options ::= topic_options WITH SCHEMA */
{ 295, -3 }, /* (229) topic_options ::= topic_options WITH TAG */ { 296, -3 }, /* (229) topic_options ::= topic_options WITH TAG */
{ 238, -2 }, /* (230) cmd ::= DESC full_table_name */ { 238, -2 }, /* (230) cmd ::= DESC full_table_name */
{ 238, -2 }, /* (231) cmd ::= DESCRIBE full_table_name */ { 238, -2 }, /* (231) cmd ::= DESCRIBE full_table_name */
{ 238, -3 }, /* (232) cmd ::= RESET QUERY CACHE */ { 238, -3 }, /* (232) cmd ::= RESET QUERY CACHE */
{ 238, -4 }, /* (233) cmd ::= EXPLAIN analyze_opt explain_options query_expression */ { 238, -4 }, /* (233) cmd ::= EXPLAIN analyze_opt explain_options query_expression */
{ 297, 0 }, /* (234) analyze_opt ::= */ { 298, 0 }, /* (234) analyze_opt ::= */
{ 297, -1 }, /* (235) analyze_opt ::= ANALYZE */ { 298, -1 }, /* (235) analyze_opt ::= ANALYZE */
{ 298, 0 }, /* (236) explain_options ::= */ { 299, 0 }, /* (236) explain_options ::= */
{ 298, -3 }, /* (237) explain_options ::= explain_options VERBOSE NK_BOOL */ { 299, -3 }, /* (237) explain_options ::= explain_options VERBOSE NK_BOOL */
{ 298, -3 }, /* (238) explain_options ::= explain_options RATIO NK_FLOAT */ { 299, -3 }, /* (238) explain_options ::= explain_options RATIO NK_FLOAT */
{ 238, -6 }, /* (239) cmd ::= COMPACT VNODES IN NK_LP integer_list NK_RP */ { 238, -6 }, /* (239) cmd ::= COMPACT VNODES IN NK_LP integer_list NK_RP */
{ 238, -10 }, /* (240) cmd ::= CREATE agg_func_opt FUNCTION not_exists_opt function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt */ { 238, -10 }, /* (240) cmd ::= CREATE agg_func_opt FUNCTION not_exists_opt function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt */
{ 238, -4 }, /* (241) cmd ::= DROP FUNCTION exists_opt function_name */ { 238, -4 }, /* (241) cmd ::= DROP FUNCTION exists_opt function_name */
{ 299, 0 }, /* (242) agg_func_opt ::= */ { 300, 0 }, /* (242) agg_func_opt ::= */
{ 299, -1 }, /* (243) agg_func_opt ::= AGGREGATE */ { 300, -1 }, /* (243) agg_func_opt ::= AGGREGATE */
{ 300, 0 }, /* (244) bufsize_opt ::= */ { 301, 0 }, /* (244) bufsize_opt ::= */
{ 300, -2 }, /* (245) bufsize_opt ::= BUFSIZE NK_INTEGER */ { 301, -2 }, /* (245) bufsize_opt ::= BUFSIZE NK_INTEGER */
{ 238, -8 }, /* (246) cmd ::= CREATE STREAM not_exists_opt stream_name stream_options into_opt AS query_expression */ { 238, -8 }, /* (246) cmd ::= CREATE STREAM not_exists_opt stream_name stream_options into_opt AS query_expression */
{ 238, -4 }, /* (247) cmd ::= DROP STREAM exists_opt stream_name */ { 238, -4 }, /* (247) cmd ::= DROP STREAM exists_opt stream_name */
{ 303, 0 }, /* (248) into_opt ::= */ { 304, 0 }, /* (248) into_opt ::= */
{ 303, -2 }, /* (249) into_opt ::= INTO full_table_name */ { 304, -2 }, /* (249) into_opt ::= INTO full_table_name */
{ 302, 0 }, /* (250) stream_options ::= */ { 303, 0 }, /* (250) stream_options ::= */
{ 302, -3 }, /* (251) stream_options ::= stream_options TRIGGER AT_ONCE */ { 303, -3 }, /* (251) stream_options ::= stream_options TRIGGER AT_ONCE */
{ 302, -3 }, /* (252) stream_options ::= stream_options TRIGGER WINDOW_CLOSE */ { 303, -3 }, /* (252) stream_options ::= stream_options TRIGGER WINDOW_CLOSE */
{ 302, -3 }, /* (253) stream_options ::= stream_options WATERMARK duration_literal */ { 303, -3 }, /* (253) stream_options ::= stream_options WATERMARK duration_literal */
{ 238, -3 }, /* (254) cmd ::= KILL CONNECTION NK_INTEGER */ { 238, -3 }, /* (254) cmd ::= KILL CONNECTION NK_INTEGER */
{ 238, -3 }, /* (255) cmd ::= KILL QUERY NK_INTEGER */ { 238, -3 }, /* (255) cmd ::= KILL QUERY NK_INTEGER */
{ 238, -3 }, /* (256) cmd ::= KILL TRANSACTION NK_INTEGER */ { 238, -3 }, /* (256) cmd ::= KILL TRANSACTION NK_INTEGER */
{ 238, -4 }, /* (257) cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER */ { 238, -4 }, /* (257) cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER */
{ 238, -4 }, /* (258) cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list */ { 238, -4 }, /* (258) cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list */
{ 238, -3 }, /* (259) cmd ::= SPLIT VGROUP NK_INTEGER */ { 238, -3 }, /* (259) cmd ::= SPLIT VGROUP NK_INTEGER */
{ 304, -2 }, /* (260) dnode_list ::= DNODE NK_INTEGER */ { 305, -2 }, /* (260) dnode_list ::= DNODE NK_INTEGER */
{ 304, -3 }, /* (261) dnode_list ::= dnode_list DNODE NK_INTEGER */ { 305, -3 }, /* (261) dnode_list ::= dnode_list DNODE NK_INTEGER */
{ 238, -3 }, /* (262) cmd ::= SYNCDB db_name REPLICA */ { 238, -3 }, /* (262) cmd ::= SYNCDB db_name REPLICA */
{ 238, -1 }, /* (263) cmd ::= query_expression */ { 238, -1 }, /* (263) cmd ::= query_expression */
{ 241, -1 }, /* (264) literal ::= NK_INTEGER */ { 241, -1 }, /* (264) literal ::= NK_INTEGER */
...@@ -2833,32 +2831,32 @@ static const struct { ...@@ -2833,32 +2831,32 @@ static const struct {
{ 241, -1 }, /* (269) literal ::= duration_literal */ { 241, -1 }, /* (269) literal ::= duration_literal */
{ 241, -1 }, /* (270) literal ::= NULL */ { 241, -1 }, /* (270) literal ::= NULL */
{ 241, -1 }, /* (271) literal ::= NK_QUESTION */ { 241, -1 }, /* (271) literal ::= NK_QUESTION */
{ 290, -1 }, /* (272) duration_literal ::= NK_VARIABLE */ { 291, -1 }, /* (272) duration_literal ::= NK_VARIABLE */
{ 305, -1 }, /* (273) signed ::= NK_INTEGER */ { 306, -1 }, /* (273) signed ::= NK_INTEGER */
{ 305, -2 }, /* (274) signed ::= NK_PLUS NK_INTEGER */ { 306, -2 }, /* (274) signed ::= NK_PLUS NK_INTEGER */
{ 305, -2 }, /* (275) signed ::= NK_MINUS NK_INTEGER */ { 306, -2 }, /* (275) signed ::= NK_MINUS NK_INTEGER */
{ 305, -1 }, /* (276) signed ::= NK_FLOAT */ { 306, -1 }, /* (276) signed ::= NK_FLOAT */
{ 305, -2 }, /* (277) signed ::= NK_PLUS NK_FLOAT */ { 306, -2 }, /* (277) signed ::= NK_PLUS NK_FLOAT */
{ 305, -2 }, /* (278) signed ::= NK_MINUS NK_FLOAT */ { 306, -2 }, /* (278) signed ::= NK_MINUS NK_FLOAT */
{ 306, -1 }, /* (279) signed_literal ::= signed */ { 271, -1 }, /* (279) signed_literal ::= signed */
{ 306, -1 }, /* (280) signed_literal ::= NK_STRING */ { 271, -1 }, /* (280) signed_literal ::= NK_STRING */
{ 306, -1 }, /* (281) signed_literal ::= NK_BOOL */ { 271, -1 }, /* (281) signed_literal ::= NK_BOOL */
{ 306, -2 }, /* (282) signed_literal ::= TIMESTAMP NK_STRING */ { 271, -2 }, /* (282) signed_literal ::= TIMESTAMP NK_STRING */
{ 306, -1 }, /* (283) signed_literal ::= duration_literal */ { 271, -1 }, /* (283) signed_literal ::= duration_literal */
{ 306, -1 }, /* (284) signed_literal ::= NULL */ { 271, -1 }, /* (284) signed_literal ::= NULL */
{ 306, -1 }, /* (285) signed_literal ::= literal_func */ { 271, -1 }, /* (285) signed_literal ::= literal_func */
{ 273, -1 }, /* (286) literal_list ::= signed_literal */ { 274, -1 }, /* (286) literal_list ::= signed_literal */
{ 273, -3 }, /* (287) literal_list ::= literal_list NK_COMMA signed_literal */ { 274, -3 }, /* (287) literal_list ::= literal_list NK_COMMA signed_literal */
{ 248, -1 }, /* (288) db_name ::= NK_ID */ { 248, -1 }, /* (288) db_name ::= NK_ID */
{ 276, -1 }, /* (289) table_name ::= NK_ID */ { 277, -1 }, /* (289) table_name ::= NK_ID */
{ 269, -1 }, /* (290) column_name ::= NK_ID */ { 269, -1 }, /* (290) column_name ::= NK_ID */
{ 286, -1 }, /* (291) function_name ::= NK_ID */ { 287, -1 }, /* (291) function_name ::= NK_ID */
{ 308, -1 }, /* (292) table_alias ::= NK_ID */ { 308, -1 }, /* (292) table_alias ::= NK_ID */
{ 309, -1 }, /* (293) column_alias ::= NK_ID */ { 309, -1 }, /* (293) column_alias ::= NK_ID */
{ 243, -1 }, /* (294) user_name ::= NK_ID */ { 243, -1 }, /* (294) user_name ::= NK_ID */
{ 287, -1 }, /* (295) index_name ::= NK_ID */ { 288, -1 }, /* (295) index_name ::= NK_ID */
{ 294, -1 }, /* (296) topic_name ::= NK_ID */ { 295, -1 }, /* (296) topic_name ::= NK_ID */
{ 301, -1 }, /* (297) stream_name ::= NK_ID */ { 302, -1 }, /* (297) stream_name ::= NK_ID */
{ 310, -1 }, /* (298) expression ::= literal */ { 310, -1 }, /* (298) expression ::= literal */
{ 310, -1 }, /* (299) expression ::= pseudo_column */ { 310, -1 }, /* (299) expression ::= pseudo_column */
{ 310, -1 }, /* (300) expression ::= column_reference */ { 310, -1 }, /* (300) expression ::= column_reference */
...@@ -2873,8 +2871,8 @@ static const struct { ...@@ -2873,8 +2871,8 @@ static const struct {
{ 310, -3 }, /* (309) expression ::= expression NK_SLASH expression */ { 310, -3 }, /* (309) expression ::= expression NK_SLASH expression */
{ 310, -3 }, /* (310) expression ::= expression NK_REM expression */ { 310, -3 }, /* (310) expression ::= expression NK_REM expression */
{ 310, -3 }, /* (311) expression ::= column_reference NK_ARROW NK_STRING */ { 310, -3 }, /* (311) expression ::= column_reference NK_ARROW NK_STRING */
{ 293, -1 }, /* (312) expression_list ::= expression */ { 294, -1 }, /* (312) expression_list ::= expression */
{ 293, -3 }, /* (313) expression_list ::= expression_list NK_COMMA expression */ { 294, -3 }, /* (313) expression_list ::= expression_list NK_COMMA expression */
{ 312, -1 }, /* (314) column_reference ::= column_name */ { 312, -1 }, /* (314) column_reference ::= column_name */
{ 312, -3 }, /* (315) column_reference ::= table_name NK_DOT column_name */ { 312, -3 }, /* (315) column_reference ::= table_name NK_DOT column_name */
{ 311, -1 }, /* (316) pseudo_column ::= ROWTS */ { 311, -1 }, /* (316) pseudo_column ::= ROWTS */
...@@ -2970,8 +2968,8 @@ static const struct { ...@@ -2970,8 +2968,8 @@ static const struct {
{ 341, -4 }, /* (406) twindow_clause_opt ::= STATE_WINDOW NK_LP expression NK_RP */ { 341, -4 }, /* (406) twindow_clause_opt ::= STATE_WINDOW NK_LP expression NK_RP */
{ 341, -6 }, /* (407) twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt */ { 341, -6 }, /* (407) twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt */
{ 341, -8 }, /* (408) twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt */ { 341, -8 }, /* (408) twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt */
{ 291, 0 }, /* (409) sliding_opt ::= */ { 292, 0 }, /* (409) sliding_opt ::= */
{ 291, -4 }, /* (410) sliding_opt ::= SLIDING NK_LP duration_literal NK_RP */ { 292, -4 }, /* (410) sliding_opt ::= SLIDING NK_LP duration_literal NK_RP */
{ 346, 0 }, /* (411) fill_opt ::= */ { 346, 0 }, /* (411) fill_opt ::= */
{ 346, -4 }, /* (412) fill_opt ::= FILL NK_LP fill_mode NK_RP */ { 346, -4 }, /* (412) fill_opt ::= FILL NK_LP fill_mode NK_RP */
{ 346, -6 }, /* (413) fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP */ { 346, -6 }, /* (413) fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP */
...@@ -2986,7 +2984,7 @@ static const struct { ...@@ -2986,7 +2984,7 @@ static const struct {
{ 348, -3 }, /* (422) group_by_list ::= group_by_list NK_COMMA expression */ { 348, -3 }, /* (422) group_by_list ::= group_by_list NK_COMMA expression */
{ 343, 0 }, /* (423) having_clause_opt ::= */ { 343, 0 }, /* (423) having_clause_opt ::= */
{ 343, -2 }, /* (424) having_clause_opt ::= HAVING search_condition */ { 343, -2 }, /* (424) having_clause_opt ::= HAVING search_condition */
{ 296, -4 }, /* (425) query_expression ::= query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt */ { 297, -4 }, /* (425) query_expression ::= query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt */
{ 349, -1 }, /* (426) query_expression_body ::= query_primary */ { 349, -1 }, /* (426) query_expression_body ::= query_primary */
{ 349, -4 }, /* (427) query_expression_body ::= query_expression_body UNION ALL query_expression_body */ { 349, -4 }, /* (427) query_expression_body ::= query_expression_body UNION ALL query_expression_body */
{ 349, -3 }, /* (428) query_expression_body ::= query_expression_body UNION query_expression_body */ { 349, -3 }, /* (428) query_expression_body ::= query_expression_body UNION query_expression_body */
...@@ -3501,8 +3499,8 @@ static YYACTIONTYPE yy_reduce( ...@@ -3501,8 +3499,8 @@ static YYACTIONTYPE yy_reduce(
{ yylhsminor.yy172 = createAlterTableRenameCol(pCxt, yymsp[-4].minor.yy172, TSDB_ALTER_TABLE_UPDATE_TAG_NAME, &yymsp[-1].minor.yy105, &yymsp[0].minor.yy105); } { yylhsminor.yy172 = createAlterTableRenameCol(pCxt, yymsp[-4].minor.yy172, TSDB_ALTER_TABLE_UPDATE_TAG_NAME, &yymsp[-1].minor.yy105, &yymsp[0].minor.yy105); }
yymsp[-4].minor.yy172 = yylhsminor.yy172; yymsp[-4].minor.yy172 = yylhsminor.yy172;
break; break;
case 121: /* alter_table_clause ::= full_table_name SET TAG column_name NK_EQ literal */ case 121: /* alter_table_clause ::= full_table_name SET TAG column_name NK_EQ signed_literal */
{ yylhsminor.yy172 = createAlterTableSetTag(pCxt, yymsp[-5].minor.yy172, &yymsp[-2].minor.yy105, releaseRawExprNode(pCxt, yymsp[0].minor.yy172)); } { yylhsminor.yy172 = createAlterTableSetTag(pCxt, yymsp[-5].minor.yy172, &yymsp[-2].minor.yy105, yymsp[0].minor.yy172); }
yymsp[-5].minor.yy172 = yylhsminor.yy172; yymsp[-5].minor.yy172 = yylhsminor.yy172;
break; break;
case 123: /* multi_create_clause ::= multi_create_clause create_subtable_clause */ case 123: /* multi_create_clause ::= multi_create_clause create_subtable_clause */
......
...@@ -239,6 +239,10 @@ TEST_F(ParserSelectTest, semanticError) { ...@@ -239,6 +239,10 @@ TEST_F(ParserSelectTest, semanticError) {
// TSDB_CODE_PAR_WRONG_VALUE_TYPE // TSDB_CODE_PAR_WRONG_VALUE_TYPE
run("SELECT timestamp '2010a' FROM t1", TSDB_CODE_PAR_WRONG_VALUE_TYPE, PARSER_STAGE_TRANSLATE); run("SELECT timestamp '2010a' FROM t1", TSDB_CODE_PAR_WRONG_VALUE_TYPE, PARSER_STAGE_TRANSLATE);
run("SELECT LAST(*) + SUM(c1) FROM t1", TSDB_CODE_PAR_WRONG_VALUE_TYPE, PARSER_STAGE_TRANSLATE);
run("SELECT CEIL(LAST(ts, c1)) FROM t1", TSDB_CODE_PAR_WRONG_VALUE_TYPE, PARSER_STAGE_TRANSLATE);
// TSDB_CODE_PAR_ILLEGAL_USE_AGG_FUNCTION // TSDB_CODE_PAR_ILLEGAL_USE_AGG_FUNCTION
run("SELECT c2 FROM t1 tt1 join t1 tt2 on COUNT(*) > 0", TSDB_CODE_PAR_ILLEGAL_USE_AGG_FUNCTION, run("SELECT c2 FROM t1 tt1 join t1 tt2 on COUNT(*) > 0", TSDB_CODE_PAR_ILLEGAL_USE_AGG_FUNCTION,
PARSER_STAGE_TRANSLATE); PARSER_STAGE_TRANSLATE);
......
...@@ -248,6 +248,7 @@ static SLogicSubplan* unionCreateSubplan(SSplitContext* pCxt, SLogicNode* pNode) ...@@ -248,6 +248,7 @@ static SLogicSubplan* unionCreateSubplan(SSplitContext* pCxt, SLogicNode* pNode)
pSubplan->id.groupId = pCxt->groupId; pSubplan->id.groupId = pCxt->groupId;
pSubplan->subplanType = SUBPLAN_TYPE_SCAN; pSubplan->subplanType = SUBPLAN_TYPE_SCAN;
pSubplan->pNode = pNode; pSubplan->pNode = pNode;
pNode->pParent = NULL;
return pSubplan; return pSubplan;
} }
...@@ -408,17 +409,30 @@ static const SSplitRule splitRuleSet[] = {{.pName = "SuperTableScan", .splitFunc ...@@ -408,17 +409,30 @@ static const SSplitRule splitRuleSet[] = {{.pName = "SuperTableScan", .splitFunc
static const int32_t splitRuleNum = (sizeof(splitRuleSet) / sizeof(SSplitRule)); static const int32_t splitRuleNum = (sizeof(splitRuleSet) / sizeof(SSplitRule));
static void dumpLogicSubplan(const char* pRuleName, SLogicSubplan* pSubplan) {
char* pStr = NULL;
nodesNodeToString(pSubplan, false, &pStr, NULL);
qDebugL("apply %s rule: %s", pRuleName, pStr);
taosMemoryFree(pStr);
}
static int32_t applySplitRule(SLogicSubplan* pSubplan) { static int32_t applySplitRule(SLogicSubplan* pSubplan) {
SSplitContext cxt = {.queryId = pSubplan->id.queryId, .groupId = pSubplan->id.groupId + 1, .split = false}; SSplitContext cxt = {.queryId = pSubplan->id.queryId, .groupId = pSubplan->id.groupId + 1, .split = false};
bool split = false;
do { do {
cxt.split = false; split = false;
for (int32_t i = 0; i < splitRuleNum; ++i) { for (int32_t i = 0; i < splitRuleNum; ++i) {
cxt.split = false;
int32_t code = splitRuleSet[i].splitFunc(&cxt, pSubplan); int32_t code = splitRuleSet[i].splitFunc(&cxt, pSubplan);
if (TSDB_CODE_SUCCESS != code) { if (TSDB_CODE_SUCCESS != code) {
return code; return code;
} }
if (cxt.split) {
split = true;
dumpLogicSubplan(splitRuleSet[i].pName, pSubplan);
}
} }
} while (cxt.split); } while (split);
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
} }
......
...@@ -23,7 +23,12 @@ class PlanSetOpTest : public PlannerTestBase {}; ...@@ -23,7 +23,12 @@ class PlanSetOpTest : public PlannerTestBase {};
TEST_F(PlanSetOpTest, unionAll) { TEST_F(PlanSetOpTest, unionAll) {
useDb("root", "test"); useDb("root", "test");
// sql 1: single UNION ALL operator
run("SELECT c1, c2 FROM t1 WHERE c1 > 10 UNION ALL SELECT c1, c2 FROM t1 WHERE c1 > 20"); run("SELECT c1, c2 FROM t1 WHERE c1 > 10 UNION ALL SELECT c1, c2 FROM t1 WHERE c1 > 20");
// sql 2: multi UNION ALL operator
run("SELECT c1, c2 FROM t1 WHERE c1 > 10 "
"UNION ALL SELECT c1, c2 FROM t1 WHERE c1 > 20 "
"UNION ALL SELECT c1, c2 FROM t1 WHERE c1 > 30");
} }
TEST_F(PlanSetOpTest, unionAllSubquery) { TEST_F(PlanSetOpTest, unionAllSubquery) {
...@@ -44,7 +49,12 @@ TEST_F(PlanSetOpTest, unionAllWithSubquery) { ...@@ -44,7 +49,12 @@ TEST_F(PlanSetOpTest, unionAllWithSubquery) {
TEST_F(PlanSetOpTest, union) { TEST_F(PlanSetOpTest, union) {
useDb("root", "test"); useDb("root", "test");
// single UNION operator
run("SELECT c1, c2 FROM t1 WHERE c1 > 10 UNION SELECT c1, c2 FROM t1 WHERE c1 > 20"); run("SELECT c1, c2 FROM t1 WHERE c1 > 10 UNION SELECT c1, c2 FROM t1 WHERE c1 > 20");
// multi UNION operator
run("SELECT c1, c2 FROM t1 WHERE c1 > 10 "
"UNION SELECT c1, c2 FROM t1 WHERE c1 > 20 "
"UNION SELECT c1, c2 FROM t1 WHERE c1 > 30");
} }
TEST_F(PlanSetOpTest, unionContainJoin) { TEST_F(PlanSetOpTest, unionContainJoin) {
...@@ -62,3 +72,12 @@ TEST_F(PlanSetOpTest, unionSubquery) { ...@@ -62,3 +72,12 @@ TEST_F(PlanSetOpTest, unionSubquery) {
run("SELECT * FROM (SELECT c1, c2 FROM t1 UNION SELECT c1, c2 FROM t1)"); run("SELECT * FROM (SELECT c1, c2 FROM t1 UNION SELECT c1, c2 FROM t1)");
} }
TEST_F(PlanSetOpTest, bug001) {
useDb("root", "test");
run("SELECT c2 FROM t1 WHERE c1 IS NOT NULL GROUP BY c2 "
"UNION "
"SELECT 'abcdefghijklmnopqrstuvwxyz' FROM t1 "
"WHERE 'abcdefghijklmnopqrstuvwxyz' IS NOT NULL GROUP BY 'abcdefghijklmnopqrstuvwxyz'");
}
...@@ -23,9 +23,7 @@ class PlanSubqeuryTest : public PlannerTestBase {}; ...@@ -23,9 +23,7 @@ class PlanSubqeuryTest : public PlannerTestBase {};
TEST_F(PlanSubqeuryTest, basic) { TEST_F(PlanSubqeuryTest, basic) {
useDb("root", "test"); useDb("root", "test");
if (0 == g_skipSql) {
run("SELECT * FROM (SELECT * FROM t1)"); run("SELECT * FROM (SELECT * FROM t1)");
}
run("SELECT LAST(c1) FROM (SELECT * FROM t1)"); run("SELECT LAST(c1) FROM (SELECT * FROM t1)");
} }
......
...@@ -35,18 +35,19 @@ class PlannerEnv : public testing::Environment { ...@@ -35,18 +35,19 @@ class PlannerEnv : public testing::Environment {
private: private:
void initLog(const char* path) { void initLog(const char* path) {
dDebugFlag = 143; int32_t logLevel = getLogLevel();
vDebugFlag = 0; dDebugFlag = logLevel;
mDebugFlag = 143; vDebugFlag = logLevel;
cDebugFlag = 0; mDebugFlag = logLevel;
jniDebugFlag = 0; cDebugFlag = logLevel;
tmrDebugFlag = 135; jniDebugFlag = logLevel;
uDebugFlag = 135; tmrDebugFlag = logLevel;
rpcDebugFlag = 143; uDebugFlag = logLevel;
qDebugFlag = 143; rpcDebugFlag = logLevel;
wDebugFlag = 0; qDebugFlag = logLevel;
sDebugFlag = 0; wDebugFlag = logLevel;
tsdbDebugFlag = 0; sDebugFlag = logLevel;
tsdbDebugFlag = logLevel;
tsLogEmbedded = 1; tsLogEmbedded = 1;
tsAsyncLog = 0; tsAsyncLog = 0;
...@@ -62,15 +63,24 @@ class PlannerEnv : public testing::Environment { ...@@ -62,15 +63,24 @@ class PlannerEnv : public testing::Environment {
static void parseArg(int argc, char* argv[]) { static void parseArg(int argc, char* argv[]) {
int opt = 0; int opt = 0;
const char* optstring = ""; const char* optstring = "";
// clang-format off
static struct option long_options[] = { static struct option long_options[] = {
{"dump", optional_argument, NULL, 'd'}, {"skipSql", optional_argument, NULL, 's'}, {0, 0, 0, 0}}; {"dump", optional_argument, NULL, 'd'},
{"skipSql", required_argument, NULL, 's'},
{"log", required_argument, NULL, 'l'},
{0, 0, 0, 0}
};
// clang-format on
while ((opt = getopt_long(argc, argv, optstring, long_options, NULL)) != -1) { while ((opt = getopt_long(argc, argv, optstring, long_options, NULL)) != -1) {
switch (opt) { switch (opt) {
case 'd': case 'd':
setDumpModule(optarg); setDumpModule(optarg);
break; break;
case 's': case 's':
g_skipSql = 1; setSkipSqlNum(optarg);
break;
case 'l':
setLogLevel(optarg);
break; break;
default: default:
break; break;
......
...@@ -48,6 +48,7 @@ enum DumpModule { ...@@ -48,6 +48,7 @@ enum DumpModule {
DumpModule g_dumpModule = DUMP_MODULE_NOTHING; DumpModule g_dumpModule = DUMP_MODULE_NOTHING;
int32_t g_skipSql = 0; int32_t g_skipSql = 0;
int32_t g_logLevel = 131;
void setDumpModule(const char* pModule) { void setDumpModule(const char* pModule) {
if (NULL == pModule) { if (NULL == pModule) {
...@@ -71,14 +72,26 @@ void setDumpModule(const char* pModule) { ...@@ -71,14 +72,26 @@ void setDumpModule(const char* pModule) {
} }
} }
void setSkipSqlNum(const char* pNum) { g_skipSql = stoi(optarg); }
void setLogLevel(const char* pLogLevel) { g_logLevel = stoi(pLogLevel); }
int32_t getLogLevel() { return g_logLevel; }
class PlannerTestBaseImpl { class PlannerTestBaseImpl {
public: public:
void useDb(const string& acctId, const string& db) { void useDb(const string& acctId, const string& db) {
caseEnv_.acctId_ = acctId; caseEnv_.acctId_ = acctId;
caseEnv_.db_ = db; caseEnv_.db_ = db;
caseEnv_.nsql_ = g_skipSql;
} }
void run(const string& sql) { void run(const string& sql) {
if (caseEnv_.nsql_ > 0) {
--(caseEnv_.nsql_);
return;
}
reset(); reset();
try { try {
SQuery* pQuery = nullptr; SQuery* pQuery = nullptr;
...@@ -109,6 +122,10 @@ class PlannerTestBaseImpl { ...@@ -109,6 +122,10 @@ class PlannerTestBaseImpl {
} }
void prepare(const string& sql) { void prepare(const string& sql) {
if (caseEnv_.nsql_ > 0) {
return;
}
reset(); reset();
try { try {
doParseSql(sql, &stmtEnv_.pQuery_, true); doParseSql(sql, &stmtEnv_.pQuery_, true);
...@@ -119,6 +136,10 @@ class PlannerTestBaseImpl { ...@@ -119,6 +136,10 @@ class PlannerTestBaseImpl {
} }
void bindParams(TAOS_MULTI_BIND* pParams, int32_t colIdx) { void bindParams(TAOS_MULTI_BIND* pParams, int32_t colIdx) {
if (caseEnv_.nsql_ > 0) {
return;
}
try { try {
doBindParams(stmtEnv_.pQuery_, pParams, colIdx); doBindParams(stmtEnv_.pQuery_, pParams, colIdx);
} catch (...) { } catch (...) {
...@@ -128,6 +149,11 @@ class PlannerTestBaseImpl { ...@@ -128,6 +149,11 @@ class PlannerTestBaseImpl {
} }
void exec() { void exec() {
if (caseEnv_.nsql_ > 0) {
--(caseEnv_.nsql_);
return;
}
try { try {
doParseBoundSql(stmtEnv_.pQuery_); doParseBoundSql(stmtEnv_.pQuery_);
...@@ -159,6 +185,7 @@ class PlannerTestBaseImpl { ...@@ -159,6 +185,7 @@ class PlannerTestBaseImpl {
struct caseEnv { struct caseEnv {
string acctId_; string acctId_;
string db_; string db_;
int32_t nsql_;
}; };
struct stmtEnv { struct stmtEnv {
......
...@@ -37,8 +37,9 @@ class PlannerTestBase : public testing::Test { ...@@ -37,8 +37,9 @@ class PlannerTestBase : public testing::Test {
std::unique_ptr<PlannerTestBaseImpl> impl_; std::unique_ptr<PlannerTestBaseImpl> impl_;
}; };
extern int32_t g_skipSql;
extern void setDumpModule(const char* pModule); extern void setDumpModule(const char* pModule);
extern void setSkipSqlNum(const char* pNum);
extern void setLogLevel(const char* pLogLevel);
extern int32_t getLogLevel();
#endif // PLAN_TEST_UTIL_H #endif // PLAN_TEST_UTIL_H
...@@ -76,8 +76,8 @@ int32_t syncRespMgrGetAndDel(SSyncRespMgr *pObj, uint64_t index, SRespStub *pStu ...@@ -76,8 +76,8 @@ int32_t syncRespMgrGetAndDel(SSyncRespMgr *pObj, uint64_t index, SRespStub *pStu
void *pTmp = taosHashGet(pObj->pRespHash, &index, sizeof(index)); void *pTmp = taosHashGet(pObj->pRespHash, &index, sizeof(index));
if (pTmp != NULL) { if (pTmp != NULL) {
memcpy(pStub, pTmp, sizeof(SRespStub)); memcpy(pStub, pTmp, sizeof(SRespStub));
taosThreadMutexUnlock(&(pObj->mutex));
taosHashRemove(pObj->pRespHash, &index, sizeof(index)); taosHashRemove(pObj->pRespHash, &index, sizeof(index));
taosThreadMutexUnlock(&(pObj->mutex));
return 1; // get one object return 1; // get one object
} }
taosThreadMutexUnlock(&(pObj->mutex)); taosThreadMutexUnlock(&(pObj->mutex));
......
...@@ -15,8 +15,8 @@ ...@@ -15,8 +15,8 @@
#define _DEFAULT_SOURCE #define _DEFAULT_SOURCE
#include "thash.h" #include "thash.h"
#include "taoserror.h"
#include "os.h" #include "os.h"
#include "taoserror.h"
#include "tlog.h" #include "tlog.h"
// the add ref count operation may trigger the warning if the reference count is greater than the MAX_WARNING_REF_COUNT // the add ref count operation may trigger the warning if the reference count is greater than the MAX_WARNING_REF_COUNT
...@@ -27,13 +27,13 @@ ...@@ -27,13 +27,13 @@
#define HASH_NEED_RESIZE(_h) ((_h)->size >= (_h)->capacity * HASH_DEFAULT_LOAD_FACTOR) #define HASH_NEED_RESIZE(_h) ((_h)->size >= (_h)->capacity * HASH_DEFAULT_LOAD_FACTOR)
#define GET_HASH_NODE_KEY(_n) ((char*)(_n) + sizeof(SHashNode) + (_n)->dataLen) #define GET_HASH_NODE_KEY(_n) ((char *)(_n) + sizeof(SHashNode) + (_n)->dataLen)
#define GET_HASH_NODE_DATA(_n) ((char*)(_n) + sizeof(SHashNode)) #define GET_HASH_NODE_DATA(_n) ((char *)(_n) + sizeof(SHashNode))
#define GET_HASH_PNODE(_n) ((SHashNode *)((char*)(_n) - sizeof(SHashNode))) #define GET_HASH_PNODE(_n) ((SHashNode *)((char *)(_n) - sizeof(SHashNode)))
#define FREE_HASH_NODE(_fp, _n) \ #define FREE_HASH_NODE(_fp, _n) \
do { \ do { \
/* if (_fp != NULL) { \ /* if (_fp != NULL) { \
(_fp)(_n); \ (_fp)(_n); \
}*/ \ }*/ \
taosMemoryFreeClear(_n); \ taosMemoryFreeClear(_n); \
...@@ -56,7 +56,7 @@ typedef struct SHashEntry { ...@@ -56,7 +56,7 @@ typedef struct SHashEntry {
} SHashEntry; } SHashEntry;
struct SHashObj { struct SHashObj {
SHashEntry ** hashList; SHashEntry **hashList;
size_t capacity; // number of slots size_t capacity; // number of slots
int64_t size; // number of elements in hash table int64_t size; // number of elements in hash table
_hash_fn_t hashFp; // hash function _hash_fn_t hashFp; // hash function
...@@ -65,7 +65,7 @@ struct SHashObj { ...@@ -65,7 +65,7 @@ struct SHashObj {
SRWLatch lock; // read-write spin lock SRWLatch lock; // read-write spin lock
SHashLockTypeE type; // lock type SHashLockTypeE type; // lock type
bool enableUpdate; // enable update bool enableUpdate; // enable update
SArray * pMemBlock; // memory block allocated for SHashEntry SArray *pMemBlock; // memory block allocated for SHashEntry
_hash_before_fn_t callbackFp; // function invoked before return the value to caller _hash_before_fn_t callbackFp; // function invoked before return the value to caller
}; };
...@@ -103,14 +103,14 @@ static FORCE_INLINE void taosHashRUnlock(SHashObj *pHashObj) { ...@@ -103,14 +103,14 @@ static FORCE_INLINE void taosHashRUnlock(SHashObj *pHashObj) {
taosRUnLockLatch(&pHashObj->lock); taosRUnLockLatch(&pHashObj->lock);
} }
static FORCE_INLINE void taosHashEntryWLock(const SHashObj *pHashObj, SHashEntry* pe) { static FORCE_INLINE void taosHashEntryWLock(const SHashObj *pHashObj, SHashEntry *pe) {
if (pHashObj->type == HASH_NO_LOCK) { if (pHashObj->type == HASH_NO_LOCK) {
return; return;
} }
taosWLockLatch(&pe->latch); taosWLockLatch(&pe->latch);
} }
static FORCE_INLINE void taosHashEntryWUnlock(const SHashObj *pHashObj, SHashEntry* pe) { static FORCE_INLINE void taosHashEntryWUnlock(const SHashObj *pHashObj, SHashEntry *pe) {
if (pHashObj->type == HASH_NO_LOCK) { if (pHashObj->type == HASH_NO_LOCK) {
return; return;
} }
...@@ -118,7 +118,7 @@ static FORCE_INLINE void taosHashEntryWUnlock(const SHashObj *pHashObj, SHashEnt ...@@ -118,7 +118,7 @@ static FORCE_INLINE void taosHashEntryWUnlock(const SHashObj *pHashObj, SHashEnt
taosWUnLockLatch(&pe->latch); taosWUnLockLatch(&pe->latch);
} }
static FORCE_INLINE void taosHashEntryRLock(const SHashObj *pHashObj, SHashEntry* pe) { static FORCE_INLINE void taosHashEntryRLock(const SHashObj *pHashObj, SHashEntry *pe) {
if (pHashObj->type == HASH_NO_LOCK) { if (pHashObj->type == HASH_NO_LOCK) {
return; return;
} }
...@@ -126,7 +126,7 @@ static FORCE_INLINE void taosHashEntryRLock(const SHashObj *pHashObj, SHashEntry ...@@ -126,7 +126,7 @@ static FORCE_INLINE void taosHashEntryRLock(const SHashObj *pHashObj, SHashEntry
taosRLockLatch(&pe->latch); taosRLockLatch(&pe->latch);
} }
static FORCE_INLINE void taosHashEntryRUnlock(const SHashObj *pHashObj, SHashEntry* pe) { static FORCE_INLINE void taosHashEntryRUnlock(const SHashObj *pHashObj, SHashEntry *pe) {
if (pHashObj->type == HASH_NO_LOCK) { if (pHashObj->type == HASH_NO_LOCK) {
return; return;
} }
...@@ -142,12 +142,11 @@ static FORCE_INLINE int32_t taosHashCapacity(int32_t length) { ...@@ -142,12 +142,11 @@ static FORCE_INLINE int32_t taosHashCapacity(int32_t length) {
return i; return i;
} }
static FORCE_INLINE SHashNode * static FORCE_INLINE SHashNode *doSearchInEntryList(SHashObj *pHashObj, SHashEntry *pe, const void *key, size_t keyLen,
doSearchInEntryList(SHashObj *pHashObj, SHashEntry *pe, const void *key, size_t keyLen, uint32_t hashVal) { uint32_t hashVal) {
SHashNode *pNode = pe->next; SHashNode *pNode = pe->next;
while (pNode) { while (pNode) {
if ((pNode->keyLen == keyLen) && if ((pNode->keyLen == keyLen) && ((*(pHashObj->equalFp))(GET_HASH_NODE_KEY(pNode), key, keyLen) == 0) &&
((*(pHashObj->equalFp))(GET_HASH_NODE_KEY(pNode), key, keyLen) == 0) &&
pNode->removed == 0) { pNode->removed == 0) {
assert(pNode->hashVal == hashVal); assert(pNode->hashVal == hashVal);
break; break;
...@@ -186,18 +185,22 @@ static SHashNode *doCreateHashNode(const void *key, size_t keyLen, const void *p ...@@ -186,18 +185,22 @@ static SHashNode *doCreateHashNode(const void *key, size_t keyLen, const void *p
* @param pNode the old node with requested key * @param pNode the old node with requested key
* @param pNewNode the new node with requested key * @param pNewNode the new node with requested key
*/ */
static FORCE_INLINE void doUpdateHashNode(SHashObj *pHashObj, SHashEntry* pe, SHashNode* prev, SHashNode *pNode, SHashNode *pNewNode) { static FORCE_INLINE void doUpdateHashNode(SHashObj *pHashObj, SHashEntry *pe, SHashNode *prev, SHashNode *pNode,
SHashNode *pNewNode) {
assert(pNode->keyLen == pNewNode->keyLen); assert(pNode->keyLen == pNewNode->keyLen);
atomic_sub_fetch_16(&pNode->refCount, 1); atomic_sub_fetch_16(&pNode->refCount, 1);
if (prev != NULL) { if (prev != NULL) {
prev->next = pNewNode; prev->next = pNewNode;
ASSERT(prev->next != prev);
} else { } else {
pe->next = pNewNode; pe->next = pNewNode;
} }
if (pNode->refCount <= 0) { if (pNode->refCount <= 0) {
pNewNode->next = pNode->next; pNewNode->next = pNode->next;
ASSERT(pNewNode->next != pNewNode);
FREE_HASH_NODE(pHashObj->freeFp, pNode); FREE_HASH_NODE(pHashObj->freeFp, pNode);
} else { } else {
pNewNode->next = pNode; pNewNode->next = pNode;
...@@ -227,9 +230,7 @@ static FORCE_INLINE bool taosHashTableEmpty(const SHashObj *pHashObj); ...@@ -227,9 +230,7 @@ static FORCE_INLINE bool taosHashTableEmpty(const SHashObj *pHashObj);
* @param pHashObj * @param pHashObj
* @return * @return
*/ */
static FORCE_INLINE bool taosHashTableEmpty(const SHashObj *pHashObj) { static FORCE_INLINE bool taosHashTableEmpty(const SHashObj *pHashObj) { return taosHashGetSize(pHashObj) == 0; }
return taosHashGetSize(pHashObj) == 0;
}
SHashObj *taosHashInit(size_t capacity, _hash_fn_t fn, bool update, SHashLockTypeE type) { SHashObj *taosHashInit(size_t capacity, _hash_fn_t fn, bool update, SHashLockTypeE type) {
if (fn == NULL) { if (fn == NULL) {
...@@ -305,7 +306,7 @@ int32_t taosHashGetSize(const SHashObj *pHashObj) { ...@@ -305,7 +306,7 @@ int32_t taosHashGetSize(const SHashObj *pHashObj) {
if (pHashObj == NULL) { if (pHashObj == NULL) {
return 0; return 0;
} }
return (int32_t)atomic_load_64((int64_t*)&pHashObj->size); return (int32_t)atomic_load_64((int64_t *)&pHashObj->size);
} }
int32_t taosHashPut(SHashObj *pHashObj, const void *key, size_t keyLen, const void *data, size_t size) { int32_t taosHashPut(SHashObj *pHashObj, const void *key, size_t keyLen, const void *data, size_t size) {
...@@ -340,10 +341,9 @@ int32_t taosHashPut(SHashObj *pHashObj, const void *key, size_t keyLen, const vo ...@@ -340,10 +341,9 @@ int32_t taosHashPut(SHashObj *pHashObj, const void *key, size_t keyLen, const vo
} }
#endif #endif
SHashNode* prev = NULL; SHashNode *prev = NULL;
while (pNode) { while (pNode) {
if ((pNode->keyLen == keyLen) && if ((pNode->keyLen == keyLen) && (*(pHashObj->equalFp))(GET_HASH_NODE_KEY(pNode), key, keyLen) == 0 &&
(*(pHashObj->equalFp))(GET_HASH_NODE_KEY(pNode), key, keyLen) == 0 &&
pNode->removed == 0) { pNode->removed == 0) {
assert(pNode->hashVal == hashVal); assert(pNode->hashVal == hashVal);
break; break;
...@@ -391,27 +391,27 @@ int32_t taosHashPut(SHashObj *pHashObj, const void *key, size_t keyLen, const vo ...@@ -391,27 +391,27 @@ int32_t taosHashPut(SHashObj *pHashObj, const void *key, size_t keyLen, const vo
} }
} }
static void* taosHashGetImpl(SHashObj *pHashObj, const void *key, size_t keyLen, void** d, int32_t* size, bool addRef); static void *taosHashGetImpl(SHashObj *pHashObj, const void *key, size_t keyLen, void **d, int32_t *size, bool addRef);
void *taosHashGet(SHashObj *pHashObj, const void *key, size_t keyLen) { void *taosHashGet(SHashObj *pHashObj, const void *key, size_t keyLen) {
void* p = NULL; void *p = NULL;
return taosHashGetImpl(pHashObj, key, keyLen, &p, 0, false); return taosHashGetImpl(pHashObj, key, keyLen, &p, 0, false);
} }
int32_t taosHashGetDup(SHashObj *pHashObj, const void *key, size_t keyLen, void *destBuf) { int32_t taosHashGetDup(SHashObj *pHashObj, const void *key, size_t keyLen, void *destBuf) {
terrno = 0; terrno = 0;
/*char* p = */taosHashGetImpl(pHashObj, key, keyLen, &destBuf, 0, false); /*char* p = */ taosHashGetImpl(pHashObj, key, keyLen, &destBuf, 0, false);
return terrno; return terrno;
} }
int32_t taosHashGetDup_m(SHashObj *pHashObj, const void *key, size_t keyLen, void **destBuf, int32_t* size) { int32_t taosHashGetDup_m(SHashObj *pHashObj, const void *key, size_t keyLen, void **destBuf, int32_t *size) {
terrno = 0; terrno = 0;
/*char* p = */taosHashGetImpl(pHashObj, key, keyLen, destBuf, size, false); /*char* p = */ taosHashGetImpl(pHashObj, key, keyLen, destBuf, size, false);
return terrno; return terrno;
} }
void* taosHashGetImpl(SHashObj *pHashObj, const void *key, size_t keyLen, void** d, int32_t* size, bool addRef) { void *taosHashGetImpl(SHashObj *pHashObj, const void *key, size_t keyLen, void **d, int32_t *size, bool addRef) {
if (pHashObj == NULL || taosHashTableEmpty(pHashObj) || keyLen == 0 || key == NULL) { if (pHashObj == NULL || taosHashTableEmpty(pHashObj) || keyLen == 0 || key == NULL) {
return NULL; return NULL;
} }
...@@ -457,7 +457,7 @@ void* taosHashGetImpl(SHashObj *pHashObj, const void *key, size_t keyLen, void** ...@@ -457,7 +457,7 @@ void* taosHashGetImpl(SHashObj *pHashObj, const void *key, size_t keyLen, void**
} }
} else if (*size < pNode->dataLen) { } else if (*size < pNode->dataLen) {
*size = pNode->dataLen; *size = pNode->dataLen;
char* tmp = taosMemoryRealloc(*d, *size); char *tmp = taosMemoryRealloc(*d, *size);
if (tmp == NULL) { if (tmp == NULL) {
terrno = TSDB_CODE_OUT_OF_MEMORY; terrno = TSDB_CODE_OUT_OF_MEMORY;
return NULL; return NULL;
...@@ -513,8 +513,7 @@ int32_t taosHashRemove(SHashObj *pHashObj, const void *key, size_t keyLen) { ...@@ -513,8 +513,7 @@ int32_t taosHashRemove(SHashObj *pHashObj, const void *key, size_t keyLen) {
SHashNode *prevNode = NULL; SHashNode *prevNode = NULL;
while (pNode) { while (pNode) {
if ((pNode->keyLen == keyLen) && if ((pNode->keyLen == keyLen) && ((*(pHashObj->equalFp))(GET_HASH_NODE_KEY(pNode), key, keyLen) == 0) &&
((*(pHashObj->equalFp))(GET_HASH_NODE_KEY(pNode), key, keyLen) == 0) &&
pNode->removed == 0) { pNode->removed == 0) {
code = 0; // it is found code = 0; // it is found
...@@ -525,6 +524,7 @@ int32_t taosHashRemove(SHashObj *pHashObj, const void *key, size_t keyLen) { ...@@ -525,6 +524,7 @@ int32_t taosHashRemove(SHashObj *pHashObj, const void *key, size_t keyLen) {
pe->next = pNode->next; pe->next = pNode->next;
} else { } else {
prevNode->next = pNode->next; prevNode->next = pNode->next;
ASSERT(prevNode->next != prevNode);
} }
pe->num--; pe->num--;
...@@ -598,14 +598,14 @@ void taosHashCleanup(SHashObj *pHashObj) { ...@@ -598,14 +598,14 @@ void taosHashCleanup(SHashObj *pHashObj) {
} }
// for profile only // for profile only
int32_t taosHashGetMaxOverflowLinkLength(const SHashObj *pHashObj){ int32_t taosHashGetMaxOverflowLinkLength(const SHashObj *pHashObj) {
if (pHashObj == NULL || taosHashTableEmpty(pHashObj)) { if (pHashObj == NULL || taosHashTableEmpty(pHashObj)) {
return 0; return 0;
} }
int32_t num = 0; int32_t num = 0;
taosHashRLock((SHashObj*) pHashObj); taosHashRLock((SHashObj *)pHashObj);
for (int32_t i = 0; i < pHashObj->size; ++i) { for (int32_t i = 0; i < pHashObj->size; ++i) {
SHashEntry *pEntry = pHashObj->hashList[i]; SHashEntry *pEntry = pHashObj->hashList[i];
...@@ -616,7 +616,7 @@ int32_t taosHashGetMaxOverflowLinkLength(const SHashObj *pHashObj){ ...@@ -616,7 +616,7 @@ int32_t taosHashGetMaxOverflowLinkLength(const SHashObj *pHashObj){
} }
} }
taosHashRUnlock((SHashObj*) pHashObj); taosHashRUnlock((SHashObj *)pHashObj);
return num; return num;
} }
...@@ -627,22 +627,22 @@ void taosHashTableResize(SHashObj *pHashObj) { ...@@ -627,22 +627,22 @@ void taosHashTableResize(SHashObj *pHashObj) {
int32_t newCapacity = (int32_t)(pHashObj->capacity << 1u); int32_t newCapacity = (int32_t)(pHashObj->capacity << 1u);
if (newCapacity > HASH_MAX_CAPACITY) { if (newCapacity > HASH_MAX_CAPACITY) {
// uDebug("current capacity:%zu, maximum capacity:%d, no resize applied due to limitation is reached", // uDebug("current capacity:%zu, maximum capacity:%d, no resize applied due to limitation is reached",
// pHashObj->capacity, HASH_MAX_CAPACITY); // pHashObj->capacity, HASH_MAX_CAPACITY);
return; return;
} }
int64_t st = taosGetTimestampUs(); int64_t st = taosGetTimestampUs();
void *pNewEntryList = taosMemoryRealloc(pHashObj->hashList, sizeof(void *) * newCapacity); void *pNewEntryList = taosMemoryRealloc(pHashObj->hashList, sizeof(void *) * newCapacity);
if (pNewEntryList == NULL) { if (pNewEntryList == NULL) {
// uDebug("cache resize failed due to out of memory, capacity remain:%zu", pHashObj->capacity); // uDebug("cache resize failed due to out of memory, capacity remain:%zu", pHashObj->capacity);
return; return;
} }
pHashObj->hashList = pNewEntryList; pHashObj->hashList = pNewEntryList;
size_t inc = newCapacity - pHashObj->capacity; size_t inc = newCapacity - pHashObj->capacity;
void * p = taosMemoryCalloc(inc, sizeof(SHashEntry)); void *p = taosMemoryCalloc(inc, sizeof(SHashEntry));
for (int32_t i = 0; i < inc; ++i) { for (int32_t i = 0; i < inc; ++i) {
pHashObj->hashList[i + pHashObj->capacity] = (void *)((char *)p + i * sizeof(SHashEntry)); pHashObj->hashList[i + pHashObj->capacity] = (void *)((char *)p + i * sizeof(SHashEntry));
...@@ -688,12 +688,13 @@ void taosHashTableResize(SHashObj *pHashObj) { ...@@ -688,12 +688,13 @@ void taosHashTableResize(SHashObj *pHashObj) {
int64_t et = taosGetTimestampUs(); int64_t et = taosGetTimestampUs();
// uDebug("hash table resize completed, new capacity:%d, load factor:%f, elapsed time:%fms", (int32_t)pHashObj->capacity, // uDebug("hash table resize completed, new capacity:%d, load factor:%f, elapsed time:%fms",
// ((double)pHashObj->size) / pHashObj->capacity, (et - st) / 1000.0); // (int32_t)pHashObj->capacity,
// ((double)pHashObj->size) / pHashObj->capacity, (et - st) / 1000.0);
} }
SHashNode *doCreateHashNode(const void *key, size_t keyLen, const void *pData, size_t dsize, uint32_t hashVal) { SHashNode *doCreateHashNode(const void *key, size_t keyLen, const void *pData, size_t dsize, uint32_t hashVal) {
SHashNode *pNewNode = taosMemoryMalloc(sizeof(SHashNode) + keyLen + dsize); SHashNode *pNewNode = taosMemoryMalloc(sizeof(SHashNode) + keyLen + dsize + 1);
if (pNewNode == NULL) { if (pNewNode == NULL) {
terrno = TSDB_CODE_OUT_OF_MEMORY; terrno = TSDB_CODE_OUT_OF_MEMORY;
...@@ -703,7 +704,7 @@ SHashNode *doCreateHashNode(const void *key, size_t keyLen, const void *pData, s ...@@ -703,7 +704,7 @@ SHashNode *doCreateHashNode(const void *key, size_t keyLen, const void *pData, s
pNewNode->keyLen = (uint32_t)keyLen; pNewNode->keyLen = (uint32_t)keyLen;
pNewNode->hashVal = hashVal; pNewNode->hashVal = hashVal;
pNewNode->dataLen = (uint32_t)dsize; pNewNode->dataLen = (uint32_t)dsize;
pNewNode->refCount= 1; pNewNode->refCount = 1;
pNewNode->removed = 0; pNewNode->removed = 0;
pNewNode->next = NULL; pNewNode->next = NULL;
...@@ -719,6 +720,7 @@ void pushfrontNodeInEntryList(SHashEntry *pEntry, SHashNode *pNode) { ...@@ -719,6 +720,7 @@ void pushfrontNodeInEntryList(SHashEntry *pEntry, SHashNode *pNode) {
pNode->next = pEntry->next; pNode->next = pEntry->next;
pEntry->next = pNode; pEntry->next = pNode;
ASSERT(pNode->next != pNode);
pEntry->num += 1; pEntry->num += 1;
} }
...@@ -727,11 +729,12 @@ size_t taosHashGetMemSize(const SHashObj *pHashObj) { ...@@ -727,11 +729,12 @@ size_t taosHashGetMemSize(const SHashObj *pHashObj) {
return 0; return 0;
} }
return (pHashObj->capacity * (sizeof(SHashEntry) + sizeof(void*))) + sizeof(SHashNode) * taosHashGetSize(pHashObj) + sizeof(SHashObj); return (pHashObj->capacity * (sizeof(SHashEntry) + sizeof(void *))) + sizeof(SHashNode) * taosHashGetSize(pHashObj) +
sizeof(SHashObj);
} }
void *taosHashGetKey(void *data, size_t* keyLen) { void *taosHashGetKey(void *data, size_t *keyLen) {
SHashNode * node = GET_HASH_PNODE(data); SHashNode *node = GET_HASH_PNODE(data);
if (keyLen != NULL) { if (keyLen != NULL) {
*keyLen = node->keyLen; *keyLen = node->keyLen;
} }
...@@ -751,8 +754,7 @@ static void *taosHashReleaseNode(SHashObj *pHashObj, void *p, int *slot) { ...@@ -751,8 +754,7 @@ static void *taosHashReleaseNode(SHashObj *pHashObj, void *p, int *slot) {
SHashNode *pNode = pe->next; SHashNode *pNode = pe->next;
while (pNode) { while (pNode) {
if (pNode == pOld) if (pNode == pOld) break;
break;
prevNode = pNode; prevNode = pNode;
pNode = pNode->next; pNode = pNode->next;
...@@ -766,11 +768,16 @@ static void *taosHashReleaseNode(SHashObj *pHashObj, void *p, int *slot) { ...@@ -766,11 +768,16 @@ static void *taosHashReleaseNode(SHashObj *pHashObj, void *p, int *slot) {
} }
atomic_sub_fetch_16(&pOld->refCount, 1); atomic_sub_fetch_16(&pOld->refCount, 1);
if (pOld->refCount <=0) { if (pOld->refCount <= 0) {
if (prevNode) { if (prevNode) {
prevNode->next = pOld->next; prevNode->next = pOld->next;
ASSERT(prevNode->next != prevNode);
} else { } else {
pe->next = pOld->next; pe->next = pOld->next;
SHashNode* x = pe->next;
if (x != NULL) {
ASSERT(x->next != x);
}
} }
pe->num--; pe->num--;
...@@ -778,7 +785,7 @@ static void *taosHashReleaseNode(SHashObj *pHashObj, void *p, int *slot) { ...@@ -778,7 +785,7 @@ static void *taosHashReleaseNode(SHashObj *pHashObj, void *p, int *slot) {
FREE_HASH_NODE(pHashObj->freeFp, pOld); FREE_HASH_NODE(pHashObj->freeFp, pOld);
} }
} else { } else {
// uError("pNode:%p data:%p is not there!!!", pNode, p); // uError("pNode:%p data:%p is not there!!!", pNode, p);
} }
return pNode; return pNode;
...@@ -865,9 +872,9 @@ void taosHashCancelIterate(SHashObj *pHashObj, void *p) { ...@@ -865,9 +872,9 @@ void taosHashCancelIterate(SHashObj *pHashObj, void *p) {
taosHashRUnlock(pHashObj); taosHashRUnlock(pHashObj);
} }
//TODO remove it // TODO remove it
void *taosHashAcquire(SHashObj *pHashObj, const void *key, size_t keyLen) { void *taosHashAcquire(SHashObj *pHashObj, const void *key, size_t keyLen) {
void* p = NULL; void *p = NULL;
return taosHashGetImpl(pHashObj, key, keyLen, &p, 0, true); return taosHashGetImpl(pHashObj, key, keyLen, &p, 0, true);
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册