fix possible race condition
This commit is contained in:
parent
6f5ee32d0f
commit
3b37cb6e68
|
@ -85,6 +85,7 @@ int32_t tsdbSyncRecv(void *tsdb, SOCKET socketFd) {
|
||||||
pRepo->state = TSDB_STATE_OK;
|
pRepo->state = TSDB_STATE_OK;
|
||||||
|
|
||||||
tsdbInitSyncH(&synch, pRepo, socketFd);
|
tsdbInitSyncH(&synch, pRepo, socketFd);
|
||||||
|
tsem_wait(&(pRepo->readyToCommit));
|
||||||
tsdbStartFSTxn(pRepo, 0, 0);
|
tsdbStartFSTxn(pRepo, 0, 0);
|
||||||
|
|
||||||
if (tsdbSyncRecvMeta(&synch) < 0) {
|
if (tsdbSyncRecvMeta(&synch) < 0) {
|
||||||
|
@ -98,6 +99,7 @@ int32_t tsdbSyncRecv(void *tsdb, SOCKET socketFd) {
|
||||||
}
|
}
|
||||||
|
|
||||||
tsdbEndFSTxn(pRepo);
|
tsdbEndFSTxn(pRepo);
|
||||||
|
tsem_post(&(pRepo->readyToCommit));
|
||||||
tsdbDestroySyncH(&synch);
|
tsdbDestroySyncH(&synch);
|
||||||
|
|
||||||
// Reload file change
|
// Reload file change
|
||||||
|
@ -107,6 +109,7 @@ int32_t tsdbSyncRecv(void *tsdb, SOCKET socketFd) {
|
||||||
|
|
||||||
_err:
|
_err:
|
||||||
tsdbEndFSTxnWithError(REPO_FS(pRepo));
|
tsdbEndFSTxnWithError(REPO_FS(pRepo));
|
||||||
|
tsem_post(&(pRepo->readyToCommit));
|
||||||
tsdbDestroySyncH(&synch);
|
tsdbDestroySyncH(&synch);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue