fix: tudf lock
This commit is contained in:
parent
3342dcf43c
commit
95f283485a
|
@ -1086,14 +1086,15 @@ int32_t acquireUdfFuncHandle(char *udfName, UdfcFuncHandle *pHandle) {
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
fnInfo("udf handle expired for %s, will setup udf. move it to expired list", udfName);
|
fnInfo("udf handle expired for %s, will setup udf. move it to expired list", udfName);
|
||||||
taosArrayRemove(gUdfcProxy.udfStubs, stubIndex);
|
if (taosArrayPush(gUdfcProxy.expiredUdfStubs, foundStub) == NULL) {
|
||||||
if(taosArrayPush(gUdfcProxy.expiredUdfStubs, foundStub) == NULL) {
|
|
||||||
fnError("acquireUdfFuncHandle: failed to push udf stub to array");
|
fnError("acquireUdfFuncHandle: failed to push udf stub to array");
|
||||||
goto _exit;
|
} else {
|
||||||
}
|
taosArrayRemove(gUdfcProxy.udfStubs, stubIndex);
|
||||||
taosArraySort(gUdfcProxy.expiredUdfStubs, compareUdfcFuncSub);
|
taosArraySort(gUdfcProxy.expiredUdfStubs, compareUdfcFuncSub);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
uv_mutex_unlock(&gUdfcProxy.udfStubsMutex);
|
||||||
*pHandle = NULL;
|
*pHandle = NULL;
|
||||||
code = doSetupUdf(udfName, pHandle);
|
code = doSetupUdf(udfName, pHandle);
|
||||||
if (code == TSDB_CODE_SUCCESS) {
|
if (code == TSDB_CODE_SUCCESS) {
|
||||||
|
@ -1102,17 +1103,20 @@ int32_t acquireUdfFuncHandle(char *udfName, UdfcFuncHandle *pHandle) {
|
||||||
stub.handle = *pHandle;
|
stub.handle = *pHandle;
|
||||||
++stub.refCount;
|
++stub.refCount;
|
||||||
stub.createTime = taosGetTimestampUs();
|
stub.createTime = taosGetTimestampUs();
|
||||||
if(taosArrayPush(gUdfcProxy.udfStubs, &stub) == NULL) {
|
uv_mutex_lock(&gUdfcProxy.udfStubsMutex);
|
||||||
|
if (taosArrayPush(gUdfcProxy.udfStubs, &stub) == NULL) {
|
||||||
fnError("acquireUdfFuncHandle: failed to push udf stub to array");
|
fnError("acquireUdfFuncHandle: failed to push udf stub to array");
|
||||||
|
uv_mutex_unlock(&gUdfcProxy.udfStubsMutex);
|
||||||
goto _exit;
|
goto _exit;
|
||||||
}
|
} else {
|
||||||
taosArraySort(gUdfcProxy.udfStubs, compareUdfcFuncSub);
|
taosArraySort(gUdfcProxy.udfStubs, compareUdfcFuncSub);
|
||||||
|
}
|
||||||
|
uv_mutex_unlock(&gUdfcProxy.udfStubsMutex);
|
||||||
} else {
|
} else {
|
||||||
*pHandle = NULL;
|
*pHandle = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
_exit:
|
_exit:
|
||||||
uv_mutex_unlock(&gUdfcProxy.udfStubsMutex);
|
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue