From 1154f90aa0c6841c0e0758c6a04b583575430732 Mon Sep 17 00:00:00 2001 From: Hongze Cheng Date: Tue, 10 Jan 2023 17:00:25 +0800 Subject: [PATCH] fix: cond wait EINVAL --- source/dnode/vnode/src/vnd/vnodeCommit.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/source/dnode/vnode/src/vnd/vnodeCommit.c b/source/dnode/vnode/src/vnd/vnodeCommit.c index d3fe8e6cc5..8cbeadb229 100644 --- a/source/dnode/vnode/src/vnd/vnodeCommit.c +++ b/source/dnode/vnode/src/vnd/vnodeCommit.c @@ -85,8 +85,13 @@ static int32_t vnodeGetBufPoolToUse(SVnode *pVnode) { struct timeval tv; struct timespec ts; taosGetTimeOfDay(&tv); - ts.tv_sec = tv.tv_sec; ts.tv_nsec = tv.tv_usec * 1000 + WAIT_TIME_MILI_SEC * 1000000; + if (ts.tv_nsec > 999999999l) { + ts.tv_sec = tv.tv_sec + 1; + ts.tv_nsec -= 1000000000l; + } else { + ts.tv_sec = tv.tv_sec; + } int32_t rc = taosThreadCondTimedWait(&pVnode->poolNotEmpty, &pVnode->mutex, &ts); if (rc && rc != ETIMEDOUT) { @@ -134,6 +139,7 @@ int vnodeBegin(SVnode *pVnode) { _exit: if (code) { + terrno = code; vError("vgId:%d %s failed at line %d since %s", TD_VID(pVnode), __func__, lino, tstrerror(code)); } return code; -- GitLab