Merge pull request #29472 from taosdata/fix/fixInvalidLock
fix invalid lock
This commit is contained in:
commit
2c2654c10d
|
@ -392,6 +392,22 @@ int32_t streamMetaOpen(const char* path, void* ahandle, FTaskBuild buildTaskFn,
|
|||
TSDB_CHECK_CODE(code, lino, _err);
|
||||
}
|
||||
|
||||
// set the attribute when running on Linux OS
|
||||
TdThreadRwlockAttr attr;
|
||||
code = taosThreadRwlockAttrInit(&attr);
|
||||
TSDB_CHECK_CODE(code, lino, _err);
|
||||
|
||||
#ifdef LINUX
|
||||
code = pthread_rwlockattr_setkind_np(&attr, PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP);
|
||||
TSDB_CHECK_CODE(code, lino, _err);
|
||||
#endif
|
||||
|
||||
code = taosThreadRwlockInit(&pMeta->lock, &attr);
|
||||
TSDB_CHECK_CODE(code, lino, _err);
|
||||
|
||||
code = taosThreadRwlockAttrDestroy(&attr);
|
||||
TSDB_CHECK_CODE(code, lino, _err);
|
||||
|
||||
if ((code = streamMetaBegin(pMeta) < 0)) {
|
||||
stError("vgId:%d begin trans for stream meta failed", pMeta->vgId);
|
||||
goto _err;
|
||||
|
@ -431,22 +447,6 @@ int32_t streamMetaOpen(const char* path, void* ahandle, FTaskBuild buildTaskFn,
|
|||
|
||||
stInfo("vgId:%d open stream meta succ, latest checkpoint:%" PRId64 ", stage:%" PRId64, vgId, pMeta->chkpId, stage);
|
||||
|
||||
// set the attribute when running on Linux OS
|
||||
TdThreadRwlockAttr attr;
|
||||
code = taosThreadRwlockAttrInit(&attr);
|
||||
TSDB_CHECK_CODE(code, lino, _err);
|
||||
|
||||
#ifdef LINUX
|
||||
code = pthread_rwlockattr_setkind_np(&attr, PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP);
|
||||
TSDB_CHECK_CODE(code, lino, _err);
|
||||
#endif
|
||||
|
||||
code = taosThreadRwlockInit(&pMeta->lock, &attr);
|
||||
TSDB_CHECK_CODE(code, lino, _err);
|
||||
|
||||
code = taosThreadRwlockAttrDestroy(&attr);
|
||||
TSDB_CHECK_CODE(code, lino, _err);
|
||||
|
||||
code = bkdMgtCreate(tpath, (SBkdMgt**)&pMeta->bkdChkptMgt);
|
||||
TSDB_CHECK_CODE(code, lino, _err);
|
||||
|
||||
|
|
Loading…
Reference in New Issue