Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
慢慢CG
TDengine
提交
adb5b0f9
T
TDengine
项目概览
慢慢CG
/
TDengine
与 Fork 源项目一致
Fork自
taosdata / TDengine
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
adb5b0f9
编写于
8月 09, 2021
作者:
S
Shengliang Guan
浏览文件
操作
浏览文件
下载
差异文件
Merge from master
上级
34d42ae8
a419f091
变更
19
展开全部
隐藏空白更改
内联
并排
Showing
19 changed file
with
1904 addition
and
68 deletion
+1904
-68
Jenkinsfile
Jenkinsfile
+15
-3
src/client/src/tscParseInsert.c
src/client/src/tscParseInsert.c
+1
-3
src/inc/taosmsg.h
src/inc/taosmsg.h
+1
-0
src/kit/taosdemo/taosdemo.c
src/kit/taosdemo/taosdemo.c
+2
-0
src/mnode/src/mnodeShow.c
src/mnode/src/mnodeShow.c
+5
-1
src/mnode/src/mnodeWrite.c
src/mnode/src/mnodeWrite.c
+8
-1
src/query/inc/qExecutor.h
src/query/inc/qExecutor.h
+4
-0
src/query/src/qAggMain.c
src/query/src/qAggMain.c
+42
-10
src/query/src/qExecutor.c
src/query/src/qExecutor.c
+364
-10
src/query/src/qPlan.c
src/query/src/qPlan.c
+12
-4
src/tsdb/inc/tsdbMeta.h
src/tsdb/inc/tsdbMeta.h
+3
-5
src/tsdb/src/tsdbMeta.c
src/tsdb/src/tsdbMeta.c
+54
-25
src/tsdb/src/tsdbRead.c
src/tsdb/src/tsdbRead.c
+1
-1
tests/pytest/alter/alterColMultiTimes.py
tests/pytest/alter/alterColMultiTimes.py
+67
-0
tests/pytest/fulltest.sh
tests/pytest/fulltest.sh
+1
-0
tests/pytest/tools/taosdemoAllTest/NanoTestCase/taosdemoTestSupportNanoInsert.py
...demoAllTest/NanoTestCase/taosdemoTestSupportNanoInsert.py
+0
-2
tests/pytest/tools/taosdemoAllTest/taosdemoTestSupportNanosubscribe.py
...tools/taosdemoAllTest/taosdemoTestSupportNanosubscribe.py
+0
-1
tests/script/general/parser/interp.sim
tests/script/general/parser/interp.sim
+4
-1
tests/script/general/parser/interp_test.sim
tests/script/general/parser/interp_test.sim
+1320
-1
未找到文件。
Jenkinsfile
浏览文件 @
adb5b0f9
...
...
@@ -52,12 +52,18 @@ def pre_test(){
git checkout master
'''
}
else
{
else
if
(
env
.
CHANGE_TARGET
==
'2.0'
)
{
sh
'''
cd ${WKC}
git checkout
develop
git checkout
2.0
'''
}
else
{
sh
'''
cd ${WKC}
git checkout develop
'''
}
}
sh
'''
cd ${WKC}
...
...
@@ -75,7 +81,13 @@ def pre_test(){
git checkout master
'''
}
else
{
else
if
(
env
.
CHANGE_TARGET
==
'2.0'
){
sh
'''
cd ${WK}
git checkout 2.0
'''
}
else
{
sh
'''
cd ${WK}
git checkout develop
...
...
src/client/src/tscParseInsert.c
浏览文件 @
adb5b0f9
...
...
@@ -991,9 +991,7 @@ int32_t tsParseValues(char **str, STableDataBlocks *pDataBlock, int maxRows, SIn
index
=
0
;
sToken
=
tStrGetToken
(
*
str
,
&
index
,
false
);
if
(
sToken
.
n
==
0
||
sToken
.
type
!=
TK_RP
)
{
tscSQLSyntaxErrMsg
(
pInsertParam
->
msg
,
") expected"
,
*
str
);
code
=
TSDB_CODE_TSC_SQL_SYNTAX_ERROR
;
return
code
;
return
tscSQLSyntaxErrMsg
(
pInsertParam
->
msg
,
") expected"
,
*
str
);
}
*
str
+=
index
;
...
...
src/inc/taosmsg.h
浏览文件 @
adb5b0f9
...
...
@@ -471,6 +471,7 @@ typedef struct {
bool
stableQuery
;
// super table query or not
bool
topBotQuery
;
// TODO used bitwise flag
bool
interpQuery
;
// interp query or not
bool
groupbyColumn
;
// denote if this is a groupby normal column query
bool
hasTagResults
;
// if there are tag values in final result or not
bool
timeWindowInterpo
;
// if the time window start/end required interpolation
...
...
src/kit/taosdemo/taosdemo.c
浏览文件 @
adb5b0f9
...
...
@@ -75,6 +75,7 @@ extern char configDir[];
#define BUFFER_SIZE TSDB_MAX_ALLOWED_SQL_LEN
#define COND_BUF_LEN (BUFFER_SIZE - 30)
#define COL_BUFFER_LEN ((TSDB_COL_NAME_LEN + 15) * TSDB_MAX_COLUMNS)
#define MAX_USERNAME_SIZE 64
#define MAX_PASSWORD_SIZE 16
#define MAX_HOSTNAME_SIZE 253 // https://man7.org/linux/man-pages/man7/hostname.7.html
...
...
@@ -1413,6 +1414,7 @@ static char *rand_float_str()
return
g_randfloat_buff
+
(
cursor
*
FLOAT_BUFF_LEN
);
}
static
float
rand_float
()
{
static
int
cursor
;
...
...
src/mnode/src/mnodeShow.c
浏览文件 @
adb5b0f9
...
...
@@ -253,11 +253,15 @@ static int32_t mnodeProcessHeartBeatMsg(SMnodeMsg *pMsg) {
int32_t
connId
=
htonl
(
pHBMsg
->
connId
);
SConnObj
*
pConn
=
mnodeAccquireConn
(
connId
,
connInfo
.
user
,
connInfo
.
clientIp
,
connInfo
.
clientPort
);
if
(
pConn
==
NULL
)
{
pHBMsg
->
pid
=
htonl
(
pHBMsg
->
pid
);
pConn
=
mnodeCreateConn
(
connInfo
.
user
,
connInfo
.
clientIp
,
connInfo
.
clientPort
,
pHBMsg
->
pid
,
pHBMsg
->
appName
);
}
if
(
pConn
==
NULL
)
{
// do not close existing links, otherwise
// mError("failed to create connId, close connect");
// pRsp->killConnection = 1;
// pRsp->killConnection = 1;
}
else
{
pRsp
->
connId
=
htonl
(
pConn
->
connId
);
mnodeSaveQueryStreamList
(
pConn
,
pHBMsg
);
...
...
src/mnode/src/mnodeWrite.c
浏览文件 @
adb5b0f9
...
...
@@ -65,7 +65,14 @@ int32_t mnodeProcessWrite(SMnodeMsg *pMsg) {
return
TSDB_CODE_MND_MSG_NOT_PROCESSED
;
}
int32_t
code
=
mnodeInitMsg
(
pMsg
);
int32_t
code
=
grantCheck
(
TSDB_GRANT_TIME
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
mError
(
"msg:%p, app:%p type:%s not processed, reason:%s"
,
pMsg
,
pMsg
->
rpcMsg
.
ahandle
,
taosMsg
[
pMsg
->
rpcMsg
.
msgType
],
tstrerror
(
code
));
return
code
;
}
code
=
mnodeInitMsg
(
pMsg
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
mError
(
"msg:%p, app:%p type:%s not processed, reason:%s"
,
pMsg
,
pMsg
->
rpcMsg
.
ahandle
,
taosMsg
[
pMsg
->
rpcMsg
.
msgType
],
tstrerror
(
code
));
...
...
src/query/inc/qExecutor.h
浏览文件 @
adb5b0f9
...
...
@@ -331,6 +331,8 @@ enum OPERATOR_TYPE_E {
OP_Distinct
=
20
,
OP_Join
=
21
,
OP_StateWindow
=
22
,
OP_AllTimeWindow
=
23
,
OP_AllMultiTableTimeInterval
=
24
,
};
typedef
struct
SOperatorInfo
{
...
...
@@ -549,11 +551,13 @@ SOperatorInfo* createAggregateOperatorInfo(SQueryRuntimeEnv* pRuntimeEnv, SOpera
SOperatorInfo
*
createProjectOperatorInfo
(
SQueryRuntimeEnv
*
pRuntimeEnv
,
SOperatorInfo
*
upstream
,
SExprInfo
*
pExpr
,
int32_t
numOfOutput
);
SOperatorInfo
*
createLimitOperatorInfo
(
SQueryRuntimeEnv
*
pRuntimeEnv
,
SOperatorInfo
*
upstream
);
SOperatorInfo
*
createTimeIntervalOperatorInfo
(
SQueryRuntimeEnv
*
pRuntimeEnv
,
SOperatorInfo
*
upstream
,
SExprInfo
*
pExpr
,
int32_t
numOfOutput
);
SOperatorInfo
*
createAllTimeIntervalOperatorInfo
(
SQueryRuntimeEnv
*
pRuntimeEnv
,
SOperatorInfo
*
upstream
,
SExprInfo
*
pExpr
,
int32_t
numOfOutput
);
SOperatorInfo
*
createSWindowOperatorInfo
(
SQueryRuntimeEnv
*
pRuntimeEnv
,
SOperatorInfo
*
upstream
,
SExprInfo
*
pExpr
,
int32_t
numOfOutput
);
SOperatorInfo
*
createFillOperatorInfo
(
SQueryRuntimeEnv
*
pRuntimeEnv
,
SOperatorInfo
*
upstream
,
SExprInfo
*
pExpr
,
int32_t
numOfOutput
);
SOperatorInfo
*
createGroupbyOperatorInfo
(
SQueryRuntimeEnv
*
pRuntimeEnv
,
SOperatorInfo
*
upstream
,
SExprInfo
*
pExpr
,
int32_t
numOfOutput
);
SOperatorInfo
*
createMultiTableAggOperatorInfo
(
SQueryRuntimeEnv
*
pRuntimeEnv
,
SOperatorInfo
*
upstream
,
SExprInfo
*
pExpr
,
int32_t
numOfOutput
);
SOperatorInfo
*
createMultiTableTimeIntervalOperatorInfo
(
SQueryRuntimeEnv
*
pRuntimeEnv
,
SOperatorInfo
*
upstream
,
SExprInfo
*
pExpr
,
int32_t
numOfOutput
);
SOperatorInfo
*
createAllMultiTableTimeIntervalOperatorInfo
(
SQueryRuntimeEnv
*
pRuntimeEnv
,
SOperatorInfo
*
upstream
,
SExprInfo
*
pExpr
,
int32_t
numOfOutput
);
SOperatorInfo
*
createTagScanOperatorInfo
(
SQueryRuntimeEnv
*
pRuntimeEnv
,
SExprInfo
*
pExpr
,
int32_t
numOfOutput
);
SOperatorInfo
*
createDistinctOperatorInfo
(
SQueryRuntimeEnv
*
pRuntimeEnv
,
SOperatorInfo
*
upstream
,
SExprInfo
*
pExpr
,
int32_t
numOfOutput
);
SOperatorInfo
*
createTableBlockInfoScanOperator
(
void
*
pTsdbQueryHandle
,
SQueryRuntimeEnv
*
pRuntimeEnv
);
...
...
src/query/src/qAggMain.c
浏览文件 @
adb5b0f9
...
...
@@ -3708,27 +3708,59 @@ static void interp_function_impl(SQLFunctionCtx *pCtx) {
}
}
else
{
// no data generated yet
if
(
pCtx
->
size
==
1
)
{
if
(
pCtx
->
size
<
1
)
{
return
;
}
// check the timestamp in input buffer
TSKEY
skey
=
GET_TS_DATA
(
pCtx
,
0
);
TSKEY
ekey
=
GET_TS_DATA
(
pCtx
,
1
);
// no data generated yet
if
(
!
(
skey
<
pCtx
->
startTs
&&
ekey
>
pCtx
->
startTs
))
{
return
;
}
assert
(
pCtx
->
start
.
key
==
INT64_MIN
&&
skey
<
pCtx
->
startTs
&&
ekey
>
pCtx
->
startTs
);
if
(
type
==
TSDB_FILL_PREV
)
{
if
(
skey
>
pCtx
->
startTs
)
{
return
;
}
if
(
pCtx
->
size
>
1
)
{
TSKEY
ekey
=
GET_TS_DATA
(
pCtx
,
1
);
if
(
ekey
>
skey
&&
ekey
<=
pCtx
->
startTs
)
{
skey
=
ekey
;
}
}
assignVal
(
pCtx
->
pOutput
,
pCtx
->
pInput
,
pCtx
->
outputBytes
,
pCtx
->
inputType
);
}
else
if
(
type
==
TSDB_FILL_NEXT
)
{
char
*
val
=
((
char
*
)
pCtx
->
pInput
)
+
pCtx
->
inputBytes
;
TSKEY
ekey
=
skey
;
char
*
val
=
NULL
;
if
(
ekey
<
pCtx
->
startTs
)
{
if
(
pCtx
->
size
>
1
)
{
ekey
=
GET_TS_DATA
(
pCtx
,
1
);
if
(
ekey
<
pCtx
->
startTs
)
{
return
;
}
val
=
((
char
*
)
pCtx
->
pInput
)
+
pCtx
->
inputBytes
;
}
else
{
return
;
}
}
else
{
val
=
(
char
*
)
pCtx
->
pInput
;
}
assignVal
(
pCtx
->
pOutput
,
val
,
pCtx
->
outputBytes
,
pCtx
->
inputType
);
}
else
if
(
type
==
TSDB_FILL_LINEAR
)
{
if
(
pCtx
->
size
<=
1
)
{
return
;
}
TSKEY
ekey
=
GET_TS_DATA
(
pCtx
,
1
);
// no data generated yet
if
(
!
(
skey
<
pCtx
->
startTs
&&
ekey
>
pCtx
->
startTs
))
{
return
;
}
assert
(
pCtx
->
start
.
key
==
INT64_MIN
&&
skey
<
pCtx
->
startTs
&&
ekey
>
pCtx
->
startTs
);
char
*
start
=
GET_INPUT_DATA
(
pCtx
,
0
);
char
*
end
=
GET_INPUT_DATA
(
pCtx
,
1
);
...
...
src/query/src/qExecutor.c
浏览文件 @
adb5b0f9
此差异已折叠。
点击以展开。
src/query/src/qPlan.c
浏览文件 @
adb5b0f9
...
...
@@ -567,10 +567,18 @@ SArray* createExecOperatorPlan(SQueryAttr* pQueryAttr) {
}
}
else
if
(
pQueryAttr
->
interval
.
interval
>
0
)
{
if
(
pQueryAttr
->
stableQuery
)
{
op
=
OP_MultiTableTimeInterval
;
if
(
pQueryAttr
->
pointInterpQuery
)
{
op
=
OP_AllMultiTableTimeInterval
;
}
else
{
op
=
OP_MultiTableTimeInterval
;
}
taosArrayPush
(
plan
,
&
op
);
}
else
{
op
=
OP_TimeWindow
;
}
else
{
if
(
pQueryAttr
->
pointInterpQuery
)
{
op
=
OP_AllTimeWindow
;
}
else
{
op
=
OP_TimeWindow
;
}
taosArrayPush
(
plan
,
&
op
);
if
(
pQueryAttr
->
pExpr2
!=
NULL
)
{
...
...
@@ -578,7 +586,7 @@ SArray* createExecOperatorPlan(SQueryAttr* pQueryAttr) {
taosArrayPush
(
plan
,
&
op
);
}
if
(
pQueryAttr
->
fillType
!=
TSDB_FILL_NONE
&&
(
!
pQueryAttr
->
pointInterpQuery
)
)
{
if
(
pQueryAttr
->
fillType
!=
TSDB_FILL_NONE
)
{
op
=
OP_Fill
;
taosArrayPush
(
plan
,
&
op
);
}
...
...
src/tsdb/inc/tsdbMeta.h
浏览文件 @
adb5b0f9
...
...
@@ -24,8 +24,7 @@ typedef struct STable {
tstr
*
name
;
// NOTE: there a flexible string here
uint64_t
suid
;
struct
STable
*
pSuper
;
// super table pointer
uint8_t
numOfSchemas
;
STSchema
*
schema
[
TSDB_MAX_TABLE_SCHEMAS
];
SArray
*
schema
;
STSchema
*
tagSchema
;
SKVRow
tagVal
;
SSkipList
*
pIndex
;
// For TSDB_SUPER_TABLE, it is the skiplist index
...
...
@@ -107,10 +106,9 @@ static FORCE_INLINE STSchema* tsdbGetTableSchemaImpl(STable* pTable, bool lock,
if
(
lock
)
TSDB_RLOCK_TABLE
(
pDTable
);
if
(
_version
<
0
)
{
// get the latest version of schema
pTSchema
=
pDTable
->
schema
[
pDTable
->
numOfSchemas
-
1
]
;
pTSchema
=
*
(
STSchema
**
)
taosArrayGetLast
(
pDTable
->
schema
)
;
}
else
{
// get the schema with version
void
*
ptr
=
taosbsearch
(
&
_version
,
pDTable
->
schema
,
pDTable
->
numOfSchemas
,
sizeof
(
STSchema
*
),
tsdbCompareSchemaVersion
,
TD_EQ
);
void
*
ptr
=
taosArraySearch
(
pDTable
->
schema
,
&
_version
,
tsdbCompareSchemaVersion
,
TD_EQ
);
if
(
ptr
==
NULL
)
{
terrno
=
TSDB_CODE_TDB_IVD_TB_SCHEMA_VERSION
;
goto
_exit
;
...
...
src/tsdb/src/tsdbMeta.c
浏览文件 @
adb5b0f9
...
...
@@ -44,6 +44,8 @@ static int tsdbRemoveTableFromStore(STsdbRepo *pRepo, STable *pTable);
static
int
tsdbRmTableFromMeta
(
STsdbRepo
*
pRepo
,
STable
*
pTable
);
static
int
tsdbAdjustMetaTables
(
STsdbRepo
*
pRepo
,
int
tid
);
static
int
tsdbCheckTableTagVal
(
SKVRow
*
pKVRow
,
STSchema
*
pSchema
);
static
int
tsdbAddSchema
(
STable
*
pTable
,
STSchema
*
pSchema
);
static
void
tsdbFreeTableSchema
(
STable
*
pTable
);
// ------------------ OUTER FUNCTIONS ------------------
int
tsdbCreateTable
(
STsdbRepo
*
repo
,
STableCfg
*
pCfg
)
{
...
...
@@ -723,17 +725,10 @@ void tsdbUpdateTableSchema(STsdbRepo *pRepo, STable *pTable, STSchema *pSchema,
STsdbMeta
*
pMeta
=
pRepo
->
tsdbMeta
;
STable
*
pCTable
=
(
TABLE_TYPE
(
pTable
)
==
TSDB_CHILD_TABLE
)
?
pTable
->
pSuper
:
pTable
;
ASSERT
(
schemaVersion
(
pSchema
)
>
schemaVersion
(
pCTable
->
schema
[
pCTable
->
numOfSchemas
-
1
]
));
ASSERT
(
schemaVersion
(
pSchema
)
>
schemaVersion
(
*
(
STSchema
**
)
taosArrayGetLast
(
pCTable
->
schema
)
));
TSDB_WLOCK_TABLE
(
pCTable
);
if
(
pCTable
->
numOfSchemas
<
TSDB_MAX_TABLE_SCHEMAS
)
{
pCTable
->
schema
[
pCTable
->
numOfSchemas
++
]
=
pSchema
;
}
else
{
ASSERT
(
pCTable
->
numOfSchemas
==
TSDB_MAX_TABLE_SCHEMAS
);
tdFreeSchema
(
pCTable
->
schema
[
0
]);
memmove
(
pCTable
->
schema
,
pCTable
->
schema
+
1
,
sizeof
(
STSchema
*
)
*
(
TSDB_MAX_TABLE_SCHEMAS
-
1
));
pCTable
->
schema
[
pCTable
->
numOfSchemas
-
1
]
=
pSchema
;
}
tsdbAddSchema
(
pCTable
,
pSchema
);
if
(
schemaNCols
(
pSchema
)
>
pMeta
->
maxCols
)
pMeta
->
maxCols
=
schemaNCols
(
pSchema
);
if
(
schemaTLen
(
pSchema
)
>
pMeta
->
maxRowBytes
)
pMeta
->
maxRowBytes
=
schemaTLen
(
pSchema
);
...
...
@@ -829,9 +824,7 @@ static STable *tsdbCreateTableFromCfg(STableCfg *pCfg, bool isSuper, STable *pST
TABLE_TID
(
pTable
)
=
-
1
;
TABLE_SUID
(
pTable
)
=
-
1
;
pTable
->
pSuper
=
NULL
;
pTable
->
numOfSchemas
=
1
;
pTable
->
schema
[
0
]
=
tdDupSchema
(
pCfg
->
schema
);
if
(
pTable
->
schema
[
0
]
==
NULL
)
{
if
(
tsdbAddSchema
(
pTable
,
tdDupSchema
(
pCfg
->
schema
))
<
0
)
{
terrno
=
TSDB_CODE_TDB_OUT_OF_MEMORY
;
goto
_err
;
}
...
...
@@ -842,7 +835,8 @@ static STable *tsdbCreateTableFromCfg(STableCfg *pCfg, bool isSuper, STable *pST
}
pTable
->
tagVal
=
NULL
;
STColumn
*
pCol
=
schemaColAt
(
pTable
->
tagSchema
,
DEFAULT_TAG_INDEX_COLUMN
);
pTable
->
pIndex
=
tSkipListCreate
(
TSDB_SUPER_TABLE_SL_LEVEL
,
colType
(
pCol
),
(
uint8_t
)(
colBytes
(
pCol
)),
NULL
,
SL_ALLOW_DUP_KEY
,
getTagIndexKey
);
pTable
->
pIndex
=
tSkipListCreate
(
TSDB_SUPER_TABLE_SL_LEVEL
,
colType
(
pCol
),
(
uint8_t
)(
colBytes
(
pCol
)),
NULL
,
SL_ALLOW_DUP_KEY
,
getTagIndexKey
);
if
(
pTable
->
pIndex
==
NULL
)
{
terrno
=
TSDB_CODE_TDB_OUT_OF_MEMORY
;
goto
_err
;
...
...
@@ -871,9 +865,7 @@ static STable *tsdbCreateTableFromCfg(STableCfg *pCfg, bool isSuper, STable *pST
}
}
else
{
TABLE_SUID
(
pTable
)
=
-
1
;
pTable
->
numOfSchemas
=
1
;
pTable
->
schema
[
0
]
=
tdDupSchema
(
pCfg
->
schema
);
if
(
pTable
->
schema
[
0
]
==
NULL
)
{
if
(
tsdbAddSchema
(
pTable
,
tdDupSchema
(
pCfg
->
schema
))
<
0
)
{
terrno
=
TSDB_CODE_TDB_OUT_OF_MEMORY
;
goto
_err
;
}
...
...
@@ -907,9 +899,7 @@ static void tsdbFreeTable(STable *pTable) {
TABLE_UID
(
pTable
));
tfree
(
TABLE_NAME
(
pTable
));
if
(
TABLE_TYPE
(
pTable
)
!=
TSDB_CHILD_TABLE
)
{
for
(
int
i
=
0
;
i
<
TSDB_MAX_TABLE_SCHEMAS
;
i
++
)
{
tdFreeSchema
(
pTable
->
schema
[
i
]);
}
tsdbFreeTableSchema
(
pTable
);
if
(
TABLE_TYPE
(
pTable
)
==
TSDB_SUPER_TABLE
)
{
tdFreeSchema
(
pTable
->
tagSchema
);
...
...
@@ -1261,9 +1251,10 @@ static int tsdbEncodeTable(void **buf, STable *pTable) {
tlen
+=
taosEncodeFixedU64
(
buf
,
TABLE_SUID
(
pTable
));
tlen
+=
tdEncodeKVRow
(
buf
,
pTable
->
tagVal
);
}
else
{
tlen
+=
taosEncodeFixedU8
(
buf
,
pTable
->
numOfSchemas
);
for
(
int
i
=
0
;
i
<
pTable
->
numOfSchemas
;
i
++
)
{
tlen
+=
tdEncodeSchema
(
buf
,
pTable
->
schema
[
i
]);
tlen
+=
taosEncodeFixedU8
(
buf
,
(
uint8_t
)
taosArrayGetSize
(
pTable
->
schema
));
for
(
int
i
=
0
;
i
<
taosArrayGetSize
(
pTable
->
schema
);
i
++
)
{
STSchema
*
pSchema
=
taosArrayGetP
(
pTable
->
schema
,
i
);
tlen
+=
tdEncodeSchema
(
buf
,
pSchema
);
}
if
(
TABLE_TYPE
(
pTable
)
==
TSDB_SUPER_TABLE
)
{
...
...
@@ -1294,9 +1285,12 @@ static void *tsdbDecodeTable(void *buf, STable **pRTable) {
buf
=
taosDecodeFixedU64
(
buf
,
&
TABLE_SUID
(
pTable
));
buf
=
tdDecodeKVRow
(
buf
,
&
(
pTable
->
tagVal
));
}
else
{
buf
=
taosDecodeFixedU8
(
buf
,
&
(
pTable
->
numOfSchemas
));
for
(
int
i
=
0
;
i
<
pTable
->
numOfSchemas
;
i
++
)
{
buf
=
tdDecodeSchema
(
buf
,
&
(
pTable
->
schema
[
i
]));
uint8_t
nSchemas
;
buf
=
taosDecodeFixedU8
(
buf
,
&
nSchemas
);
for
(
int
i
=
0
;
i
<
nSchemas
;
i
++
)
{
STSchema
*
pSchema
;
buf
=
tdDecodeSchema
(
buf
,
&
pSchema
);
tsdbAddSchema
(
pTable
,
pSchema
);
}
if
(
TABLE_TYPE
(
pTable
)
==
TSDB_SUPER_TABLE
)
{
...
...
@@ -1458,3 +1452,38 @@ static int tsdbCheckTableTagVal(SKVRow *pKVRow, STSchema *pSchema) {
return
0
;
}
static
int
tsdbAddSchema
(
STable
*
pTable
,
STSchema
*
pSchema
)
{
ASSERT
(
TABLE_TYPE
(
pTable
)
!=
TSDB_CHILD_TABLE
);
if
(
pTable
->
schema
==
NULL
)
{
pTable
->
schema
=
taosArrayInit
(
TSDB_MAX_TABLE_SCHEMAS
,
sizeof
(
SSchema
*
));
if
(
pTable
->
schema
==
NULL
)
{
terrno
=
TAOS_SYSTEM_ERROR
(
errno
);
return
-
1
;
}
}
ASSERT
(
taosArrayGetSize
(
pTable
->
schema
)
==
0
||
schemaVersion
(
pSchema
)
>
schemaVersion
(
*
(
STSchema
**
)
taosArrayGetLast
(
pTable
->
schema
)));
if
(
taosArrayPush
(
pTable
->
schema
,
&
pSchema
)
==
NULL
)
{
terrno
=
TAOS_SYSTEM_ERROR
(
errno
);
return
-
1
;
}
return
0
;
}
static
void
tsdbFreeTableSchema
(
STable
*
pTable
)
{
ASSERT
(
pTable
!=
NULL
);
if
(
pTable
->
schema
)
{
for
(
size_t
i
=
0
;
i
<
taosArrayGetSize
(
pTable
->
schema
);
i
++
)
{
STSchema
*
pSchema
=
taosArrayGetP
(
pTable
->
schema
,
i
);
tdFreeSchema
(
pSchema
);
}
taosArrayDestroy
(
pTable
->
schema
);
}
}
\ No newline at end of file
src/tsdb/src/tsdbRead.c
浏览文件 @
adb5b0f9
...
...
@@ -2693,7 +2693,7 @@ static void destroyHelper(void* param) {
free
(
param
);
}
static
bool
loadBlockOfActiveTable
(
STsdbQueryHandle
*
pQueryHandle
)
{
static
bool
loadBlockOfActiveTable
(
STsdbQueryHandle
*
pQueryHandle
)
{
if
(
pQueryHandle
->
checkFiles
)
{
// check if the query range overlaps with the file data block
bool
exists
=
true
;
...
...
tests/pytest/alter/alterColMultiTimes.py
0 → 100644
浏览文件 @
adb5b0f9
###################################################################
# Copyright (c) 2016 by TAOS Technologies, Inc.
# All rights reserved.
#
# This file is proprietary and confidential to TAOS Technologies.
# No part of this file may be reproduced, stored, transmitted,
# disclosed or used in any form or by any means other than as
# expressly provided by the written permission from Jianhui Tao
#
###################################################################
# -*- coding: utf-8 -*-
import
random
import
string
from
util.log
import
*
from
util.cases
import
*
from
util.sql
import
*
from
util.dnodes
import
*
class
TDTestCase
:
def
init
(
self
,
conn
,
logSql
):
tdLog
.
debug
(
"start to execute %s"
%
__file__
)
tdSql
.
init
(
conn
.
cursor
(),
logSql
)
def
genColList
(
self
):
'''
generate column list
'''
col_list
=
list
()
for
i
in
range
(
1
,
18
):
col_list
.
append
(
f
'c
{
i
}
'
)
return
col_list
def
genIncreaseValue
(
self
,
input_value
):
'''
add ', 1' to end of value every loop
'''
value_list
=
list
(
input_value
)
value_list
.
insert
(
-
1
,
", 1"
)
return
''
.
join
(
value_list
)
def
insertAlter
(
self
):
'''
after each alter and insert, when execute 'select * from {tbname};' taosd will coredump
'''
tbname
=
''
.
join
(
random
.
choice
(
string
.
ascii_letters
.
lower
())
for
i
in
range
(
7
))
input_value
=
'(now, 1)'
tdSql
.
execute
(
f
'create table
{
tbname
}
(ts timestamp, c0 int);'
)
tdSql
.
execute
(
f
'insert into
{
tbname
}
values
{
input_value
}
;'
)
for
col
in
self
.
genColList
():
input_value
=
self
.
genIncreaseValue
(
input_value
)
tdSql
.
execute
(
f
'alter table
{
tbname
}
add column
{
col
}
int;'
)
tdSql
.
execute
(
f
'insert into
{
tbname
}
values
{
input_value
}
;'
)
tdSql
.
query
(
f
'select * from
{
tbname
}
;'
)
tdSql
.
checkRows
(
18
)
def
run
(
self
):
tdSql
.
prepare
()
self
.
insertAlter
()
def
stop
(
self
):
tdSql
.
close
()
tdLog
.
success
(
"%s successfully executed"
%
__file__
)
tdCases
.
addWindows
(
__file__
,
TDTestCase
())
tdCases
.
addLinux
(
__file__
,
TDTestCase
())
tests/pytest/fulltest.sh
浏览文件 @
adb5b0f9
...
...
@@ -381,6 +381,7 @@ python3 ./test.py -f query/querySession.py
python3 test.py
-f
alter/alter_create_exception.py
python3 ./test.py
-f
insert/flushwhiledrop.py
python3 ./test.py
-f
insert/schemalessInsert.py
python3 ./test.py
-f
alter/alterColMultiTimes.py
#======================p4-end===============
...
...
tests/pytest/tools/taosdemoAllTest/NanoTestCase/taosdemoTestSupportNanoInsert.py
浏览文件 @
adb5b0f9
...
...
@@ -47,7 +47,6 @@ class TDTestCase:
else
:
tdLog
.
info
(
"taosd found in %s"
%
buildPath
)
binPath
=
buildPath
+
"/build/bin/"
# insert: create one or mutiple tables per sql and insert multiple rows per sql
# insert data from a special timestamp
# check stable stb0
...
...
@@ -90,7 +89,6 @@ class TDTestCase:
os
.
system
(
"%staosdemo -f tools/taosdemoAllTest/NanoTestCase/taosdemoTestNanoDatabaseNow.json -y "
%
binPath
)
tdSql
.
execute
(
"use nsdb2"
)
tdSql
.
query
(
"show stables"
)
tdSql
.
checkData
(
0
,
4
,
100
)
...
...
tests/pytest/tools/taosdemoAllTest/taosdemoTestSupportNanosubscribe.py
浏览文件 @
adb5b0f9
...
...
@@ -103,7 +103,6 @@ class TDTestCase:
os
.
system
(
"cat subscribe_res0.txt* > all_subscribe_res0.txt"
)
subTimes0
=
self
.
subTimes
(
"all_subscribe_res0.txt"
)
print
(
"pass"
)
self
.
assertCheck
(
"all_subscribe_res0.txt"
,
subTimes0
,
202
)
...
...
tests/script/general/parser/interp.sim
浏览文件 @
adb5b0f9
...
...
@@ -55,6 +55,9 @@ while $i < $halfNum
endw
print ====== tables created
sql create table ap1 (ts timestamp, pav float);
sql INSERT INTO ap1 VALUES ('2021-07-25 02:19:54.100',1) ('2021-07-25 02:19:54.200',2) ('2021-07-25 02:19:54.300',3) ('2021-07-25 02:19:56.500',4) ('2021-07-25 02:19:57.500',5) ('2021-07-25 02:19:57.600',6) ('2021-07-25 02:19:57.900',7) ('2021-07-25 02:19:58.100',8) ('2021-07-25 02:19:58.300',9) ('2021-07-25 02:19:59.100',10) ('2021-07-25 02:19:59.300',11) ('2021-07-25 02:19:59.500',12) ('2021-07-25 02:19:59.700',13) ('2021-07-25 02:19:59.900',14) ('2021-07-25 02:20:05.000', 20) ('2021-07-25 02:25:00.000', 10000);
run general/parser/interp_test.sim
print ================== restart server to commit data into disk
...
...
@@ -65,4 +68,4 @@ print ================== server restart completed
run general/parser/interp_test.sim
system sh/exec.sh -n dnode1 -s stop -x SIGINT
\ No newline at end of file
#system sh/exec.sh -n dnode1 -s stop -x SIGINT
tests/script/general/parser/interp_test.sim
浏览文件 @
adb5b0f9
此差异已折叠。
点击以展开。
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录