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