Merge branch 'develop' into hotfix/test

This commit is contained in:
Hui Li 2021-01-08 16:48:41 +08:00
commit 2f11010b64
2 changed files with 19 additions and 11 deletions

View File

@ -365,7 +365,7 @@ static void tscProcessAsyncError(SSchedMsg *pMsg) {
void (*fp)() = pMsg->ahandle; void (*fp)() = pMsg->ahandle;
terrno = *(int32_t*) pMsg->msg; terrno = *(int32_t*) pMsg->msg;
tfree(pMsg->msg); tfree(pMsg->msg);
(*fp)(pMsg->thandle, NULL, *(int32_t*)pMsg->msg); (*fp)(pMsg->thandle, NULL, terrno);
} }
void tscQueueAsyncError(void(*fp), void *param, int32_t code) { void tscQueueAsyncError(void(*fp), void *param, int32_t code) {

View File

@ -56,7 +56,7 @@ static bool vnodeSetClosingStatusImp(SVnodeObj* pVnode) {
bool set = false; bool set = false;
pthread_mutex_lock(&pVnode->statusMutex); pthread_mutex_lock(&pVnode->statusMutex);
if (pVnode->status == TAOS_VN_STATUS_READY) { if (pVnode->status == TAOS_VN_STATUS_READY || pVnode->status == TAOS_VN_STATUS_INIT) {
pVnode->status = TAOS_VN_STATUS_CLOSING; pVnode->status = TAOS_VN_STATUS_CLOSING;
set = true; set = true;
} else { } else {
@ -68,13 +68,10 @@ static bool vnodeSetClosingStatusImp(SVnodeObj* pVnode) {
} }
bool vnodeSetClosingStatus(SVnodeObj* pVnode) { bool vnodeSetClosingStatus(SVnodeObj* pVnode) {
if (!vnodeInInitStatus(pVnode)) { int32_t i = 0;
// it may be in updating or reset state, then it shall wait while (!vnodeSetClosingStatusImp(pVnode)) {
int32_t i = 0; if (++i % 1000 == 0) {
while (!vnodeSetClosingStatusImp(pVnode)) { sched_yield();
if (++i % 1000 == 0) {
sched_yield();
}
} }
} }
@ -96,11 +93,11 @@ bool vnodeSetUpdatingStatus(SVnodeObj* pVnode) {
return set; return set;
} }
bool vnodeSetResetStatus(SVnodeObj* pVnode) { static bool vnodeSetResetStatusImp(SVnodeObj* pVnode) {
bool set = false; bool set = false;
pthread_mutex_lock(&pVnode->statusMutex); pthread_mutex_lock(&pVnode->statusMutex);
if (pVnode->status != TAOS_VN_STATUS_CLOSING && pVnode->status != TAOS_VN_STATUS_INIT) { if (pVnode->status == TAOS_VN_STATUS_READY || pVnode->status == TAOS_VN_STATUS_INIT) {
pVnode->status = TAOS_VN_STATUS_RESET; pVnode->status = TAOS_VN_STATUS_RESET;
set = true; set = true;
} else { } else {
@ -111,6 +108,17 @@ bool vnodeSetResetStatus(SVnodeObj* pVnode) {
return set; return set;
} }
bool vnodeSetResetStatus(SVnodeObj* pVnode) {
int32_t i = 0;
while (!vnodeSetResetStatusImp(pVnode)) {
if (++i % 1000 == 0) {
sched_yield();
}
}
return true;
}
bool vnodeInInitStatus(SVnodeObj* pVnode) { bool vnodeInInitStatus(SVnodeObj* pVnode) {
bool in = false; bool in = false;
pthread_mutex_lock(&pVnode->statusMutex); pthread_mutex_lock(&pVnode->statusMutex);