return wal fsync error code
This commit is contained in:
parent
4701a92f26
commit
fcce9ebafa
|
@ -164,7 +164,7 @@ void walClose(SWal *);
|
||||||
// write interfaces
|
// write interfaces
|
||||||
// By assigning index by the caller, wal gurantees linearizability
|
// By assigning index by the caller, wal gurantees linearizability
|
||||||
int32_t walAppendLog(SWal *, int64_t index, tmsg_t msgType, SWalSyncInfo syncMeta, const void *body, int32_t bodyLen);
|
int32_t walAppendLog(SWal *, int64_t index, tmsg_t msgType, SWalSyncInfo syncMeta, const void *body, int32_t bodyLen);
|
||||||
void walFsync(SWal *, bool force);
|
int32_t walFsync(SWal *, bool force);
|
||||||
|
|
||||||
// apis for lifecycle management
|
// apis for lifecycle management
|
||||||
int32_t walCommit(SWal *, int64_t ver);
|
int32_t walCommit(SWal *, int64_t ver);
|
||||||
|
|
|
@ -227,7 +227,11 @@ static int32_t raftLogAppendEntry(struct SSyncLogStore* pLogStore, SSyncRaftEntr
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
walFsync(pWal, forceSync);
|
code = walFsync(pWal, forceSync);
|
||||||
|
if (TSDB_CODE_SUCCESS != code) {
|
||||||
|
sNError(pData->pSyncNode, "wal fsync failed since %s", tstrerror(code));
|
||||||
|
TAOS_RETURN(code);
|
||||||
|
}
|
||||||
|
|
||||||
sNTrace(pData->pSyncNode, "write index:%" PRId64 ", type:%s, origin type:%s, elapsed:%" PRId64, pEntry->index,
|
sNTrace(pData->pSyncNode, "write index:%" PRId64 ", type:%s, origin type:%s, elapsed:%" PRId64, pEntry->index,
|
||||||
TMSG_INFO(pEntry->msgType), TMSG_INFO(pEntry->originalRpcType), tsElapsed);
|
TMSG_INFO(pEntry->msgType), TMSG_INFO(pEntry->originalRpcType), tsElapsed);
|
||||||
|
|
|
@ -732,9 +732,11 @@ _exit:
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
|
||||||
void walFsync(SWal *pWal, bool forceFsync) {
|
int32_t walFsync(SWal *pWal, bool forceFsync) {
|
||||||
|
int32_t code = 0;
|
||||||
|
|
||||||
if (pWal->cfg.level == TAOS_WAL_SKIP) {
|
if (pWal->cfg.level == TAOS_WAL_SKIP) {
|
||||||
return;
|
return code;
|
||||||
}
|
}
|
||||||
|
|
||||||
taosThreadMutexLock(&pWal->mutex);
|
taosThreadMutexLock(&pWal->mutex);
|
||||||
|
@ -743,7 +745,10 @@ void walFsync(SWal *pWal, bool forceFsync) {
|
||||||
if (taosFsyncFile(pWal->pLogFile) < 0) {
|
if (taosFsyncFile(pWal->pLogFile) < 0) {
|
||||||
wError("vgId:%d, file:%" PRId64 ".log, fsync failed since %s", pWal->cfg.vgId, walGetCurFileFirstVer(pWal),
|
wError("vgId:%d, file:%" PRId64 ".log, fsync failed since %s", pWal->cfg.vgId, walGetCurFileFirstVer(pWal),
|
||||||
strerror(errno));
|
strerror(errno));
|
||||||
|
code = TAOS_SYSTEM_ERROR(errno);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
taosThreadMutexUnlock(&pWal->mutex);
|
taosThreadMutexUnlock(&pWal->mutex);
|
||||||
|
|
||||||
|
return code;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue