This commit is contained in:
Shengliang Guan 2021-12-30 18:52:10 -08:00
parent 3c0077a38f
commit c9b8e7485f
6 changed files with 15 additions and 6 deletions

View File

@ -71,7 +71,7 @@ class Testbase {
const char* GetShowBinary(int32_t len); const char* GetShowBinary(int32_t len);
private: private:
int32_t showId; int64_t showId;
STableMetaMsg* pMeta; STableMetaMsg* pMeta;
SRetrieveTableRsp* pRetrieveRsp; SRetrieveTableRsp* pRetrieveRsp;
char* pData; char* pData;

View File

@ -79,7 +79,7 @@ void Testbase::SendShowMetaMsg(int8_t showType, const char* db) {
SShowRsp* pShowRsp = (SShowRsp*)pMsg->pCont; SShowRsp* pShowRsp = (SShowRsp*)pMsg->pCont;
ASSERT(pShowRsp != nullptr); ASSERT(pShowRsp != nullptr);
pShowRsp->showId = htonl(pShowRsp->showId); pShowRsp->showId = htobe64(pShowRsp->showId);
pMeta = &pShowRsp->tableMeta; pMeta = &pShowRsp->tableMeta;
pMeta->numOfTags = htonl(pMeta->numOfTags); pMeta->numOfTags = htonl(pMeta->numOfTags);
pMeta->numOfColumns = htonl(pMeta->numOfColumns); pMeta->numOfColumns = htonl(pMeta->numOfColumns);
@ -121,7 +121,7 @@ void Testbase::SendShowRetrieveMsg() {
int32_t contLen = sizeof(SRetrieveTableMsg); int32_t contLen = sizeof(SRetrieveTableMsg);
SRetrieveTableMsg* pRetrieve = (SRetrieveTableMsg*)rpcMallocCont(contLen); SRetrieveTableMsg* pRetrieve = (SRetrieveTableMsg*)rpcMallocCont(contLen);
pRetrieve->showId = htonl(showId); pRetrieve->showId = htobe64(showId);
pRetrieve->free = 0; pRetrieve->free = 0;
SRpcMsg* pMsg = SendMsg(TDMT_MND_SHOW_RETRIEVE, pRetrieve, contLen); SRpcMsg* pMsg = SendMsg(TDMT_MND_SHOW_RETRIEVE, pRetrieve, contLen);

View File

@ -33,7 +33,7 @@ static void mndCancelGetNextCluster(SMnode *pMnode, void *pIter);
int32_t mndInitCluster(SMnode *pMnode) { int32_t mndInitCluster(SMnode *pMnode) {
SSdbTable table = {.sdbType = SDB_CLUSTER, SSdbTable table = {.sdbType = SDB_CLUSTER,
.keyType = SDB_KEY_INT32, .keyType = SDB_KEY_INT64,
.deployFp = (SdbDeployFp)mndCreateDefaultCluster, .deployFp = (SdbDeployFp)mndCreateDefaultCluster,
.encodeFp = (SdbEncodeFp)mndClusterActionEncode, .encodeFp = (SdbEncodeFp)mndClusterActionEncode,
.decodeFp = (SdbDecodeFp)mndClusterActionDecode, .decodeFp = (SdbDecodeFp)mndClusterActionDecode,
@ -128,6 +128,7 @@ static int32_t mndCreateDefaultCluster(SMnode *pMnode) {
clusterObj.id = mndGenerateUid(clusterObj.name, TSDB_CLUSTER_ID_LEN); clusterObj.id = mndGenerateUid(clusterObj.name, TSDB_CLUSTER_ID_LEN);
clusterObj.id = (clusterObj.id >= 0 ? clusterObj.id : -clusterObj.id); clusterObj.id = (clusterObj.id >= 0 ? clusterObj.id : -clusterObj.id);
pMnode->clusterId = clusterObj.id;
mDebug("cluster:%" PRId64 ", name is %s", clusterObj.id, clusterObj.name); mDebug("cluster:%" PRId64 ", name is %s", clusterObj.id, clusterObj.name);
SSdbRaw *pRaw = mndClusterActionEncode(&clusterObj); SSdbRaw *pRaw = mndClusterActionEncode(&clusterObj);

View File

@ -72,7 +72,9 @@ typedef struct SSdb {
} SSdb; } SSdb;
int32_t sdbWriteFile(SSdb *pSdb); int32_t sdbWriteFile(SSdb *pSdb);
void sdbPrintOper(SSdb *pSdb, SSdbRow *pRow, const char *oper);
const char *sdbTableName(ESdbType type);
void sdbPrintOper(SSdb *pSdb, SSdbRow *pRow, const char *oper);
#ifdef __cplusplus #ifdef __cplusplus
} }

View File

@ -121,6 +121,8 @@ int32_t sdbWriteFile(SSdb *pSdb) {
char curfile[PATH_MAX] = {0}; char curfile[PATH_MAX] = {0};
snprintf(curfile, sizeof(curfile), "%s%ssdb.data", pSdb->currDir, TD_DIRSEP); snprintf(curfile, sizeof(curfile), "%s%ssdb.data", pSdb->currDir, TD_DIRSEP);
mDebug("start to write file:%s", curfile);
FileFd fd = taosOpenFileCreateWrite(tmpfile); FileFd fd = taosOpenFileCreateWrite(tmpfile);
if (fd <= 0) { if (fd <= 0) {
terrno = TAOS_SYSTEM_ERROR(errno); terrno = TAOS_SYSTEM_ERROR(errno);
@ -132,6 +134,8 @@ int32_t sdbWriteFile(SSdb *pSdb) {
SdbEncodeFp encodeFp = pSdb->encodeFps[i]; SdbEncodeFp encodeFp = pSdb->encodeFps[i];
if (encodeFp == NULL) continue; if (encodeFp == NULL) continue;
mTrace("sdb write %s, total %d rows", sdbTableName(i), sdbGetSize(pSdb, i));
SHashObj *hash = pSdb->hashObjs[i]; SHashObj *hash = pSdb->hashObjs[i];
SRWLatch *pLock = &pSdb->locks[i]; SRWLatch *pLock = &pSdb->locks[i];
taosWLockLatch(pLock); taosWLockLatch(pLock);
@ -144,6 +148,8 @@ int32_t sdbWriteFile(SSdb *pSdb) {
continue; continue;
} }
sdbPrintOper(pSdb, pRow, "writeFile");
SSdbRaw *pRaw = (*encodeFp)(pRow->pObj); SSdbRaw *pRaw = (*encodeFp)(pRow->pObj);
if (pRaw != NULL) { if (pRaw != NULL) {
pRaw->status = pRow->status; pRaw->status = pRow->status;

View File

@ -16,7 +16,7 @@
#define _DEFAULT_SOURCE #define _DEFAULT_SOURCE
#include "sdbInt.h" #include "sdbInt.h"
static const char *sdbTableName(ESdbType type) { const char *sdbTableName(ESdbType type) {
switch (type) { switch (type) {
case SDB_TRANS: case SDB_TRANS:
return "trans"; return "trans";