提交 1ebaa4e2 编写于 作者: guanshengliang's avatar guanshengliang

fix bug while alter dnode

上级 b69e67bd
...@@ -370,10 +370,11 @@ int32_t tscToSQLCmd(SSqlObj* pSql, struct SSqlInfo* pInfo) { ...@@ -370,10 +370,11 @@ int32_t tscToSQLCmd(SSqlObj* pSql, struct SSqlInfo* pInfo) {
return invalidSqlErrMsg(tscGetErrorMsgPayload(pCmd), msg2); return invalidSqlErrMsg(tscGetErrorMsgPayload(pCmd), msg2);
} }
char* pMsg = pCmd->payload + tsRpcHeadSize; char* pMsg = pCmd->payload;
pMsg += sizeof(SMgmtHead);
SCMCfgDnodeMsg* pCfg = (SCMCfgDnodeMsg*)pMsg; SCMCfgDnodeMsg* pCfg = (SCMCfgDnodeMsg*)pMsg;
pDCL->a[0].n = strdequote(pDCL->a[0].z);
strncpy(pCfg->ep, pDCL->a[0].z, pDCL->a[0].n); strncpy(pCfg->ep, pDCL->a[0].z, pDCL->a[0].n);
strncpy(pCfg->config, pDCL->a[1].z, pDCL->a[1].n); strncpy(pCfg->config, pDCL->a[1].z, pDCL->a[1].n);
......
...@@ -1005,13 +1005,7 @@ int32_t tscBuildUserMsg(SSqlObj *pSql, SSqlInfo *pInfo) { ...@@ -1005,13 +1005,7 @@ int32_t tscBuildUserMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
int32_t tscBuildCfgDnodeMsg(SSqlObj *pSql, SSqlInfo *pInfo) { int32_t tscBuildCfgDnodeMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
SSqlCmd *pCmd = &pSql->cmd; SSqlCmd *pCmd = &pSql->cmd;
pCmd->payloadLen = sizeof(SCMCfgDnodeMsg); pCmd->payloadLen = sizeof(SCMCfgDnodeMsg);
pCmd->msgType = TSDB_MSG_TYPE_CM_CONFIG_DNODE;
if (TSDB_CODE_SUCCESS != tscAllocPayload(pCmd, pCmd->payloadLen)) {
tscError("%p failed to malloc for query msg", pSql);
return TSDB_CODE_CLI_OUT_OF_MEMORY;
}
pCmd->msgType = TSDB_MSG_TYPE_MD_CONFIG_DNODE;
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
} }
...@@ -1189,7 +1183,7 @@ int32_t tscBuildKillMsg(SSqlObj *pSql, SSqlInfo *pInfo) { ...@@ -1189,7 +1183,7 @@ int32_t tscBuildKillMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
int tscEstimateCreateTableMsgLength(SSqlObj *pSql, SSqlInfo *pInfo) { int tscEstimateCreateTableMsgLength(SSqlObj *pSql, SSqlInfo *pInfo) {
SSqlCmd *pCmd = &(pSql->cmd); SSqlCmd *pCmd = &(pSql->cmd);
int32_t size = minMsgSize() + sizeof(SMgmtHead) + sizeof(SCMCreateTableMsg); int32_t size = minMsgSize() + sizeof(SCMCreateTableMsg);
SCreateTableSQL *pCreateTableInfo = pInfo->pCreateTableInfo; SCreateTableSQL *pCreateTableInfo = pInfo->pCreateTableInfo;
if (pCreateTableInfo->type == TSQL_CREATE_TABLE_FROM_STABLE) { if (pCreateTableInfo->type == TSQL_CREATE_TABLE_FROM_STABLE) {
...@@ -1277,7 +1271,7 @@ int tscBuildCreateTableMsg(SSqlObj *pSql, SSqlInfo *pInfo) { ...@@ -1277,7 +1271,7 @@ int tscBuildCreateTableMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
int tscEstimateAlterTableMsgLength(SSqlCmd *pCmd) { int tscEstimateAlterTableMsgLength(SSqlCmd *pCmd) {
SQueryInfo *pQueryInfo = tscGetQueryInfoDetail(pCmd, 0); SQueryInfo *pQueryInfo = tscGetQueryInfoDetail(pCmd, 0);
return minMsgSize() + sizeof(SMgmtHead) + sizeof(SCMAlterTableMsg) + sizeof(SSchema) * tscNumOfFields(pQueryInfo) + return minMsgSize() + sizeof(SCMAlterTableMsg) + sizeof(SSchema) * tscNumOfFields(pQueryInfo) +
TSDB_EXTRA_PAYLOAD_SIZE; TSDB_EXTRA_PAYLOAD_SIZE;
} }
...@@ -1534,6 +1528,7 @@ int tscBuildTableMetaMsg(SSqlObj *pSql, SSqlInfo *pInfo) { ...@@ -1534,6 +1528,7 @@ int tscBuildTableMetaMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
* no used 4B * no used 4B
**/ **/
int tscBuildMultiMeterMetaMsg(SSqlObj *pSql, SSqlInfo *pInfo) { int tscBuildMultiMeterMetaMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
#if 0
SSqlCmd *pCmd = &pSql->cmd; SSqlCmd *pCmd = &pSql->cmd;
// copy payload content to temp buff // copy payload content to temp buff
...@@ -1566,6 +1561,8 @@ int tscBuildMultiMeterMetaMsg(SSqlObj *pSql, SSqlInfo *pInfo) { ...@@ -1566,6 +1561,8 @@ int tscBuildMultiMeterMetaMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
pCmd->payloadLen); pCmd->payloadLen);
return pCmd->payloadLen; return pCmd->payloadLen;
#endif
return 0;
} }
//static UNUSED_FUNC int32_t tscEstimateMetricMetaMsgSize(SSqlCmd *pCmd) { //static UNUSED_FUNC int32_t tscEstimateMetricMetaMsgSize(SSqlCmd *pCmd) {
...@@ -1765,7 +1762,7 @@ int tscEstimateHeartBeatMsgLength(SSqlObj *pSql) { ...@@ -1765,7 +1762,7 @@ int tscEstimateHeartBeatMsgLength(SSqlObj *pSql) {
int size = 0; int size = 0;
STscObj *pObj = pSql->pTscObj; STscObj *pObj = pSql->pTscObj;
size += tsRpcHeadSize + sizeof(SMgmtHead); size += tsRpcHeadSize;
size += sizeof(SQqueryList); size += sizeof(SQqueryList);
SSqlObj *tpSql = pObj->sqlList; SSqlObj *tpSql = pObj->sqlList;
...@@ -1801,13 +1798,9 @@ int tscBuildHeartBeatMsg(SSqlObj *pSql, SSqlInfo *pInfo) { ...@@ -1801,13 +1798,9 @@ int tscBuildHeartBeatMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
return -1; return -1;
} }
pMsg = pCmd->payload + tsRpcHeadSize; pMsg = pCmd->payload;
pStart = pMsg; pStart = pMsg;
SMgmtHead *pMgmt = (SMgmtHead *)pMsg;
strcpy(pMgmt->db, pObj->db);
pMsg += sizeof(SMgmtHead);
pMsg = tscBuildQueryStreamDesc(pMsg, pObj); pMsg = tscBuildQueryStreamDesc(pMsg, pObj);
pthread_mutex_unlock(&pObj->mutex); pthread_mutex_unlock(&pObj->mutex);
......
...@@ -204,10 +204,19 @@ static pthread_once_t tsInitGlobalCfgOnce = PTHREAD_ONCE_INIT; ...@@ -204,10 +204,19 @@ static pthread_once_t tsInitGlobalCfgOnce = PTHREAD_ONCE_INIT;
void taosSetAllDebugFlag() { void taosSetAllDebugFlag() {
for (int32_t i = 0; i < tsGlobalConfigNum; ++i) { for (int32_t i = 0; i < tsGlobalConfigNum; ++i) {
SGlobalCfg *cfg = &tsGlobalConfig[i]; mdebugFlag = debugFlag;
if ((cfg->cfgType & TSDB_CFG_CTYPE_B_LOG) && cfg->cfgType == TAOS_CFG_VTYPE_INT32) { sdbDebugFlag = debugFlag;
*((int32_t*)cfg->ptr) = debugFlag; dDebugFlag = debugFlag;
} vDebugFlag = debugFlag;
cdebugFlag = debugFlag;
jnidebugFlag = debugFlag;
odbcdebugFlag = debugFlag;
httpDebugFlag = debugFlag;
monitorDebugFlag = debugFlag;
rpcDebugFlag = debugFlag;
uDebugFlag = debugFlag;
sDebugFlag = debugFlag;
//qdebugFlag = debugFlag;
} }
uPrint("all debug flag are set to %d", debugFlag); uPrint("all debug flag are set to %d", debugFlag);
} }
...@@ -1189,6 +1198,10 @@ void taosInitGlobalCfg() { ...@@ -1189,6 +1198,10 @@ void taosInitGlobalCfg() {
} }
bool taosCheckGlobalCfg() { bool taosCheckGlobalCfg() {
if (debugFlag == 135 || debugFlag == 199) {
taosSetAllDebugFlag();
}
taosGetFqdn(tsLocalEp); taosGetFqdn(tsLocalEp);
sprintf(tsLocalEp + strlen(tsLocalEp), ":%d", tsServerPort); sprintf(tsLocalEp + strlen(tsLocalEp), ":%d", tsServerPort);
uPrint("localEp is %s", tsLocalEp); uPrint("localEp is %s", tsLocalEp);
......
...@@ -137,7 +137,6 @@ void dnodeProcessMsgFromShell(SRpcMsg *pMsg) { ...@@ -137,7 +137,6 @@ void dnodeProcessMsgFromShell(SRpcMsg *pMsg) {
} }
} }
static int dnodeRetrieveUserAuthInfo(char *user, char *spi, char *encrypt, char *secret, char *ckey) { static int dnodeRetrieveUserAuthInfo(char *user, char *spi, char *encrypt, char *secret, char *ckey) {
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
} }
......
...@@ -317,10 +317,6 @@ typedef struct { ...@@ -317,10 +317,6 @@ typedef struct {
int8_t flag; int8_t flag;
} SCMCreateUserMsg, SCMAlterUserMsg; } SCMCreateUserMsg, SCMAlterUserMsg;
typedef struct {
char db[TSDB_TABLE_ID_LEN + 1];
} SMgmtHead;
typedef struct { typedef struct {
int32_t contLen; int32_t contLen;
int32_t vgId; int32_t vgId;
......
...@@ -252,7 +252,7 @@ void mgmtProcessCfgDnodeMsg(SQueuedMsg *pMsg) { ...@@ -252,7 +252,7 @@ void mgmtProcessCfgDnodeMsg(SQueuedMsg *pMsg) {
} }
static void mgmtProcessCfgDnodeMsgRsp(SRpcMsg *rpcMsg) { static void mgmtProcessCfgDnodeMsgRsp(SRpcMsg *rpcMsg) {
mPrint("cfg vnode rsp is received, result:%s", tstrerror(rpcMsg->code)); mPrint("cfg dnode rsp is received");
} }
void mgmtProcessDnodeStatusMsg(SRpcMsg *rpcMsg) { void mgmtProcessDnodeStatusMsg(SRpcMsg *rpcMsg) {
......
...@@ -132,6 +132,7 @@ int32_t mgmtInitSystem() { ...@@ -132,6 +132,7 @@ int32_t mgmtInitSystem() {
void mgmtCleanUpSystem() { void mgmtCleanUpSystem() {
mPrint("starting to clean up mgmt"); mPrint("starting to clean up mgmt");
tsMgmtIsRunning = false;
mgmtCleanUpShell(); mgmtCleanUpShell();
mgmtCleanupServer(); mgmtCleanupServer();
grantCleanUp(); grantCleanUp();
...@@ -144,7 +145,6 @@ void mgmtCleanUpSystem() { ...@@ -144,7 +145,6 @@ void mgmtCleanUpSystem() {
mgmtCleanupDnodes(); mgmtCleanupDnodes();
mgmtCleanUpUsers(); mgmtCleanUpUsers();
mgmtCleanUpAccts(); mgmtCleanUpAccts();
tsMgmtIsRunning = false;
mPrint("mgmt is cleaned up"); mPrint("mgmt is cleaned up");
} }
......
...@@ -323,11 +323,19 @@ void sdbCleanUp() { ...@@ -323,11 +323,19 @@ void sdbCleanUp() {
if (tsSdbObj.status != SDB_STATUS_SERVING) return; if (tsSdbObj.status != SDB_STATUS_SERVING) return;
tsSdbObj.status = SDB_STATUS_CLOSING; tsSdbObj.status = SDB_STATUS_CLOSING;
if (tsSdbObj.sync) {
syncStop(tsSdbObj.sync); syncStop(tsSdbObj.sync);
tsSdbObj.sync = NULL;
}
if (tsSdbObj.wal) {
walClose(tsSdbObj.wal); walClose(tsSdbObj.wal);
tsSdbObj.wal = NULL;
}
sem_destroy(&tsSdbObj.sem); sem_destroy(&tsSdbObj.sem);
pthread_mutex_destroy(&tsSdbObj.mutex); pthread_mutex_destroy(&tsSdbObj.mutex);
memset(&tsSdbObj, 0, sizeof(tsSdbObj));
} }
void sdbIncRef(void *handle, void *pRow) { void sdbIncRef(void *handle, void *pRow) {
......
...@@ -27,21 +27,21 @@ cd ../../../debug; make ...@@ -27,21 +27,21 @@ cd ../../../debug; make
./test.sh -f general/compress/compress2.sim ./test.sh -f general/compress/compress2.sim
./test.sh -f general/compress/uncompress.sim ./test.sh -f general/compress/uncompress.sim
#./test.sh -f general/compute/avg.sim ./test.sh -f general/compute/avg.sim
./test.sh -f general/compute/bottom.sim ./test.sh -f general/compute/bottom.sim
#./test.sh -f general/compute/count.sim ./test.sh -f general/compute/count.sim
./test.sh -f general/compute/diff.sim ./test.sh -f general/compute/diff.sim
#./test.sh -f general/compute/diff2.sim #./test.sh -f general/compute/diff2.sim
#./test.sh -f general/compute/first.sim ./test.sh -f general/compute/first.sim
#./test.sh -f general/compute/interval.sim #./test.sh -f general/compute/interval.sim
#./test.sh -f general/compute/last.sim #./test.sh -f general/compute/last.sim
#./test.sh -f general/compute/leastsquare.sim #./test.sh -f general/compute/leastsquare.sim
#./test.sh -f general/compute/max.sim ./test.sh -f general/compute/max.sim
#./test.sh -f general/compute/min.sim ./test.sh -f general/compute/min.sim
./test.sh -f general/compute/null.sim ./test.sh -f general/compute/null.sim
./test.sh -f general/compute/percentile.sim ./test.sh -f general/compute/percentile.sim
./test.sh -f general/compute/stddev.sim ./test.sh -f general/compute/stddev.sim
#./test.sh -f general/compute/sum.sim ./test.sh -f general/compute/sum.sim
./test.sh -f general/compute/top.sim ./test.sh -f general/compute/top.sim
./test.sh -f general/db/basic.sim ./test.sh -f general/db/basic.sim
...@@ -109,7 +109,7 @@ cd ../../../debug; make ...@@ -109,7 +109,7 @@ cd ../../../debug; make
# ./test.sh -f general/parser/auto_create_tb.sim # ./test.sh -f general/parser/auto_create_tb.sim
# ./test.sh -f general/parser/auto_create_tb_drop_tb.sim # ./test.sh -f general/parser/auto_create_tb_drop_tb.sim
./test.sh -f general/parser/binary_escapeCharacter.sim ./test.sh -f general/parser/binary_escapeCharacter.sim
./test.sh -f general/parser/bug.sim #./test.sh -f general/parser/bug.sim
./test.sh -f general/parser/col_arithmetic_operation.sim ./test.sh -f general/parser/col_arithmetic_operation.sim
./test.sh -f general/parser/columnValue_bigint.sim ./test.sh -f general/parser/columnValue_bigint.sim
./test.sh -f general/parser/columnValue_bool.sim ./test.sh -f general/parser/columnValue_bool.sim
......
...@@ -108,6 +108,7 @@ echo "udebugFlag 131" >> $TAOS_CFG ...@@ -108,6 +108,7 @@ echo "udebugFlag 131" >> $TAOS_CFG
echo "jnidebugFlag 131" >> $TAOS_CFG echo "jnidebugFlag 131" >> $TAOS_CFG
echo "sdebugFlag 135" >> $TAOS_CFG echo "sdebugFlag 135" >> $TAOS_CFG
echo "monitor 0" >> $TAOS_CFG echo "monitor 0" >> $TAOS_CFG
echo "monitorInterval 1" >> $TAOS_CFG
echo "http 0" >> $TAOS_CFG echo "http 0" >> $TAOS_CFG
echo "numOfThreadsPerCore 2.0" >> $TAOS_CFG echo "numOfThreadsPerCore 2.0" >> $TAOS_CFG
echo "defaultPass taosdata" >> $TAOS_CFG echo "defaultPass taosdata" >> $TAOS_CFG
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册