fix a little bug

This commit is contained in:
Hongze Cheng 2021-01-19 06:43:01 +00:00
parent 7d006b6f8e
commit 514e6ca49f
1 changed files with 3 additions and 3 deletions

View File

@ -49,7 +49,7 @@ int tsdbSyncSend(STsdbRepo *pRepo, int socketFd) {
tsdbInitSyncH(&synch, pRepo, socketFd); tsdbInitSyncH(&synch, pRepo, socketFd);
// Disable TSDB commit // Disable TSDB commit
sem_post(&(pRepo->readyToCommit)); sem_wait(&(pRepo->readyToCommit));
if (tsdbSyncSendMeta(&synch) < 0) { if (tsdbSyncSendMeta(&synch) < 0) {
tsdbError("vgId:%d failed to send meta file since %s", REPO_ID(pRepo), tstrerror(terrno)); tsdbError("vgId:%d failed to send meta file since %s", REPO_ID(pRepo), tstrerror(terrno));
@ -62,12 +62,12 @@ int tsdbSyncSend(STsdbRepo *pRepo, int socketFd) {
} }
// Enable TSDB commit // Enable TSDB commit
sem_wait(&(pRepo->readyToCommit)); sem_post(&(pRepo->readyToCommit));
tsdbDestroySyncH(&synch); tsdbDestroySyncH(&synch);
return 0; return 0;
_err: _err:
sem_wait(&(pRepo->readyToCommit)); sem_post(&(pRepo->readyToCommit));
tsdbDestroySyncH(&synch); tsdbDestroySyncH(&synch);
return -1; return -1;
} }