From d06bfd9ceacb86c38b825f0766c65703d782ee06 Mon Sep 17 00:00:00 2001 From: dmchen Date: Tue, 2 Apr 2024 02:30:56 +0000 Subject: [PATCH] free and log --- source/dnode/mnode/sdb/src/sdbFile.c | 4 ++-- source/dnode/vnode/src/tsdb/tsdbReaderWriter.c | 4 ++-- source/libs/tdb/src/db/tdbPager.c | 4 ++-- source/libs/wal/src/walRead.c | 2 +- source/libs/wal/src/walWrite.c | 9 ++++----- 5 files changed, 11 insertions(+), 12 deletions(-) diff --git a/source/dnode/mnode/sdb/src/sdbFile.c b/source/dnode/mnode/sdb/src/sdbFile.c index 69983eac30..8b2d6ba0cb 100644 --- a/source/dnode/mnode/sdb/src/sdbFile.c +++ b/source/dnode/mnode/sdb/src/sdbFile.c @@ -322,7 +322,7 @@ static int32_t sdbReadFileImp(SSdb *pSdb) { count = CBC_Decrypt(&opts); - mInfo("read sdb, CBC_Decrypt dataLen:%d, descrypted len:%d, %s", pRaw->dataLen, count, __FUNCTION__); + mDebug("read sdb, CBC_Decrypt dataLen:%d, descrypted len:%d, %s", pRaw->dataLen, count, __FUNCTION__); memcpy(pRaw->pData, plantContent, pRaw->dataLen); taosMemoryFree(plantContent); @@ -456,7 +456,7 @@ static int32_t sdbWriteFileImp(SSdb *pSdb) { int32_t count = CBC_Encrypt(&opts); - mInfo("write sdb, CBC_Encrypt encryptedDataLen:%d, dataLen:%d, %s", + mDebug("write sdb, CBC_Encrypt encryptedDataLen:%d, dataLen:%d, %s", newDataLen, pRaw->dataLen, __FUNCTION__); } diff --git a/source/dnode/vnode/src/tsdb/tsdbReaderWriter.c b/source/dnode/vnode/src/tsdb/tsdbReaderWriter.c index 46e0e01dc2..730b9ddc32 100644 --- a/source/dnode/vnode/src/tsdb/tsdbReaderWriter.c +++ b/source/dnode/vnode/src/tsdb/tsdbReaderWriter.c @@ -174,7 +174,7 @@ static int32_t tsdbWriteFilePage(STsdbFD *pFD, int32_t encryptAlgorithm, char* e memcpy(pFD->pBuf + count, PacketData, NewLen); count += NewLen; } - tsdbInfo("CBC_Encrypt count:%d %s", count, __FUNCTION__); + tsdbDebug("CBC_Encrypt count:%d %s", count, __FUNCTION__); } n = taosWriteFile(pFD->pFD, pFD->pBuf, pFD->szPage); @@ -264,7 +264,7 @@ static int32_t tsdbReadFilePage(STsdbFD *pFD, int64_t pgno, int32_t encryptAlgor memcpy(pFD->pBuf + count, PacketData, NewLen); count += NewLen; } - tsdbInfo("CBC_Decrypt count:%d %s", count, __FUNCTION__); + tsdbDebug("CBC_Decrypt count:%d %s", count, __FUNCTION__); } } diff --git a/source/libs/tdb/src/db/tdbPager.c b/source/libs/tdb/src/db/tdbPager.c index 94bed771da..42823c9dfb 100644 --- a/source/libs/tdb/src/db/tdbPager.c +++ b/source/libs/tdb/src/db/tdbPager.c @@ -897,7 +897,7 @@ static int tdbPagerInitPage(SPager *pPager, SPage *pPage, int (*initPage)(SPage memcpy(pPage->pData + count, PacketData, NewLen); count += NewLen; } - tdbInfo("CBC_Decrypt count:%d %s", count, __FUNCTION__); + tdbDebug("CBC_Decrypt count:%d %s", count, __FUNCTION__); } } else { init = 0; @@ -1011,7 +1011,7 @@ static int tdbPagerPWritePageToDB(SPager *pPager, SPage *pPage) { memcpy(buf + count, PacketData, NewLen); count += NewLen; } - tdbInfo("CBC_Encrypt count:%d %s", count, __FUNCTION__); + tdbDebug("CBC_Encrypt count:%d %s", count, __FUNCTION__); } ret = tdbOsPWrite(pPager->fd, buf, pPage->pageSize, offset); diff --git a/source/libs/wal/src/walRead.c b/source/libs/wal/src/walRead.c index 17983a82bc..594e50a722 100644 --- a/source/libs/wal/src/walRead.c +++ b/source/libs/wal/src/walRead.c @@ -527,7 +527,7 @@ void decryptBody(SWalCfg* cfg, SWalCkHead* pHead, int32_t plainBodyLen, const ch int32_t count = CBC_Decrypt(&opts); - wInfo("CBC_Decrypt cryptedBodyLen:%d, plainBodyLen:%d, %s", count, plainBodyLen, func); + wDebug("CBC_Decrypt cryptedBodyLen:%d, plainBodyLen:%d, %s", count, plainBodyLen, func); memcpy(pHead->head.body, newBody, plainBodyLen); diff --git a/source/libs/wal/src/walWrite.c b/source/libs/wal/src/walWrite.c index 3aa971d43a..b6644893bd 100644 --- a/source/libs/wal/src/walWrite.c +++ b/source/libs/wal/src/walWrite.c @@ -545,7 +545,6 @@ static FORCE_INLINE int32_t walWriteImpl(SWal *pWal, int64_t index, tmsg_t msgTy wError("vgId:%d, file:%" PRId64 ".log, failed to malloc since %s", pWal->cfg.vgId, walGetLastFileFirstVer(pWal), strerror(errno)); code = -1; - if(newBodyEncrypted != NULL) taosMemoryFreeClear(newBodyEncrypted); if(newBody != NULL) taosMemoryFreeClear(newBody); goto END; } @@ -555,11 +554,11 @@ static FORCE_INLINE int32_t walWriteImpl(SWal *pWal, int64_t index, tmsg_t msgTy opts.source = newBody; opts.result = newBodyEncrypted; opts.unitLen = 16; - strncpy(opts.key, pWal->cfg.encryptKey, 16); + strncpy(opts.key, pWal->cfg.encryptKey, ENCRYPT_KEY_LEN); int32_t count = CBC_Encrypt(&opts); - wInfo("vgId:%d, file:%" PRId64 ".log, index:%" PRId64 ", CBC_Encrypt cryptedBodyLen:%d, plainBodyLen:%d, %s", + wDebug("vgId:%d, file:%" PRId64 ".log, index:%" PRId64 ", CBC_Encrypt cryptedBodyLen:%d, plainBodyLen:%d, %s", pWal->cfg.vgId, walGetLastFileFirstVer(pWal), index, count, plainBodyLen, __FUNCTION__); buf = newBodyEncrypted; @@ -580,8 +579,8 @@ static FORCE_INLINE int32_t walWriteImpl(SWal *pWal, int64_t index, tmsg_t msgTy if(pWal->cfg.encryptAlgorithm == DND_CA_SM4){ taosMemoryFree(newBody); taosMemoryFree(newBodyEncrypted); - wInfo("vgId:%d, free newBody newBodyEncrypted %s", - pWal->cfg.vgId, __FUNCTION__); + //wInfo("vgId:%d, free newBody newBodyEncrypted %s", + // pWal->cfg.vgId, __FUNCTION__); } // set status