未验证 提交 1601a1e5 编写于 作者: S Shengliang Guan 提交者: GitHub

Merge pull request #5470 from taosdata/feature/linux

add some log for debug
...@@ -430,7 +430,7 @@ void qQueryMgmtNotifyClosed(void* pQMgmt) { ...@@ -430,7 +430,7 @@ void qQueryMgmtNotifyClosed(void* pQMgmt) {
} }
SQueryMgmt* pQueryMgmt = pQMgmt; SQueryMgmt* pQueryMgmt = pQMgmt;
qDebug("vgId:%d, set querymgmt closed, wait for all queries cancelled", pQueryMgmt->vgId); qInfo("vgId:%d, set querymgmt closed, wait for all queries cancelled", pQueryMgmt->vgId);
pthread_mutex_lock(&pQueryMgmt->lock); pthread_mutex_lock(&pQueryMgmt->lock);
pQueryMgmt->closed = true; pQueryMgmt->closed = true;
...@@ -445,7 +445,7 @@ void qQueryMgmtReOpen(void *pQMgmt) { ...@@ -445,7 +445,7 @@ void qQueryMgmtReOpen(void *pQMgmt) {
} }
SQueryMgmt *pQueryMgmt = pQMgmt; SQueryMgmt *pQueryMgmt = pQMgmt;
qDebug("vgId:%d, set querymgmt reopen", pQueryMgmt->vgId); qInfo("vgId:%d, set querymgmt reopen", pQueryMgmt->vgId);
pthread_mutex_lock(&pQueryMgmt->lock); pthread_mutex_lock(&pQueryMgmt->lock);
pQueryMgmt->closed = false; pQueryMgmt->closed = false;
......
...@@ -29,7 +29,7 @@ static int32_t syncGetWalVersion(SSyncNode *pNode, SSyncPeer *pPeer) { ...@@ -29,7 +29,7 @@ static int32_t syncGetWalVersion(SSyncNode *pNode, SSyncPeer *pPeer) {
uint64_t fver, wver; uint64_t fver, wver;
int32_t code = (*pNode->getVersionFp)(pNode->vgId, &fver, &wver); int32_t code = (*pNode->getVersionFp)(pNode->vgId, &fver, &wver);
if (code != 0) { if (code != 0) {
sDebug("%s, vnode is commiting while retrieve, last wver:%" PRIu64, pPeer->id, pPeer->lastWalVer); sInfo("%s, vnode is commiting while retrieve, last wver:%" PRIu64, pPeer->id, pPeer->lastWalVer);
return -1; return -1;
} }
...@@ -41,12 +41,12 @@ static bool syncIsWalModified(SSyncNode *pNode, SSyncPeer *pPeer) { ...@@ -41,12 +41,12 @@ static bool syncIsWalModified(SSyncNode *pNode, SSyncPeer *pPeer) {
uint64_t fver, wver; uint64_t fver, wver;
int32_t code = (*pNode->getVersionFp)(pNode->vgId, &fver, &wver); int32_t code = (*pNode->getVersionFp)(pNode->vgId, &fver, &wver);
if (code != 0) { if (code != 0) {
sDebug("%s, vnode is commiting while retrieve, last wver:%" PRIu64, pPeer->id, pPeer->lastWalVer); sInfo("%s, vnode is commiting while retrieve, last wver:%" PRIu64, pPeer->id, pPeer->lastWalVer);
return true; return true;
} }
if (wver != pPeer->lastWalVer) { if (wver != pPeer->lastWalVer) {
sDebug("%s, wal is modified while retrieve, wver:%" PRIu64 ", last:%" PRIu64, pPeer->id, wver, pPeer->lastWalVer); sInfo("%s, wal is modified while retrieve, wver:%" PRIu64 ", last:%" PRIu64, pPeer->id, wver, pPeer->lastWalVer);
return true; return true;
} }
...@@ -57,7 +57,7 @@ static int32_t syncGetFileVersion(SSyncNode *pNode, SSyncPeer *pPeer) { ...@@ -57,7 +57,7 @@ static int32_t syncGetFileVersion(SSyncNode *pNode, SSyncPeer *pPeer) {
uint64_t fver, wver; uint64_t fver, wver;
int32_t code = (*pNode->getVersionFp)(pNode->vgId, &fver, &wver); int32_t code = (*pNode->getVersionFp)(pNode->vgId, &fver, &wver);
if (code != 0) { if (code != 0) {
sDebug("%s, vnode is commiting while get fver for retrieve, last fver:%" PRIu64, pPeer->id, pPeer->lastFileVer); sInfo("%s, vnode is commiting while get fver for retrieve, last fver:%" PRIu64, pPeer->id, pPeer->lastFileVer);
return -1; return -1;
} }
...@@ -69,13 +69,13 @@ static bool syncAreFilesModified(SSyncNode *pNode, SSyncPeer *pPeer) { ...@@ -69,13 +69,13 @@ static bool syncAreFilesModified(SSyncNode *pNode, SSyncPeer *pPeer) {
uint64_t fver, wver; uint64_t fver, wver;
int32_t code = (*pNode->getVersionFp)(pNode->vgId, &fver, &wver); int32_t code = (*pNode->getVersionFp)(pNode->vgId, &fver, &wver);
if (code != 0) { if (code != 0) {
sDebug("%s, vnode is commiting while retrieve, last fver:%" PRIu64, pPeer->id, pPeer->lastFileVer); sInfo("%s, vnode is commiting while retrieve, last fver:%" PRIu64, pPeer->id, pPeer->lastFileVer);
pPeer->fileChanged = 1; pPeer->fileChanged = 1;
return true; return true;
} }
if (fver != pPeer->lastFileVer) { if (fver != pPeer->lastFileVer) {
sDebug("%s, files are modified while retrieve, fver:%" PRIu64 ", last:%" PRIu64, pPeer->id, fver, pPeer->lastFileVer); sInfo("%s, files are modified while retrieve, fver:%" PRIu64 ", last:%" PRIu64, pPeer->id, fver, pPeer->lastFileVer);
pPeer->fileChanged = 1; pPeer->fileChanged = 1;
return true; return true;
} }
...@@ -143,13 +143,13 @@ static int32_t syncReadOneWalRecord(int32_t sfd, SWalHead *pHead) { ...@@ -143,13 +143,13 @@ static int32_t syncReadOneWalRecord(int32_t sfd, SWalHead *pHead) {
} }
if (ret == 0) { if (ret == 0) {
sDebug("sfd:%d, read to the end of file, ret:%d", sfd, ret); sInfo("sfd:%d, read to the end of file, ret:%d", sfd, ret);
return 0; return 0;
} }
if (ret != sizeof(SWalHead)) { if (ret != sizeof(SWalHead)) {
// file is not at end yet, it shall be reloaded // file is not at end yet, it shall be reloaded
sDebug("sfd:%d, a partial wal head is read out, ret:%d", sfd, ret); sInfo("sfd:%d, a partial wal head is read out, ret:%d", sfd, ret);
return 0; return 0;
} }
...@@ -163,7 +163,7 @@ static int32_t syncReadOneWalRecord(int32_t sfd, SWalHead *pHead) { ...@@ -163,7 +163,7 @@ static int32_t syncReadOneWalRecord(int32_t sfd, SWalHead *pHead) {
if (ret != pHead->len) { if (ret != pHead->len) {
// file is not at end yet, it shall be reloaded // file is not at end yet, it shall be reloaded
sDebug("sfd:%d, a partial wal conetnt is read out, ret:%d", sfd, ret); sInfo("sfd:%d, a partial wal conetnt is read out, ret:%d", sfd, ret);
return 0; return 0;
} }
...@@ -184,7 +184,7 @@ static int64_t syncRetrieveLastWal(SSyncPeer *pPeer, char *name, uint64_t fversi ...@@ -184,7 +184,7 @@ static int64_t syncRetrieveLastWal(SSyncPeer *pPeer, char *name, uint64_t fversi
return -1; return -1;
} }
sDebug("%s, retrieve last wal:%s, offset:%" PRId64 " fver:%" PRIu64, pPeer->id, name, offset, fversion); sInfo("%s, retrieve last wal:%s, offset:%" PRId64 " fver:%" PRIu64, pPeer->id, name, offset, fversion);
SWalHead *pHead = malloc(SYNC_MAX_SIZE); SWalHead *pHead = malloc(SYNC_MAX_SIZE);
int64_t bytes = 0; int64_t bytes = 0;
...@@ -198,7 +198,7 @@ static int64_t syncRetrieveLastWal(SSyncPeer *pPeer, char *name, uint64_t fversi ...@@ -198,7 +198,7 @@ static int64_t syncRetrieveLastWal(SSyncPeer *pPeer, char *name, uint64_t fversi
if (code == 0) { if (code == 0) {
code = bytes; code = bytes;
sDebug("%s, read to the end of wal, bytes:%" PRId64, pPeer->id, bytes); sInfo("%s, read to the end of wal, bytes:%" PRId64, pPeer->id, bytes);
break; break;
} }
...@@ -217,7 +217,7 @@ static int64_t syncRetrieveLastWal(SSyncPeer *pPeer, char *name, uint64_t fversi ...@@ -217,7 +217,7 @@ static int64_t syncRetrieveLastWal(SSyncPeer *pPeer, char *name, uint64_t fversi
if (pHead->version >= fversion && fversion > 0) { if (pHead->version >= fversion && fversion > 0) {
code = 0; code = 0;
sDebug("%s, retrieve wal finished, hver:%" PRIu64 " fver:%" PRIu64, pPeer->id, pHead->version, fversion); sInfo("%s, retrieve wal finished, hver:%" PRIu64 " fver:%" PRIu64, pPeer->id, pHead->version, fversion);
break; break;
} }
} }
...@@ -237,7 +237,7 @@ static int64_t syncProcessLastWal(SSyncPeer *pPeer, char *wname, int64_t index) ...@@ -237,7 +237,7 @@ static int64_t syncProcessLastWal(SSyncPeer *pPeer, char *wname, int64_t index)
// get full path to wal file // get full path to wal file
snprintf(fname, sizeof(fname), "%s/%s", pNode->path, wname); snprintf(fname, sizeof(fname), "%s/%s", pNode->path, wname);
sDebug("%s, start to retrieve last wal:%s", pPeer->id, fname); sInfo("%s, start to retrieve last wal:%s", pPeer->id, fname);
while (1) { while (1) {
if (syncAreFilesModified(pNode, pPeer)) return -1; if (syncAreFilesModified(pNode, pPeer)) return -1;
...@@ -245,7 +245,7 @@ static int64_t syncProcessLastWal(SSyncPeer *pPeer, char *wname, int64_t index) ...@@ -245,7 +245,7 @@ static int64_t syncProcessLastWal(SSyncPeer *pPeer, char *wname, int64_t index)
int64_t bytes = syncRetrieveLastWal(pPeer, fname, fversion, offset); int64_t bytes = syncRetrieveLastWal(pPeer, fname, fversion, offset);
if (bytes < 0) { if (bytes < 0) {
sDebug("%s, failed to retrieve last wal, bytes:%" PRId64, pPeer->id, bytes); sInfo("%s, failed to retrieve last wal, bytes:%" PRId64, pPeer->id, bytes);
return bytes; return bytes;
} }
...@@ -257,13 +257,13 @@ static int64_t syncProcessLastWal(SSyncPeer *pPeer, char *wname, int64_t index) ...@@ -257,13 +257,13 @@ static int64_t syncProcessLastWal(SSyncPeer *pPeer, char *wname, int64_t index)
if (fversion == 0) { if (fversion == 0) {
pPeer->sstatus = TAOS_SYNC_STATUS_CACHE; // start to forward pkt pPeer->sstatus = TAOS_SYNC_STATUS_CACHE; // start to forward pkt
fversion = nodeVersion; // must read data to fversion fversion = nodeVersion; // must read data to fversion
sDebug("%s, set sstatus:%s and fver:%" PRIu64, pPeer->id, syncStatus[pPeer->sstatus], fversion); sInfo("%s, set sstatus:%s and fver:%" PRIu64, pPeer->id, syncStatus[pPeer->sstatus], fversion);
} }
} }
// if all data up to fversion is read out, it is over // if all data up to fversion is read out, it is over
if (pPeer->sversion >= fversion && fversion > 0) { if (pPeer->sversion >= fversion && fversion > 0) {
sDebug("%s, data up to fver:%" PRIu64 " has been read out, bytes:%" PRId64 " sver:%" PRIu64, pPeer->id, fversion, bytes, sInfo("%s, data up to fver:%" PRIu64 " has been read out, bytes:%" PRId64 " sver:%" PRIu64, pPeer->id, fversion, bytes,
pPeer->sversion); pPeer->sversion);
return 0; return 0;
} }
...@@ -277,7 +277,7 @@ static int64_t syncProcessLastWal(SSyncPeer *pPeer, char *wname, int64_t index) ...@@ -277,7 +277,7 @@ static int64_t syncProcessLastWal(SSyncPeer *pPeer, char *wname, int64_t index)
// if bytes > 0, file is updated, or fversion is not reached but file still open, read again // if bytes > 0, file is updated, or fversion is not reached but file still open, read again
once = 1; once = 1;
offset += bytes; offset += bytes;
sDebug("%s, continue retrieve last wal, bytes:%" PRId64 " offset:%" PRId64 " sver:%" PRIu64 " fver:%" PRIu64, pPeer->id, sInfo("%s, continue retrieve last wal, bytes:%" PRId64 " offset:%" PRId64 " sver:%" PRIu64 " fver:%" PRIu64, pPeer->id,
bytes, offset, pPeer->sversion, fversion); bytes, offset, pPeer->sversion, fversion);
} }
...@@ -303,7 +303,7 @@ static int64_t syncRetrieveWal(SSyncPeer *pPeer) { ...@@ -303,7 +303,7 @@ static int64_t syncRetrieveWal(SSyncPeer *pPeer) {
if (wname[0] == 0) { // no wal file if (wname[0] == 0) { // no wal file
code = 0; code = 0;
sDebug("%s, no wal file anymore", pPeer->id); sInfo("%s, no wal file anymore", pPeer->id);
break; break;
} }
...@@ -320,12 +320,12 @@ static int64_t syncRetrieveWal(SSyncPeer *pPeer) { ...@@ -320,12 +320,12 @@ static int64_t syncRetrieveWal(SSyncPeer *pPeer) {
struct stat fstat; struct stat fstat;
if (stat(fname, &fstat) < 0) { if (stat(fname, &fstat) < 0) {
code = -1; code = -1;
sDebug("%s, failed to stat wal:%s for retrieve since %s, code:0x%" PRIx64, pPeer->id, fname, strerror(errno), code); sInfo("%s, failed to stat wal:%s for retrieve since %s, code:0x%" PRIx64, pPeer->id, fname, strerror(errno), code);
break; break;
} }
size = fstat.st_size; size = fstat.st_size;
sDebug("%s, retrieve wal:%s size:%d", pPeer->id, fname, size); sInfo("%s, retrieve wal:%s size:%d", pPeer->id, fname, size);
int32_t sfd = open(fname, O_RDONLY | O_BINARY); int32_t sfd = open(fname, O_RDONLY | O_BINARY);
if (sfd < 0) { if (sfd < 0) {
...@@ -374,7 +374,7 @@ static int32_t syncRetrieveFirstPkt(SSyncPeer *pPeer) { ...@@ -374,7 +374,7 @@ static int32_t syncRetrieveFirstPkt(SSyncPeer *pPeer) {
sError("%s, failed to send sync-data msg since %s, tranId:%u", pPeer->id, strerror(errno), msg.tranId); sError("%s, failed to send sync-data msg since %s, tranId:%u", pPeer->id, strerror(errno), msg.tranId);
return -1; return -1;
} }
sDebug("%s, send sync-data msg to peer, tranId:%u", pPeer->id, msg.tranId); sInfo("%s, send sync-data msg to peer, tranId:%u", pPeer->id, msg.tranId);
SSyncRsp rsp; SSyncRsp rsp;
if (taosReadMsg(pPeer->syncFd, &rsp, sizeof(SSyncRsp)) != sizeof(SSyncRsp)) { if (taosReadMsg(pPeer->syncFd, &rsp, sizeof(SSyncRsp)) != sizeof(SSyncRsp)) {
...@@ -382,7 +382,7 @@ static int32_t syncRetrieveFirstPkt(SSyncPeer *pPeer) { ...@@ -382,7 +382,7 @@ static int32_t syncRetrieveFirstPkt(SSyncPeer *pPeer) {
return -1; return -1;
} }
sDebug("%s, recv sync-data rsp from peer, tranId:%u rsp-tranId:%u", pPeer->id, msg.tranId, rsp.tranId); sInfo("%s, recv sync-data rsp from peer, tranId:%u rsp-tranId:%u", pPeer->id, msg.tranId, rsp.tranId);
return 0; return 0;
} }
......
...@@ -482,7 +482,7 @@ static int32_t vnodeProcessTsdbStatus(void *arg, int32_t status, int32_t eno) { ...@@ -482,7 +482,7 @@ static int32_t vnodeProcessTsdbStatus(void *arg, int32_t status, int32_t eno) {
if (status == TSDB_STATUS_COMMIT_START) { if (status == TSDB_STATUS_COMMIT_START) {
pVnode->isCommiting = 1; pVnode->isCommiting = 1;
pVnode->cversion = pVnode->version; pVnode->cversion = pVnode->version;
vDebug("vgId:%d, start commit, fver:%" PRIu64 " vver:%" PRIu64, pVnode->vgId, pVnode->fversion, pVnode->version); vInfo("vgId:%d, start commit, fver:%" PRIu64 " vver:%" PRIu64, pVnode->vgId, pVnode->fversion, pVnode->version);
if (!vnodeInInitStatus(pVnode)) { if (!vnodeInInitStatus(pVnode)) {
return walRenew(pVnode->wal); return walRenew(pVnode->wal);
} }
...@@ -493,7 +493,7 @@ static int32_t vnodeProcessTsdbStatus(void *arg, int32_t status, int32_t eno) { ...@@ -493,7 +493,7 @@ static int32_t vnodeProcessTsdbStatus(void *arg, int32_t status, int32_t eno) {
pVnode->isCommiting = 0; pVnode->isCommiting = 0;
pVnode->isFull = 0; pVnode->isFull = 0;
pVnode->fversion = pVnode->cversion; pVnode->fversion = pVnode->cversion;
vDebug("vgId:%d, commit over, fver:%" PRIu64 " vver:%" PRIu64, pVnode->vgId, pVnode->fversion, pVnode->version); vInfo("vgId:%d, commit over, fver:%" PRIu64 " vver:%" PRIu64, pVnode->vgId, pVnode->fversion, pVnode->version);
if (!vnodeInInitStatus(pVnode)) { if (!vnodeInInitStatus(pVnode)) {
walRemoveOneOldFile(pVnode->wal); walRemoveOneOldFile(pVnode->wal);
} }
......
...@@ -109,6 +109,8 @@ bool vnodeSetResetStatus(SVnodeObj* pVnode) { ...@@ -109,6 +109,8 @@ bool vnodeSetResetStatus(SVnodeObj* pVnode) {
taosMsleep(1); taosMsleep(1);
} }
vInfo("vgId:%d, set to reset status", pVnode->vgId);
// release local resources only after cutting off outside connections // release local resources only after cutting off outside connections
qQueryMgmtNotifyClosed(pVnode->qMgmt); qQueryMgmtNotifyClosed(pVnode->qMgmt);
vnodeWaitReadCompleted(pVnode); vnodeWaitReadCompleted(pVnode);
......
...@@ -91,7 +91,7 @@ void vnodeStartSyncFile(int32_t vgId) { ...@@ -91,7 +91,7 @@ void vnodeStartSyncFile(int32_t vgId) {
return; return;
} }
vDebug("vgId:%d, datafile will be synced", vgId); vInfo("vgId:%d, datafile will be synced", vgId);
vnodeSetResetStatus(pVnode); vnodeSetResetStatus(pVnode);
vnodeRelease(pVnode); vnodeRelease(pVnode);
...@@ -147,7 +147,7 @@ int32_t vnodeGetVersion(int32_t vgId, uint64_t *fver, uint64_t *wver) { ...@@ -147,7 +147,7 @@ int32_t vnodeGetVersion(int32_t vgId, uint64_t *fver, uint64_t *wver) {
int32_t code = 0; int32_t code = 0;
if (pVnode->isCommiting) { if (pVnode->isCommiting) {
vDebug("vgId:%d, vnode is commiting while get version", vgId); vInfo("vgId:%d, vnode is commiting while get version", vgId);
code = -1; code = -1;
} else { } else {
*fver = pVnode->fversion; *fver = pVnode->fversion;
...@@ -168,7 +168,7 @@ int32_t vnodeResetVersion(int32_t vgId, uint64_t fver) { ...@@ -168,7 +168,7 @@ int32_t vnodeResetVersion(int32_t vgId, uint64_t fver) {
pVnode->fversion = fver; pVnode->fversion = fver;
pVnode->version = fver; pVnode->version = fver;
walResetVersion(pVnode->wal, fver); walResetVersion(pVnode->wal, fver);
vDebug("vgId:%d, version reset to %" PRIu64, vgId, fver); vInfo("vgId:%d, version reset to %" PRIu64, vgId, fver);
vnodeRelease(pVnode); vnodeRelease(pVnode);
return 0; return 0;
......
...@@ -455,7 +455,7 @@ uint64_t walGetVersion(twalh param) { ...@@ -455,7 +455,7 @@ uint64_t walGetVersion(twalh param) {
void walResetVersion(twalh param, uint64_t newVer) { void walResetVersion(twalh param, uint64_t newVer) {
SWal *pWal = param; SWal *pWal = param;
if (pWal == 0) return; if (pWal == 0) return;
wDebug("vgId:%d, version reset from %" PRIu64 " to %" PRIu64, pWal->vgId, pWal->version, newVer); wInfo("vgId:%d, version reset from %" PRIu64 " to %" PRIu64, pWal->vgId, pWal->version, newVer);
pWal->version = newVer; pWal->version = newVer;
} }
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册