diff --git a/source/dnode/mgmt/impl/test/sut/inc/base.h b/source/dnode/mgmt/impl/test/sut/inc/base.h index fef7ad9d43..41382fbab5 100644 --- a/source/dnode/mgmt/impl/test/sut/inc/base.h +++ b/source/dnode/mgmt/impl/test/sut/inc/base.h @@ -71,7 +71,7 @@ class Testbase { const char* GetShowBinary(int32_t len); private: - int32_t showId; + int64_t showId; STableMetaMsg* pMeta; SRetrieveTableRsp* pRetrieveRsp; char* pData; diff --git a/source/dnode/mgmt/impl/test/sut/src/base.cpp b/source/dnode/mgmt/impl/test/sut/src/base.cpp index e14dc94d31..429d5a6976 100644 --- a/source/dnode/mgmt/impl/test/sut/src/base.cpp +++ b/source/dnode/mgmt/impl/test/sut/src/base.cpp @@ -79,7 +79,7 @@ void Testbase::SendShowMetaMsg(int8_t showType, const char* db) { SShowRsp* pShowRsp = (SShowRsp*)pMsg->pCont; ASSERT(pShowRsp != nullptr); - pShowRsp->showId = htonl(pShowRsp->showId); + pShowRsp->showId = htobe64(pShowRsp->showId); pMeta = &pShowRsp->tableMeta; pMeta->numOfTags = htonl(pMeta->numOfTags); pMeta->numOfColumns = htonl(pMeta->numOfColumns); @@ -121,7 +121,7 @@ void Testbase::SendShowRetrieveMsg() { int32_t contLen = sizeof(SRetrieveTableMsg); SRetrieveTableMsg* pRetrieve = (SRetrieveTableMsg*)rpcMallocCont(contLen); - pRetrieve->showId = htonl(showId); + pRetrieve->showId = htobe64(showId); pRetrieve->free = 0; SRpcMsg* pMsg = SendMsg(TDMT_MND_SHOW_RETRIEVE, pRetrieve, contLen); diff --git a/source/dnode/mnode/impl/src/mndCluster.c b/source/dnode/mnode/impl/src/mndCluster.c index 427fe55e1d..1c12109f38 100644 --- a/source/dnode/mnode/impl/src/mndCluster.c +++ b/source/dnode/mnode/impl/src/mndCluster.c @@ -33,7 +33,7 @@ static void mndCancelGetNextCluster(SMnode *pMnode, void *pIter); int32_t mndInitCluster(SMnode *pMnode) { SSdbTable table = {.sdbType = SDB_CLUSTER, - .keyType = SDB_KEY_INT32, + .keyType = SDB_KEY_INT64, .deployFp = (SdbDeployFp)mndCreateDefaultCluster, .encodeFp = (SdbEncodeFp)mndClusterActionEncode, .decodeFp = (SdbDecodeFp)mndClusterActionDecode, @@ -128,6 +128,7 @@ static int32_t mndCreateDefaultCluster(SMnode *pMnode) { clusterObj.id = mndGenerateUid(clusterObj.name, TSDB_CLUSTER_ID_LEN); clusterObj.id = (clusterObj.id >= 0 ? clusterObj.id : -clusterObj.id); + pMnode->clusterId = clusterObj.id; mDebug("cluster:%" PRId64 ", name is %s", clusterObj.id, clusterObj.name); SSdbRaw *pRaw = mndClusterActionEncode(&clusterObj); diff --git a/source/dnode/mnode/sdb/inc/sdbInt.h b/source/dnode/mnode/sdb/inc/sdbInt.h index da90451202..070aa56944 100644 --- a/source/dnode/mnode/sdb/inc/sdbInt.h +++ b/source/dnode/mnode/sdb/inc/sdbInt.h @@ -72,7 +72,9 @@ typedef struct SSdb { } SSdb; 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 } diff --git a/source/dnode/mnode/sdb/src/sdbFile.c b/source/dnode/mnode/sdb/src/sdbFile.c index 78cf0a3492..5a03b3409e 100644 --- a/source/dnode/mnode/sdb/src/sdbFile.c +++ b/source/dnode/mnode/sdb/src/sdbFile.c @@ -121,6 +121,8 @@ int32_t sdbWriteFile(SSdb *pSdb) { char curfile[PATH_MAX] = {0}; snprintf(curfile, sizeof(curfile), "%s%ssdb.data", pSdb->currDir, TD_DIRSEP); + mDebug("start to write file:%s", curfile); + FileFd fd = taosOpenFileCreateWrite(tmpfile); if (fd <= 0) { terrno = TAOS_SYSTEM_ERROR(errno); @@ -132,6 +134,8 @@ int32_t sdbWriteFile(SSdb *pSdb) { SdbEncodeFp encodeFp = pSdb->encodeFps[i]; if (encodeFp == NULL) continue; + mTrace("sdb write %s, total %d rows", sdbTableName(i), sdbGetSize(pSdb, i)); + SHashObj *hash = pSdb->hashObjs[i]; SRWLatch *pLock = &pSdb->locks[i]; taosWLockLatch(pLock); @@ -144,6 +148,8 @@ int32_t sdbWriteFile(SSdb *pSdb) { continue; } + sdbPrintOper(pSdb, pRow, "writeFile"); + SSdbRaw *pRaw = (*encodeFp)(pRow->pObj); if (pRaw != NULL) { pRaw->status = pRow->status; diff --git a/source/dnode/mnode/sdb/src/sdbHash.c b/source/dnode/mnode/sdb/src/sdbHash.c index 23bcdb1b60..597484dad1 100644 --- a/source/dnode/mnode/sdb/src/sdbHash.c +++ b/source/dnode/mnode/sdb/src/sdbHash.c @@ -16,7 +16,7 @@ #define _DEFAULT_SOURCE #include "sdbInt.h" -static const char *sdbTableName(ESdbType type) { +const char *sdbTableName(ESdbType type) { switch (type) { case SDB_TRANS: return "trans";