Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

enh: propagate code of vnodeSnapRead as terrno upwards #25555

Merged
merged 1 commit into from
Apr 29, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
19 changes: 9 additions & 10 deletions source/libs/sync/src/syncSnapshot.c
Original file line number Diff line number Diff line change
Expand Up @@ -285,10 +285,11 @@ static int32_t snapshotSend(SSyncSnapshotSender *pSender) {
pBlk->seq = pSender->seq;

// read data
int32_t ret = pSender->pSyncNode->pFsm->FpSnapshotDoRead(pSender->pSyncNode->pFsm, pSender->pReader,
&pBlk->pBlock, &pBlk->blockLen);
if (ret != 0) {
sSError(pSender, "snapshot sender read failed since %s", terrstr());
code = pSender->pSyncNode->pFsm->FpSnapshotDoRead(pSender->pSyncNode->pFsm, pSender->pReader, &pBlk->pBlock,
&pBlk->blockLen);
if (code != 0) {
terrno = code;
sSError(pSender, "snapshot sender read failed since %s", tstrerror(code));
goto _OUT;
}

Expand Down Expand Up @@ -357,7 +358,7 @@ int32_t snapshotReSend(SSyncSnapshotSender *pSender) {
}

if (pSender->seq != SYNC_SNAPSHOT_SEQ_END && pSndBuf->end <= pSndBuf->start) {
if (snapshotSend(pSender) != 0) {
if ((code = snapshotSend(pSender)) != 0) {
goto _out;
}
}
Expand Down Expand Up @@ -1188,15 +1189,13 @@ static int32_t syncSnapBufferSend(SSyncSnapshotSender *pSender, SyncSnapshotRsp
}

while (pSender->seq != SYNC_SNAPSHOT_SEQ_END && pSender->seq - pSndBuf->start < tsSnapReplMaxWaitN) {
if (snapshotSend(pSender) != 0) {
code = terrno;
if ((code = snapshotSend(pSender)) != 0) {
goto _out;
}
}

if (pSender->seq == SYNC_SNAPSHOT_SEQ_END && pSndBuf->end <= pSndBuf->start) {
if (snapshotSend(pSender) != 0) {
code = terrno;
if ((code = snapshotSend(pSender)) != 0) {
goto _out;
}
}
Expand Down Expand Up @@ -1225,7 +1224,7 @@ int32_t syncNodeOnSnapshotRsp(SSyncNode *pSyncNode, SRpcMsg *pRpcMsg) {
}

if (!snapshotSenderIsStart(pSender)) {
sSError(pSender, "snapshot sender not started yet. sender startTime:%" PRId64 ", msg startTime:%" PRId64,
sSError(pSender, "snapshot sender stopped. sender startTime:%" PRId64 ", msg startTime:%" PRId64,
pSender->startTime, pMsg->startTime);
return -1;
}
Expand Down