提交 ee071e49 编写于 作者: S slguan

import data may cause database blocking

上级 39478de2
...@@ -915,9 +915,6 @@ int vnodeImportPoints(SMeterObj *pObj, char *cont, int contLen, char source, voi ...@@ -915,9 +915,6 @@ int vnodeImportPoints(SMeterObj *pObj, char *cont, int contLen, char source, voi
if (((commitInProcess = pPool->commitInProcess) == 1) || num > 0) { if (((commitInProcess = pPool->commitInProcess) == 1) || num > 0) {
pthread_mutex_unlock(&pPool->vmutex); pthread_mutex_unlock(&pPool->vmutex);
//restore meter state
vnodeClearMeterState(pObj, TSDB_METER_STATE_IMPORTING);
pNew = (SImportInfo *)malloc(sizeof(SImportInfo)); pNew = (SImportInfo *)malloc(sizeof(SImportInfo));
memcpy(pNew, &import, sizeof(SImportInfo)); memcpy(pNew, &import, sizeof(SImportInfo));
pNew->signature = pNew; pNew->signature = pNew;
...@@ -939,8 +936,6 @@ int vnodeImportPoints(SMeterObj *pObj, char *cont, int contLen, char source, voi ...@@ -939,8 +936,6 @@ int vnodeImportPoints(SMeterObj *pObj, char *cont, int contLen, char source, voi
pShell->numOfTotalPoints += import.importedRows; pShell->numOfTotalPoints += import.importedRows;
} }
} }
vnodeClearMeterState(pObj, TSDB_METER_STATE_IMPORTING);
} }
pVnode->version++; pVnode->version++;
......
...@@ -160,7 +160,7 @@ int vnodeOpenShellVnode(int vnode) { ...@@ -160,7 +160,7 @@ int vnodeOpenShellVnode(int vnode) {
return 0; return 0;
} }
void vnodeDelayedFreeResource(void *param, void *tmrId) { static void vnodeDelayedFreeResource(void *param, void *tmrId) {
int32_t vnode = *(int32_t*) param; int32_t vnode = *(int32_t*) param;
taosCloseRpcChann(pShellServer, vnode); // close connection taosCloseRpcChann(pShellServer, vnode); // close connection
tfree (shellList[vnode]); //free SShellObj tfree (shellList[vnode]); //free SShellObj
...@@ -179,8 +179,9 @@ void vnodeCloseShellVnode(int vnode) { ...@@ -179,8 +179,9 @@ void vnodeCloseShellVnode(int vnode) {
*v = vnode; *v = vnode;
/* /*
* free the connection related resource after 5sec, since the msg may be in * free the connection related resource after 5sec.
* the task queue, free it immediate will cause crash * 1. The msg, as well as SRpcConn may be in the task queue, free it immediate will cause crash
* 2. Free connection may cause *(SRpcConn*)pObj->thandle to be invalid to access.
*/ */
dTrace("vid:%d, delay 5sec to free resources", vnode); dTrace("vid:%d, delay 5sec to free resources", vnode);
taosTmrStart(vnodeDelayedFreeResource, 5000, v, vnodeTmrCtrl); taosTmrStart(vnodeDelayedFreeResource, 5000, v, vnodeTmrCtrl);
...@@ -517,6 +518,7 @@ int vnodeProcessShellSubmitRequest(char *pMsg, int msgLen, SShellObj *pObj) { ...@@ -517,6 +518,7 @@ int vnodeProcessShellSubmitRequest(char *pMsg, int msgLen, SShellObj *pObj) {
if (pSubmit->import) { if (pSubmit->import) {
code = vnodeImportPoints(pMeterObj, (char *) &(pBlocks->numOfRows), subMsgLen, TSDB_DATA_SOURCE_SHELL, pObj, code = vnodeImportPoints(pMeterObj, (char *) &(pBlocks->numOfRows), subMsgLen, TSDB_DATA_SOURCE_SHELL, pObj,
sversion, &numOfPoints); sversion, &numOfPoints);
vnodeClearMeterState(pMeterObj, TSDB_METER_STATE_IMPORTING);
} else { } else {
code = vnodeInsertPoints(pMeterObj, (char *) &(pBlocks->numOfRows), subMsgLen, TSDB_DATA_SOURCE_SHELL, NULL, code = vnodeInsertPoints(pMeterObj, (char *) &(pBlocks->numOfRows), subMsgLen, TSDB_DATA_SOURCE_SHELL, NULL,
sversion, &numOfPoints); sversion, &numOfPoints);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册