Merge pull request #27148 from taosdata/fix/3.0/TD-31362-TD-31359-TD-21481
1. lock not released when return
This commit is contained in:
commit
8d751ca5e3
|
@ -914,6 +914,7 @@ int32_t taosGetErrSize();
|
|||
#define TSDB_CODE_TSMA_UNSUPPORTED_FUNC TAOS_DEF_ERROR_CODE(0, 0x3109)
|
||||
#define TSDB_CODE_TSMA_MUST_BE_DROPPED TAOS_DEF_ERROR_CODE(0, 0x3110)
|
||||
#define TSDB_CODE_TSMA_NAME_TOO_LONG TAOS_DEF_ERROR_CODE(0, 0x3111)
|
||||
#define TSDB_CODE_TSMA_INVALID_RECURSIVE_INTERVAL TAOS_DEF_ERROR_CODE(0, 0x3112)
|
||||
|
||||
//rsma
|
||||
#define TSDB_CODE_RSMA_INVALID_ENV TAOS_DEF_ERROR_CODE(0, 0x3150)
|
||||
|
|
|
@ -957,6 +957,7 @@ int32_t loadMemTombData(SArray** ppMemDelData, STbData* pMemTbData, STbData* piM
|
|||
if (p->version <= ver) {
|
||||
void* px = taosArrayPush(pMemDelData, p);
|
||||
if (px == NULL) {
|
||||
taosRUnLockLatch(&pMemTbData->lock);
|
||||
return terrno;
|
||||
}
|
||||
}
|
||||
|
@ -1430,4 +1431,4 @@ bool overlapWithDelSkylineWithoutVer(STableBlockScanInfo* pBlockScanInfo, const
|
|||
|
||||
return doCheckDatablockOverlapWithoutVersion(pBlockScanInfo, pRecord, index);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -254,6 +254,8 @@ static SSDataBlock* doFillImpl(SOperatorInfo* pOperator) {
|
|||
(pInfo->pFillInfo->type != TSDB_FILL_NULL_F && pInfo->pFillInfo->type != TSDB_FILL_SET_VALUE_F)) {
|
||||
setOperatorCompleted(pOperator);
|
||||
return NULL;
|
||||
} else if (pInfo->totalInputRows == 0 && taosFillNotStarted(pInfo->pFillInfo)) {
|
||||
reviseFillStartAndEndKey(pInfo, order);
|
||||
}
|
||||
|
||||
taosFillSetStartInfo(pInfo->pFillInfo, 0, pInfo->win.ekey);
|
||||
|
|
|
@ -207,7 +207,7 @@ static void doFillOneRow(SFillInfo* pFillInfo, SSDataBlock* pBlock, SSDataBlock*
|
|||
setNotFillColumn(pFillInfo, pDstCol, index, i);
|
||||
}
|
||||
} else {
|
||||
SRowVal* pRVal = FILL_IS_ASC_FILL(pFillInfo) ? &pFillInfo->prev : &pFillInfo->next;
|
||||
SRowVal* pRVal = &pFillInfo->prev;
|
||||
SGroupKeys* pKey = taosArrayGet(pRVal->pRowVal, i);
|
||||
if (IS_VAR_DATA_TYPE(type) || type == TSDB_DATA_TYPE_BOOL || pKey->isNull) {
|
||||
colDataSetNULL(pDstCol, index);
|
||||
|
@ -331,8 +331,9 @@ static void copyCurrentRowIntoBuf(SFillInfo* pFillInfo, int32_t rowIndex, SRowVa
|
|||
for (int32_t i = 0; i < pFillInfo->numOfCols; ++i) {
|
||||
int32_t type = pFillInfo->pFillCol[i].pExpr->pExpr->nodeType;
|
||||
if (type == QUERY_NODE_COLUMN || type == QUERY_NODE_OPERATOR || type == QUERY_NODE_FUNCTION) {
|
||||
if (!pFillInfo->pFillCol[i].notFillCol && pFillInfo->type != TSDB_FILL_NEXT) {
|
||||
continue;
|
||||
if (!pFillInfo->pFillCol[i].notFillCol) {
|
||||
if (FILL_IS_ASC_FILL(pFillInfo) && pFillInfo->type != TSDB_FILL_NEXT) continue;
|
||||
if (!FILL_IS_ASC_FILL(pFillInfo) && pFillInfo->type != TSDB_FILL_PREV) continue;
|
||||
}
|
||||
int32_t srcSlotId = GET_DEST_SLOT_ID(&pFillInfo->pFillCol[i]);
|
||||
|
||||
|
@ -394,8 +395,8 @@ static int32_t fillResultImpl(SFillInfo* pFillInfo, SSDataBlock* pBlock, int32_t
|
|||
ASSERT(pFillInfo->currentKey == ts);
|
||||
int32_t index = pBlock->info.rows;
|
||||
|
||||
int32_t nextRowIndex = pFillInfo->index + 1;
|
||||
if (pFillInfo->type == TSDB_FILL_NEXT) {
|
||||
int32_t nextRowIndex = pFillInfo->index + 1;
|
||||
if ((pFillInfo->index + 1) < pFillInfo->numOfRows) {
|
||||
copyCurrentRowIntoBuf(pFillInfo, nextRowIndex, &pFillInfo->next, false);
|
||||
} else {
|
||||
|
@ -403,6 +404,11 @@ static int32_t fillResultImpl(SFillInfo* pFillInfo, SSDataBlock* pBlock, int32_t
|
|||
copyCurrentRowIntoBuf(pFillInfo, nextRowIndex, &pFillInfo->next, true);
|
||||
}
|
||||
}
|
||||
if (pFillInfo->type == TSDB_FILL_PREV) {
|
||||
if (nextRowIndex + 1 >= pFillInfo->numOfRows && !FILL_IS_ASC_FILL(pFillInfo)) {
|
||||
copyCurrentRowIntoBuf(pFillInfo, nextRowIndex, &pFillInfo->next, true);
|
||||
}
|
||||
}
|
||||
|
||||
// copy rows to dst buffer
|
||||
for (int32_t i = 0; i < pFillInfo->numOfCols; ++i) {
|
||||
|
@ -417,7 +423,7 @@ static int32_t fillResultImpl(SFillInfo* pFillInfo, SSDataBlock* pBlock, int32_t
|
|||
if (!colDataIsNull_s(pSrc, pFillInfo->index)) {
|
||||
code = colDataSetVal(pDst, index, src, false);
|
||||
QUERY_CHECK_CODE(code, lino, _end);
|
||||
SRowVal* pRVal = FILL_IS_ASC_FILL(pFillInfo) ? &pFillInfo->prev : &pFillInfo->next;
|
||||
SRowVal* pRVal = &pFillInfo->prev;
|
||||
saveColData(pRVal->pRowVal, i, src, false);
|
||||
if (pFillInfo->srcTsSlotId == dstSlotId) {
|
||||
pRVal->key = *(int64_t*)src;
|
||||
|
@ -438,7 +444,7 @@ static int32_t fillResultImpl(SFillInfo* pFillInfo, SSDataBlock* pBlock, int32_t
|
|||
code = colDataSetVal(pDst, index, src, isNull);
|
||||
QUERY_CHECK_CODE(code, lino, _end);
|
||||
|
||||
SArray* p = FILL_IS_ASC_FILL(pFillInfo) ? pFillInfo->prev.pRowVal : pFillInfo->next.pRowVal;
|
||||
SArray* p = pFillInfo->prev.pRowVal;
|
||||
saveColData(p, i, src, isNull); // todo:
|
||||
} else if (pFillInfo->type == TSDB_FILL_NULL || pFillInfo->type == TSDB_FILL_NULL_F) {
|
||||
colDataSetNULL(pDst, index);
|
||||
|
|
|
@ -11864,7 +11864,7 @@ static int32_t buildCreateTSMAReq(STranslateContext* pCxt, SCreateTSMAStmt* pStm
|
|||
if (checkRecursiveTsmaInterval(pRecursiveTsma->interval, pRecursiveTsma->unit, pInterval->datum.i,
|
||||
pInterval->unit, pDbInfo.precision, true)) {
|
||||
} else {
|
||||
code = TSDB_CODE_TSMA_INVALID_INTERVAL;
|
||||
code = TSDB_CODE_TSMA_INVALID_RECURSIVE_INTERVAL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -759,6 +759,7 @@ TAOS_DEFINE_ERROR(TSDB_CODE_TSMA_INVALID_FUNC_PARAM, "Invalid tsma func p
|
|||
TAOS_DEFINE_ERROR(TSDB_CODE_TSMA_UNSUPPORTED_FUNC, "Tsma func not supported")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_TSMA_MUST_BE_DROPPED, "Tsma must be dropped first")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_TSMA_NAME_TOO_LONG, "Tsma name too long")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_TSMA_INVALID_RECURSIVE_INTERVAL,"Invalid recursive tsma interval")
|
||||
|
||||
//rsma
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_RSMA_INVALID_ENV, "Invalid rsma env")
|
||||
|
|
|
@ -126,6 +126,17 @@ class TDTestCase:
|
|||
def test_fill_range(self):
|
||||
os.system('taosBenchmark -t 10 -n 10000 -v 8 -S 32000 -y')
|
||||
self.schedule_fill_test_tasks()
|
||||
sql = "select first(_wstart), last(_wstart) from (select _wstart, count(*) from test.meters where ts >= '2019-09-19 23:54:00.000' and ts < '2019-09-20 01:00:00.000' interval(10s) sliding(10s) fill(VALUE_F, 122) order by _wstart) t"
|
||||
tdSql.query(sql, queryTimes=1)
|
||||
rows = tdSql.getRows()
|
||||
first_ts = tdSql.queryResult[0][0]
|
||||
last_ts = tdSql.queryResult[0][1]
|
||||
|
||||
sql = "select first(_wstart), last(_wstart) from (select _wstart, count(*) from test.meters where ts >= '2019-09-19 23:54:00.000' and ts < '2019-09-20 01:00:00.000' interval(10s) sliding(10s) fill(VALUE_F, 122) order by _wstart desc) t"
|
||||
tdSql.query(sql, queryTimes=1)
|
||||
tdSql.checkRows(rows)
|
||||
tdSql.checkData(0, 0, first_ts)
|
||||
tdSql.checkData(0, 1, last_ts)
|
||||
tdSql.execute('drop database test')
|
||||
|
||||
def run(self):
|
||||
|
|
|
@ -165,7 +165,7 @@ class TDTestCase:
|
|||
sql = "select _wstart, count(*) from meters where ts >= '2018-09-20 00:00:00.000' and ts < '2018-09-20 01:00:00.000' interval(5m) fill(prev) order by _wstart desc;"
|
||||
tdSql.query(sql, queryTimes=1)
|
||||
tdSql.checkRows(12)
|
||||
tdSql.checkData(0, 1, None)
|
||||
tdSql.checkData(0, 1, 10)
|
||||
tdSql.checkData(1, 1, 10)
|
||||
tdSql.checkData(2, 1, 10)
|
||||
tdSql.checkData(3, 1, 10)
|
||||
|
@ -198,6 +198,45 @@ class TDTestCase:
|
|||
tdSql.query(sql, queryTimes=1)
|
||||
tdSql.checkRows(60)
|
||||
|
||||
sql = "select _wstart, count(*) from meters where ts >= '2018-09-19 23:54:00.000' and ts < '2018-09-20 01:00:00.000' interval(5m) fill(next) order by _wstart asc;"
|
||||
tdSql.query(sql, queryTimes=1)
|
||||
for i in range(0, 13):
|
||||
tdSql.checkData(i, 1, 10)
|
||||
tdSql.checkData(13, 1, None)
|
||||
sql = "select _wstart, count(*) from meters where ts >= '2018-09-19 23:54:00.000' and ts < '2018-09-20 01:00:00.000' interval(5m) fill(next) order by _wstart desc;"
|
||||
tdSql.query(sql, queryTimes=1)
|
||||
tdSql.checkData(0, 1, None)
|
||||
for i in range(1, 14):
|
||||
tdSql.checkData(i, 1, 10)
|
||||
|
||||
sql = "select _wstart, count(*) from meters where ts >= '2018-09-19 23:54:00.000' and ts < '2018-09-20 01:00:00.000' interval(5m) fill(prev) order by _wstart asc;"
|
||||
tdSql.query(sql, queryTimes=1)
|
||||
tdSql.checkData(0, 1, None)
|
||||
tdSql.checkData(1, 1, None)
|
||||
for i in range(2, 14):
|
||||
tdSql.checkData(i, 1, 10)
|
||||
sql = "select _wstart, count(*) from meters where ts >= '2018-09-19 23:54:00.000' and ts < '2018-09-20 01:00:00.000' interval(5m) fill(prev) order by _wstart desc;"
|
||||
tdSql.query(sql, queryTimes=1)
|
||||
for i in range(0, 12):
|
||||
tdSql.checkData(i, 1, 10)
|
||||
tdSql.checkData(12, 1, None)
|
||||
tdSql.checkData(13, 1, None)
|
||||
|
||||
sql = "select _wstart, count(*) from meters where ts >= '2018-09-19 23:54:00.000' and ts < '2018-09-20 01:00:00.000' interval(5m) fill(linear) order by _wstart asc;"
|
||||
tdSql.query(sql, queryTimes=1)
|
||||
tdSql.checkData(0, 1, None)
|
||||
tdSql.checkData(1, 1, None)
|
||||
for i in range(2, 13):
|
||||
tdSql.checkData(i, 1, 10)
|
||||
tdSql.checkData(13, 1, None)
|
||||
sql = "select _wstart, count(*) from meters where ts >= '2018-09-19 23:54:00.000' and ts < '2018-09-20 01:00:00.000' interval(5m) fill(linear) order by _wstart desc;"
|
||||
tdSql.query(sql, queryTimes=1)
|
||||
tdSql.checkData(0, 1, None)
|
||||
for i in range(1, 12):
|
||||
tdSql.checkData(i, 1, 10)
|
||||
tdSql.checkData(12, 1, None)
|
||||
tdSql.checkData(13, 1, None)
|
||||
|
||||
def run(self):
|
||||
self.prepareTestEnv()
|
||||
self.test_partition_by_with_interval_fill_prev_new_group_fill_error()
|
||||
|
|
|
@ -1476,18 +1476,18 @@ class TDTestCase:
|
|||
tdSql.error(sql, -2147473920) # syntax error
|
||||
|
||||
sql = 'create recursive tsma tsma2 on test.tsma1 interval(1m)'
|
||||
tdSql.error(sql, -2147471097) # invalid tsma interval
|
||||
tdSql.error(sql, -2147471086) # invalid tsma interval
|
||||
|
||||
sql = 'create recursive tsma tsma2 on test.tsma1 interval(7m)'
|
||||
tdSql.error(sql, -2147471097) # invalid tsma interval
|
||||
tdSql.error(sql, -2147471086) # invalid tsma interval
|
||||
|
||||
sql = 'create recursive tsma tsma2 on test.tsma1 interval(11m)'
|
||||
tdSql.error(sql, -2147471097) # invalid tsma interval
|
||||
tdSql.error(sql, -2147471086) # invalid tsma interval
|
||||
|
||||
self.create_recursive_tsma('tsma1', 'tsma2', 'test', '20m', 'meters')
|
||||
|
||||
sql = 'create recursive tsma tsma3 on test.tsma2 interval(30m)'
|
||||
tdSql.error(sql, -2147471097) # invalid tsma interval
|
||||
tdSql.error(sql, -2147471086) # invalid tsma interval
|
||||
|
||||
self.create_recursive_tsma('tsma2', 'tsma3', 'test', '40m', 'meters')
|
||||
|
||||
|
|
|
@ -852,7 +852,7 @@ class TDTestCase:
|
|||
]
|
||||
tdSql.execute('use db')
|
||||
for (i, ri, ret) in examples:
|
||||
self.test_create_recursive_tsma_interval(db, tb, func, i, ri, ret, -2147471097)
|
||||
self.test_create_recursive_tsma_interval(db, tb, func, i, ri, ret, -2147471086)
|
||||
|
||||
self.create_tsma('tsma1', db, tb, func, '1h')
|
||||
self.create_recursive_tsma('tsma1', 'tsma2', db, '1n', tb, func)
|
||||
|
|
Loading…
Reference in New Issue