提交 cd95c32a 编写于 作者: H hjxilinx

fix bug #645

上级 eccfeed8
...@@ -228,7 +228,6 @@ typedef struct _connObj { ...@@ -228,7 +228,6 @@ typedef struct _connObj {
SDbObj * pDb; SDbObj * pDb;
SUserObj * pUser; SUserObj * pUser;
char user[TSDB_USER_LEN]; char user[TSDB_USER_LEN];
char db[TSDB_METER_ID_LEN];
uint64_t stime; // login time uint64_t stime; // login time
char superAuth : 1; // super user flag char superAuth : 1; // super user flag
char writeAuth : 1; // write flag char writeAuth : 1; // write flag
......
...@@ -655,6 +655,9 @@ int mgmtCreateMeter(SDbObj *pDb, SCreateTableMsg *pCreate) { ...@@ -655,6 +655,9 @@ int mgmtCreateMeter(SDbObj *pDb, SCreateTableMsg *pCreate) {
pMeter->gid.vgId = pVgroup->vgId; pMeter->gid.vgId = pVgroup->vgId;
pMeter->uid = (((uint64_t)pMeter->gid.vgId) << 40) + ((((uint64_t)pMeter->gid.sid) & ((1ul << 24) - 1ul)) << 16) + pMeter->uid = (((uint64_t)pMeter->gid.vgId) << 40) + ((((uint64_t)pMeter->gid.sid) & ((1ul << 24) - 1ul)) << 16) +
((uint64_t)sdbVersion & ((1ul << 16) - 1ul)); ((uint64_t)sdbVersion & ((1ul << 16) - 1ul));
mTrace("meter:%s, create meter in vgroup, vgId:%d, sid:%d, vnode:%d, uid:%d",
pMeter->meterId, pVgroup->vgId, sid, pVgroup->vnodeGid[0].vnode, pMeter->uid);
} else { } else {
pMeter->uid = (((uint64_t)pMeter->createdTime) << 16) + ((uint64_t)sdbVersion & ((1ul << 16) - 1ul)); pMeter->uid = (((uint64_t)pMeter->createdTime) << 16) + ((uint64_t)sdbVersion & ((1ul << 16) - 1ul));
} }
...@@ -665,6 +668,8 @@ int mgmtCreateMeter(SDbObj *pDb, SCreateTableMsg *pCreate) { ...@@ -665,6 +668,8 @@ int mgmtCreateMeter(SDbObj *pDb, SCreateTableMsg *pCreate) {
// send create message to the selected vnode servers // send create message to the selected vnode servers
if (pCreate->numOfTags == 0) { if (pCreate->numOfTags == 0) {
mTrace("meter:%s, send msg to dnode, vgId:%d, sid:%d, vnode:%d, dbname:%s",
pMeter->meterId, pMeter->gid.vgId, pMeter->gid.sid, pVgroup->vnodeGid[0].vnode, pDb->name);
mgmtSendCreateMsgToVnode(pMeter, pVgroup->vnodeGid[0].vnode); mgmtSendCreateMsgToVnode(pMeter, pVgroup->vnodeGid[0].vnode);
} }
......
...@@ -177,6 +177,11 @@ int mgmtProcessMeterMetaMsg(char *pMsg, int msgLen, SConnObj *pConn) { ...@@ -177,6 +177,11 @@ int mgmtProcessMeterMetaMsg(char *pMsg, int msgLen, SConnObj *pConn) {
memcpy(pCreateMsg->schema, pInfo->tags, sizeof(STagData)); memcpy(pCreateMsg->schema, pInfo->tags, sizeof(STagData));
strcpy(pCreateMsg->meterId, pInfo->meterId); strcpy(pCreateMsg->meterId, pInfo->meterId);
SDbObj* pMeterDb = mgmtGetDbByMeterId(pCreateMsg->meterId);
mTrace("meter:%s, pConnDb:%p, pConnDbName:%s, pMeterDb:%p, pMeterDbName:%s",
pCreateMsg->meterId, pConn->pDb, pConn->pDb->name, pMeterDb, pMeterDb->name);
assert(pConn->pDb == pMeterDb);
int32_t code = mgmtCreateMeter(pConn->pDb, pCreateMsg); int32_t code = mgmtCreateMeter(pConn->pDb, pCreateMsg);
char stableName[TSDB_METER_ID_LEN] = {0}; char stableName[TSDB_METER_ID_LEN] = {0};
...@@ -877,7 +882,6 @@ int mgmtProcessConnectMsg(char *pMsg, int msgLen, SConnObj *pConn) { ...@@ -877,7 +882,6 @@ int mgmtProcessConnectMsg(char *pMsg, int msgLen, SConnObj *pConn) {
code = TSDB_CODE_INVALID_DB; code = TSDB_CODE_INVALID_DB;
goto _rsp; goto _rsp;
} }
strcpy(pConn->db, dbName);
} }
if (pConn->pAcct) { if (pConn->pAcct) {
...@@ -962,7 +966,10 @@ void *mgmtProcessMsgFromShell(char *msg, void *ahandle, void *thandle) { ...@@ -962,7 +966,10 @@ void *mgmtProcessMsgFromShell(char *msg, void *ahandle, void *thandle) {
} }
if (pConn->pAcct) { if (pConn->pAcct) {
if (strcmp(pConn->db, pHead->db) != 0) pConn->pDb = mgmtGetDb(pHead->db); if (pConn->pDb == NULL ||
strncmp(pConn->pDb->name, pHead->db, tListLen(pConn->pDb->name)) != 0) {
pConn->pDb = mgmtGetDb(pHead->db);
}
char *cont = (char *)pMsg->content + sizeof(SMgmtHead); char *cont = (char *)pMsg->content + sizeof(SMgmtHead);
int contLen = pMsg->msgLen - sizeof(SIntMsg) - sizeof(SMgmtHead); int contLen = pMsg->msgLen - sizeof(SIntMsg) - sizeof(SMgmtHead);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册