TBASE-926, data may be lost when the cache is full
This commit is contained in:
parent
217168780e
commit
97c6bebfde
|
@ -576,6 +576,14 @@ int vnodeInsertPoints(SMeterObj *pObj, char *cont, int contLen, char source, voi
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* please refer to TBASE-926, data may be lost when the cache is full
|
||||||
|
*/
|
||||||
|
if (source == TSDB_DATA_SOURCE_SHELL && pVnode->cfg.replications > 1) {
|
||||||
|
code = vnodeForwardToPeer(pObj, cont, contLen, TSDB_ACTION_INSERT, sversion);
|
||||||
|
if (code != TSDB_CODE_SUCCESS) return code;
|
||||||
|
}
|
||||||
|
|
||||||
SCachePool *pPool = (SCachePool *)pVnode->pCachePool;
|
SCachePool *pPool = (SCachePool *)pVnode->pCachePool;
|
||||||
if (pObj->freePoints < numOfPoints || pObj->freePoints < (pObj->pointsPerBlock << 1) ||
|
if (pObj->freePoints < numOfPoints || pObj->freePoints < (pObj->pointsPerBlock << 1) ||
|
||||||
pPool->notFreeSlots > pVnode->cfg.cacheNumOfBlocks.totalBlocks - 2) {
|
pPool->notFreeSlots > pVnode->cfg.cacheNumOfBlocks.totalBlocks - 2) {
|
||||||
|
@ -593,11 +601,6 @@ int vnodeInsertPoints(SMeterObj *pObj, char *cont, int contLen, char source, voi
|
||||||
if (code != TSDB_CODE_SUCCESS) return code;
|
if (code != TSDB_CODE_SUCCESS) return code;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (source == TSDB_DATA_SOURCE_SHELL && pVnode->cfg.replications > 1) {
|
|
||||||
code = vnodeForwardToPeer(pObj, cont, contLen, TSDB_ACTION_INSERT, sversion);
|
|
||||||
if (code != TSDB_CODE_SUCCESS) return code;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (pObj->sversion < sversion) {
|
if (pObj->sversion < sversion) {
|
||||||
dTrace("vid:%d sid:%d id:%s, schema is changed, new:%d old:%d", pObj->vnode, pObj->sid, pObj->meterId, sversion,
|
dTrace("vid:%d sid:%d id:%s, schema is changed, new:%d old:%d", pObj->vnode, pObj->sid, pObj->meterId, sversion,
|
||||||
pObj->sversion);
|
pObj->sversion);
|
||||||
|
|
Loading…
Reference in New Issue