fix: possible race condition
This commit is contained in:
parent
6982935df7
commit
38b036ff36
|
@ -793,12 +793,7 @@ int32_t tsdbCloseFS(STFileSystem **fs) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int64_t tsdbFSAllocEid(STFileSystem *fs) {
|
int64_t tsdbFSAllocEid(STFileSystem *fs) { return atomic_add_fetch_64(&fs->neid, 1); }
|
||||||
taosThreadRwlockRdlock(&fs->tsdb->rwLock);
|
|
||||||
int64_t cid = ++fs->neid;
|
|
||||||
taosThreadRwlockUnlock(&fs->tsdb->rwLock);
|
|
||||||
return cid;
|
|
||||||
}
|
|
||||||
|
|
||||||
int32_t tsdbFSEditBegin(STFileSystem *fs, const TFileOpArray *opArray, EFEditT etype) {
|
int32_t tsdbFSEditBegin(STFileSystem *fs, const TFileOpArray *opArray, EFEditT etype) {
|
||||||
int32_t code = 0;
|
int32_t code = 0;
|
||||||
|
|
|
@ -89,13 +89,13 @@ struct STFSBgTask {
|
||||||
|
|
||||||
/* Exposed Structs */
|
/* Exposed Structs */
|
||||||
struct STFileSystem {
|
struct STFileSystem {
|
||||||
STsdb *tsdb;
|
STsdb *tsdb;
|
||||||
tsem_t canEdit;
|
tsem_t canEdit;
|
||||||
int32_t state;
|
int32_t state;
|
||||||
int64_t neid;
|
volatile int64_t neid;
|
||||||
EFEditT etype;
|
EFEditT etype;
|
||||||
TFileSetArray fSetArr[1];
|
TFileSetArray fSetArr[1];
|
||||||
TFileSetArray fSetArrTmp[1];
|
TFileSetArray fSetArrTmp[1];
|
||||||
|
|
||||||
// background task queue
|
// background task queue
|
||||||
TdThreadMutex mutex[1];
|
TdThreadMutex mutex[1];
|
||||||
|
|
Loading…
Reference in New Issue