Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
b6d2778e
T
TDengine
项目概览
taosdata
/
TDengine
大约 1 年 前同步成功
通知
1184
Star
22015
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
b6d2778e
编写于
8月 03, 2022
作者:
C
Cary Xu
浏览文件
操作
浏览文件
下载
差异文件
Merge branch '3.0' into feature/TD-11274-3.0
上级
f887dd01
3b3dc197
变更
18
隐藏空白更改
内联
并排
Showing
18 changed file
with
1999 addition
and
1919 deletion
+1999
-1919
include/libs/nodes/cmdnodes.h
include/libs/nodes/cmdnodes.h
+4
-1
include/libs/nodes/plannodes.h
include/libs/nodes/plannodes.h
+2
-0
source/dnode/vnode/src/vnd/vnodeSync.c
source/dnode/vnode/src/vnd/vnodeSync.c
+9
-8
source/libs/command/src/command.c
source/libs/command/src/command.c
+38
-17
source/libs/function/src/tudf.c
source/libs/function/src/tudf.c
+5
-1
source/libs/nodes/src/nodesUtilFuncs.c
source/libs/nodes/src/nodesUtilFuncs.c
+18
-1
source/libs/parser/inc/parAst.h
source/libs/parser/inc/parAst.h
+2
-2
source/libs/parser/inc/sql.y
source/libs/parser/inc/sql.y
+2
-6
source/libs/parser/src/parAstCreater.c
source/libs/parser/src/parAstCreater.c
+8
-10
source/libs/parser/src/parAstParser.c
source/libs/parser/src/parAstParser.c
+9
-7
source/libs/parser/src/parTranslater.c
source/libs/parser/src/parTranslater.c
+28
-12
source/libs/parser/src/sql.c
source/libs/parser/src/sql.c
+1850
-1843
source/libs/parser/test/parShowToUse.cpp
source/libs/parser/test/parShowToUse.cpp
+4
-2
source/libs/planner/inc/planInt.h
source/libs/planner/inc/planInt.h
+7
-7
source/libs/planner/src/planUtil.c
source/libs/planner/src/planUtil.c
+8
-0
source/libs/sync/src/syncMain.c
source/libs/sync/src/syncMain.c
+1
-1
source/libs/sync/src/syncTimeout.c
source/libs/sync/src/syncTimeout.c
+3
-0
tests/system-test/2-query/json_tag.py
tests/system-test/2-query/json_tag.py
+1
-1
未找到文件。
include/libs/nodes/cmdnodes.h
浏览文件 @
b6d2778e
...
...
@@ -253,7 +253,8 @@ typedef struct SShowCreateTableStmt {
ENodeType
type
;
char
dbName
[
TSDB_DB_NAME_LEN
];
char
tableName
[
TSDB_TABLE_NAME_LEN
];
void
*
pCfg
;
// STableCfg
void
*
pDbCfg
;
// SDbCfgInfo
void
*
pTableCfg
;
// STableCfg
}
SShowCreateTableStmt
;
typedef
struct
SShowTableDistributedStmt
{
...
...
@@ -282,6 +283,7 @@ typedef struct SCreateIndexStmt {
ENodeType
type
;
EIndexType
indexType
;
bool
ignoreExists
;
char
indexDbName
[
TSDB_DB_NAME_LEN
];
char
indexName
[
TSDB_INDEX_NAME_LEN
];
char
dbName
[
TSDB_DB_NAME_LEN
];
char
tableName
[
TSDB_TABLE_NAME_LEN
];
...
...
@@ -292,6 +294,7 @@ typedef struct SCreateIndexStmt {
typedef
struct
SDropIndexStmt
{
ENodeType
type
;
bool
ignoreNotExists
;
char
indexDbName
[
TSDB_DB_NAME_LEN
];
char
indexName
[
TSDB_INDEX_NAME_LEN
];
}
SDropIndexStmt
;
...
...
include/libs/nodes/plannodes.h
浏览文件 @
b6d2778e
...
...
@@ -552,6 +552,8 @@ typedef struct SQueryPlan {
void
nodesWalkPhysiPlan
(
SNode
*
pNode
,
FNodeWalker
walker
,
void
*
pContext
);
const
char
*
dataOrderStr
(
EDataOrderLevel
order
);
#ifdef __cplusplus
}
#endif
...
...
source/dnode/vnode/src/vnd/vnodeSync.c
浏览文件 @
b6d2778e
...
...
@@ -19,9 +19,8 @@
#define BATCH_DISABLE 1
static
inline
bool
vnodeIsMsgBlock
(
tmsg_t
type
)
{
return
(
type
==
TDMT_VND_CREATE_TABLE
)
||
(
type
==
TDMT_VND_CREATE_TABLE
)
||
(
type
==
TDMT_VND_CREATE_TABLE
)
||
(
type
==
TDMT_VND_ALTER_TABLE
)
||
(
type
==
TDMT_VND_DROP_TABLE
)
||
(
type
==
TDMT_VND_UPDATE_TAG_VAL
)
||
(
type
==
TDMT_VND_ALTER_REPLICA
);
return
(
type
==
TDMT_VND_CREATE_TABLE
)
||
(
type
==
TDMT_VND_ALTER_TABLE
)
||
(
type
==
TDMT_VND_DROP_TABLE
)
||
(
type
==
TDMT_VND_UPDATE_TAG_VAL
)
||
(
type
==
TDMT_VND_ALTER_REPLICA
);
}
static
inline
bool
vnodeIsMsgWeak
(
tmsg_t
type
)
{
return
false
;
}
...
...
@@ -611,10 +610,10 @@ static int32_t vnodeSnapshotStartWrite(struct SSyncFSM *pFsm, void *pParam, void
do
{
int32_t
itemSize
=
tmsgGetQueueSize
(
&
pVnode
->
msgCb
,
pVnode
->
config
.
vgId
,
APPLY_QUEUE
);
if
(
itemSize
==
0
)
{
v
Debug
(
"vgId:%d, apply queue is empty, start write snapshot
"
,
pVnode
->
config
.
vgId
);
v
Info
(
"vgId:%d, start write vnode snapshot since apply queue is empty
"
,
pVnode
->
config
.
vgId
);
break
;
}
else
{
v
Debug
(
"vgId:%d, %d items in apply queue, write snapshot later
"
,
pVnode
->
config
.
vgId
);
v
Info
(
"vgId:%d, write vnode snapshot later since %d items in apply queue
"
,
pVnode
->
config
.
vgId
);
taosMsleep
(
10
);
}
}
while
(
true
);
...
...
@@ -630,10 +629,11 @@ static int32_t vnodeSnapshotStartWrite(struct SSyncFSM *pFsm, void *pParam, void
static
int32_t
vnodeSnapshotStopWrite
(
struct
SSyncFSM
*
pFsm
,
void
*
pWriter
,
bool
isApply
,
SSnapshot
*
pSnapshot
)
{
#ifdef USE_TSDB_SNAPSHOT
SVnode
*
pVnode
=
pFsm
->
data
;
vDebug
(
"vgId:%d, stop write snapshot, isApply:%d"
,
pVnode
->
config
.
vgId
,
isApply
);
vInfo
(
"vgId:%d, stop write vnode snapshot, apply:%d, index:%"
PRId64
" term:%"
PRIu64
" config:%"
PRId64
,
pVnode
->
config
.
vgId
,
isApply
,
pSnapshot
->
lastApplyIndex
,
pSnapshot
->
lastApplyTerm
,
pSnapshot
->
lastApplyIndex
);
int32_t
code
=
vnodeSnapWriterClose
(
pWriter
,
!
isApply
,
pSnapshot
);
v
Debug
(
"vgId:%d, apply snapshot to vnode
, code:0x%x"
,
pVnode
->
config
.
vgId
,
code
);
v
Info
(
"vgId:%d, apply vnode snapshot finished
, code:0x%x"
,
pVnode
->
config
.
vgId
,
code
);
return
code
;
#else
taosMemoryFree
(
pWriter
);
...
...
@@ -644,8 +644,9 @@ static int32_t vnodeSnapshotStopWrite(struct SSyncFSM *pFsm, void *pWriter, bool
static
int32_t
vnodeSnapshotDoWrite
(
struct
SSyncFSM
*
pFsm
,
void
*
pWriter
,
void
*
pBuf
,
int32_t
len
)
{
#ifdef USE_TSDB_SNAPSHOT
SVnode
*
pVnode
=
pFsm
->
data
;
vDebug
(
"vgId:%d, continue write vnode snapshot, len:%d"
,
pVnode
->
config
.
vgId
,
len
);
int32_t
code
=
vnodeSnapWrite
(
pWriter
,
pBuf
,
len
);
v
Trace
(
"vgId:%d, write snapshot
, len:%d"
,
pVnode
->
config
.
vgId
,
len
);
v
Debug
(
"vgId:%d, continue write vnode snapshot finished
, len:%d"
,
pVnode
->
config
.
vgId
,
len
);
return
code
;
#else
return
0
;
...
...
source/libs/command/src/command.c
浏览文件 @
b6d2778e
...
...
@@ -192,6 +192,26 @@ char* buildRetension(SArray* pRetension) {
return
p1
;
}
static
const
char
*
cacheModelStr
(
int8_t
cacheModel
)
{
switch
(
cacheModel
)
{
case
TSDB_CACHE_MODEL_NONE
:
return
TSDB_CACHE_MODEL_NONE_STR
;
case
TSDB_CACHE_MODEL_LAST_ROW
:
return
TSDB_CACHE_MODEL_LAST_ROW_STR
;
case
TSDB_CACHE_MODEL_LAST_VALUE
:
return
TSDB_CACHE_MODEL_LAST_VALUE_STR
;
case
TSDB_CACHE_MODEL_BOTH
:
return
TSDB_CACHE_MODEL_BOTH_STR
;
default:
break
;
}
return
TSDB_CACHE_MODEL_NONE_STR
;
}
static
const
char
*
strictStr
(
int8_t
strict
)
{
return
TSDB_DB_STRICT_ON
==
strict
?
TSDB_DB_STRICT_ON_STR
:
TSDB_DB_STRICT_OFF_STR
;
}
static
void
setCreateDBResultIntoDataBlock
(
SSDataBlock
*
pBlock
,
char
*
dbFName
,
SDbCfgInfo
*
pCfg
)
{
blockDataEnsureCapacity
(
pBlock
,
1
);
pBlock
->
info
.
rows
=
1
;
...
...
@@ -222,14 +242,15 @@ static void setCreateDBResultIntoDataBlock(SSDataBlock* pBlock, char* dbFName, S
char
*
retentions
=
buildRetension
(
pCfg
->
pRetensions
);
len
+=
sprintf
(
buf2
+
VARSTR_HEADER_SIZE
,
"CREATE DATABASE `%s` BUFFER %d CACHEMODEL %d COMP %d DURATION %dm "
"FSYNC %d MAXROWS %d MINROWS %d KEEP %dm,%dm,%dm PAGES %d PAGESIZE %d PRECISION '%s' REPLICA %d "
"STRICT %d WAL %d VGROUPS %d SINGLE_STABLE %d"
,
dbFName
,
pCfg
->
buffer
,
pCfg
->
cacheLast
,
pCfg
->
compression
,
pCfg
->
daysPerFile
,
pCfg
->
walFsyncPeriod
,
pCfg
->
maxRows
,
pCfg
->
minRows
,
pCfg
->
daysToKeep0
,
pCfg
->
daysToKeep1
,
pCfg
->
daysToKeep2
,
pCfg
->
pages
,
pCfg
->
pageSize
,
prec
,
pCfg
->
replications
,
pCfg
->
strict
,
pCfg
->
walLevel
,
pCfg
->
numOfVgroups
,
1
==
pCfg
->
numOfStables
);
len
+=
sprintf
(
buf2
+
VARSTR_HEADER_SIZE
,
"CREATE DATABASE `%s` BUFFER %d CACHEMODEL '%s' COMP %d DURATION %dm "
"WAL_FSYNC_PERIOD %d MAXROWS %d MINROWS %d KEEP %dm,%dm,%dm PAGES %d PAGESIZE %d PRECISION '%s' REPLICA %d "
"STRICT '%s' WAL_LEVEL %d VGROUPS %d SINGLE_STABLE %d"
,
dbFName
,
pCfg
->
buffer
,
cacheModelStr
(
pCfg
->
cacheLast
),
pCfg
->
compression
,
pCfg
->
daysPerFile
,
pCfg
->
walFsyncPeriod
,
pCfg
->
maxRows
,
pCfg
->
minRows
,
pCfg
->
daysToKeep0
,
pCfg
->
daysToKeep1
,
pCfg
->
daysToKeep2
,
pCfg
->
pages
,
pCfg
->
pageSize
,
prec
,
pCfg
->
replications
,
strictStr
(
pCfg
->
strict
),
pCfg
->
walLevel
,
pCfg
->
numOfVgroups
,
1
==
pCfg
->
numOfStables
);
if
(
retentions
)
{
len
+=
sprintf
(
buf2
+
VARSTR_HEADER_SIZE
+
len
,
" RETENTIONS %s"
,
retentions
);
...
...
@@ -383,21 +404,21 @@ int32_t appendTagValues(char* buf, int32_t* len, STableCfg* pCfg) {
return
TSDB_CODE_SUCCESS
;
}
void
appendTableOptions
(
char
*
buf
,
int32_t
*
len
,
STableCfg
*
pCfg
)
{
void
appendTableOptions
(
char
*
buf
,
int32_t
*
len
,
S
DbCfgInfo
*
pDbCfg
,
S
TableCfg
*
pCfg
)
{
if
(
pCfg
->
commentLen
>
0
)
{
*
len
+=
sprintf
(
buf
+
VARSTR_HEADER_SIZE
+
*
len
,
" COMMENT '%s'"
,
pCfg
->
pComment
);
}
else
if
(
0
==
pCfg
->
commentLen
)
{
*
len
+=
sprintf
(
buf
+
VARSTR_HEADER_SIZE
+
*
len
,
" COMMENT ''"
);
}
if
(
pCfg
->
watermark1
>
0
)
{
if
(
NULL
!=
pDbCfg
->
pRetensions
&&
pCfg
->
watermark1
>
0
)
{
*
len
+=
sprintf
(
buf
+
VARSTR_HEADER_SIZE
+
*
len
,
" WATERMARK %"
PRId64
"a"
,
pCfg
->
watermark1
);
if
(
pCfg
->
watermark2
>
0
)
{
*
len
+=
sprintf
(
buf
+
VARSTR_HEADER_SIZE
+
*
len
,
", %"
PRId64
"a"
,
pCfg
->
watermark2
);
}
}
if
(
pCfg
->
delay1
>
0
)
{
if
(
NULL
!=
pDbCfg
->
pRetensions
&&
pCfg
->
delay1
>
0
)
{
*
len
+=
sprintf
(
buf
+
VARSTR_HEADER_SIZE
+
*
len
,
" MAX_DELAY %"
PRId64
"a"
,
pCfg
->
delay1
);
if
(
pCfg
->
delay2
>
0
)
{
*
len
+=
sprintf
(
buf
+
VARSTR_HEADER_SIZE
+
*
len
,
", %"
PRId64
"a"
,
pCfg
->
delay2
);
...
...
@@ -405,7 +426,7 @@ void appendTableOptions(char* buf, int32_t* len, STableCfg* pCfg) {
}
int32_t
funcNum
=
taosArrayGetSize
(
pCfg
->
pFuncs
);
if
(
funcNum
>
0
)
{
if
(
NULL
!=
pDbCfg
->
pRetensions
&&
funcNum
>
0
)
{
*
len
+=
sprintf
(
buf
+
VARSTR_HEADER_SIZE
+
*
len
,
" ROLLUP("
);
for
(
int32_t
i
=
0
;
i
<
funcNum
;
++
i
)
{
char
*
pFunc
=
taosArrayGet
(
pCfg
->
pFuncs
,
i
);
...
...
@@ -419,7 +440,7 @@ void appendTableOptions(char* buf, int32_t* len, STableCfg* pCfg) {
}
}
static
int32_t
setCreateTBResultIntoDataBlock
(
SSDataBlock
*
pBlock
,
char
*
tbName
,
STableCfg
*
pCfg
)
{
static
int32_t
setCreateTBResultIntoDataBlock
(
SSDataBlock
*
pBlock
,
SDbCfgInfo
*
pDbCfg
,
char
*
tbName
,
STableCfg
*
pCfg
)
{
int32_t
code
=
0
;
blockDataEnsureCapacity
(
pBlock
,
1
);
pBlock
->
info
.
rows
=
1
;
...
...
@@ -439,7 +460,7 @@ static int32_t setCreateTBResultIntoDataBlock(SSDataBlock* pBlock, char* tbName,
len
+=
sprintf
(
buf2
+
VARSTR_HEADER_SIZE
+
len
,
") TAGS ("
);
appendTagFields
(
buf2
,
&
len
,
pCfg
);
len
+=
sprintf
(
buf2
+
VARSTR_HEADER_SIZE
+
len
,
")"
);
appendTableOptions
(
buf2
,
&
len
,
pCfg
);
appendTableOptions
(
buf2
,
&
len
,
p
DbCfg
,
p
Cfg
);
}
else
if
(
TSDB_CHILD_TABLE
==
pCfg
->
tableType
)
{
len
+=
sprintf
(
buf2
+
VARSTR_HEADER_SIZE
,
"CREATE TABLE `%s` USING `%s` ("
,
tbName
,
pCfg
->
stbName
);
appendTagNameFields
(
buf2
,
&
len
,
pCfg
);
...
...
@@ -449,7 +470,7 @@ static int32_t setCreateTBResultIntoDataBlock(SSDataBlock* pBlock, char* tbName,
return
code
;
}
len
+=
sprintf
(
buf2
+
VARSTR_HEADER_SIZE
+
len
,
")"
);
appendTableOptions
(
buf2
,
&
len
,
pCfg
);
appendTableOptions
(
buf2
,
&
len
,
p
DbCfg
,
p
Cfg
);
}
else
{
len
+=
sprintf
(
buf2
+
VARSTR_HEADER_SIZE
,
"CREATE TABLE `%s` ("
,
tbName
);
appendColumnFields
(
buf2
,
&
len
,
pCfg
);
...
...
@@ -465,7 +486,7 @@ static int32_t setCreateTBResultIntoDataBlock(SSDataBlock* pBlock, char* tbName,
static
int32_t
execShowCreateTable
(
SShowCreateTableStmt
*
pStmt
,
SRetrieveTableRsp
**
pRsp
)
{
SSDataBlock
*
pBlock
=
buildCreateTbResultDataBlock
();
int32_t
code
=
setCreateTBResultIntoDataBlock
(
pBlock
,
pStmt
->
tableName
,
pStmt
->
p
Cfg
);
int32_t
code
=
setCreateTBResultIntoDataBlock
(
pBlock
,
pStmt
->
pDbCfg
,
pStmt
->
tableName
,
pStmt
->
pTable
Cfg
);
if
(
code
)
{
return
code
;
}
...
...
@@ -473,7 +494,7 @@ static int32_t execShowCreateTable(SShowCreateTableStmt* pStmt, SRetrieveTableRs
}
static
int32_t
execShowCreateSTable
(
SShowCreateTableStmt
*
pStmt
,
SRetrieveTableRsp
**
pRsp
)
{
STableCfg
*
pCfg
=
(
STableCfg
*
)
pStmt
->
pCfg
;
STableCfg
*
pCfg
=
(
STableCfg
*
)
pStmt
->
p
Table
Cfg
;
if
(
TSDB_SUPER_TABLE
!=
pCfg
->
tableType
)
{
terrno
=
TSDB_CODE_TSC_NOT_STABLE_ERROR
;
return
terrno
;
...
...
source/libs/function/src/tudf.c
浏览文件 @
b6d2778e
...
...
@@ -976,8 +976,12 @@ int32_t cleanUpUdfs() {
}
uv_mutex_lock
(
&
gUdfdProxy
.
udfStubsMutex
);
int32_t
i
=
0
;
if
(
gUdfdProxy
.
udfStubs
==
NULL
||
taosArrayGetSize
(
gUdfdProxy
.
udfStubs
)
==
0
)
{
uv_mutex_unlock
(
&
gUdfdProxy
.
udfStubsMutex
);
return
TSDB_CODE_SUCCESS
;
}
SArray
*
udfStubs
=
taosArrayInit
(
16
,
sizeof
(
SUdfcFuncStub
));
int32_t
i
=
0
;
while
(
i
<
taosArrayGetSize
(
gUdfdProxy
.
udfStubs
))
{
SUdfcFuncStub
*
stub
=
taosArrayGet
(
gUdfdProxy
.
udfStubs
,
i
);
if
(
stub
->
refCount
==
0
)
{
...
...
source/libs/nodes/src/nodesUtilFuncs.c
浏览文件 @
b6d2778e
...
...
@@ -713,7 +713,8 @@ void nodesDestroyNode(SNode* pNode) {
break
;
case
QUERY_NODE_SHOW_CREATE_TABLE_STMT
:
case
QUERY_NODE_SHOW_CREATE_STABLE_STMT
:
destroyTableCfg
((
STableCfg
*
)(((
SShowCreateTableStmt
*
)
pNode
)
->
pCfg
));
taosMemoryFreeClear
(((
SShowCreateTableStmt
*
)
pNode
)
->
pDbCfg
);
destroyTableCfg
((
STableCfg
*
)(((
SShowCreateTableStmt
*
)
pNode
)
->
pTableCfg
));
break
;
case
QUERY_NODE_SHOW_TABLE_DISTRIBUTED_STMT
:
// no pointer field
case
QUERY_NODE_KILL_CONNECTION_STMT
:
// no pointer field
...
...
@@ -1817,3 +1818,19 @@ int32_t nodesMergeConds(SNode** pDst, SNodeList** pSrc) {
return
TSDB_CODE_SUCCESS
;
}
const
char
*
dataOrderStr
(
EDataOrderLevel
order
)
{
switch
(
order
)
{
case
DATA_ORDER_LEVEL_NONE
:
return
"no order required"
;
case
DATA_ORDER_LEVEL_IN_BLOCK
:
return
"in-datablock order"
;
case
DATA_ORDER_LEVEL_IN_GROUP
:
return
"in-group order"
;
case
DATA_ORDER_LEVEL_GLOBAL
:
return
"global order"
;
default:
break
;
}
return
"unknown"
;
}
source/libs/parser/inc/parAst.h
浏览文件 @
b6d2778e
...
...
@@ -176,11 +176,11 @@ SNode* createDropUserStmt(SAstCreateContext* pCxt, SToken* pUserName);
SNode
*
createCreateDnodeStmt
(
SAstCreateContext
*
pCxt
,
const
SToken
*
pFqdn
,
const
SToken
*
pPort
);
SNode
*
createDropDnodeStmt
(
SAstCreateContext
*
pCxt
,
const
SToken
*
pDnode
);
SNode
*
createAlterDnodeStmt
(
SAstCreateContext
*
pCxt
,
const
SToken
*
pDnode
,
const
SToken
*
pConfig
,
const
SToken
*
pValue
);
SNode
*
createCreateIndexStmt
(
SAstCreateContext
*
pCxt
,
EIndexType
type
,
bool
ignoreExists
,
S
Token
*
pIndexName
,
SNode
*
createCreateIndexStmt
(
SAstCreateContext
*
pCxt
,
EIndexType
type
,
bool
ignoreExists
,
S
Node
*
pIndexName
,
SNode
*
pRealTable
,
SNodeList
*
pCols
,
SNode
*
pOptions
);
SNode
*
createIndexOption
(
SAstCreateContext
*
pCxt
,
SNodeList
*
pFuncs
,
SNode
*
pInterval
,
SNode
*
pOffset
,
SNode
*
pSliding
,
SNode
*
pStreamOptions
);
SNode
*
createDropIndexStmt
(
SAstCreateContext
*
pCxt
,
bool
ignoreNotExists
,
S
Token
*
pIndexName
);
SNode
*
createDropIndexStmt
(
SAstCreateContext
*
pCxt
,
bool
ignoreNotExists
,
S
Node
*
pIndexName
);
SNode
*
createCreateComponentNodeStmt
(
SAstCreateContext
*
pCxt
,
ENodeType
type
,
const
SToken
*
pDnodeId
);
SNode
*
createDropComponentNodeStmt
(
SAstCreateContext
*
pCxt
,
ENodeType
type
,
const
SToken
*
pDnodeId
);
SNode
*
createCreateTopicStmtUseQuery
(
SAstCreateContext
*
pCxt
,
bool
ignoreExists
,
const
SToken
*
pTopicName
,
...
...
source/libs/parser/inc/sql.y
浏览文件 @
b6d2778e
...
...
@@ -424,8 +424,8 @@ from_db_opt(A) ::= FROM db_name(B).
/************************************************ create index ********************************************************/
cmd ::= CREATE SMA INDEX not_exists_opt(D)
index_name(A) ON full_table_name(B) index_options(C). { pCxt->pRootNode = createCreateIndexStmt(pCxt, INDEX_TYPE_SMA, D, &
A, B, NULL, C); }
cmd ::= DROP INDEX exists_opt(B)
index_name(A). { pCxt->pRootNode = createDropIndexStmt(pCxt, B, &
A); }
full_table_name(A) ON full_table_name(B) index_options(C). { pCxt->pRootNode = createCreateIndexStmt(pCxt, INDEX_TYPE_SMA, D,
A, B, NULL, C); }
cmd ::= DROP INDEX exists_opt(B)
full_table_name(A). { pCxt->pRootNode = createDropIndexStmt(pCxt, B,
A); }
index_options(A) ::= FUNCTION NK_LP func_list(B) NK_RP INTERVAL
NK_LP duration_literal(C) NK_RP sliding_opt(D) sma_stream_opt(E). { A = createIndexOption(pCxt, B, releaseRawExprNode(pCxt, C), NULL, D, E); }
...
...
@@ -608,10 +608,6 @@ column_alias(A) ::= NK_ID(B).
%destructor user_name { }
user_name(A) ::= NK_ID(B). { A = B; }
%type index_name { SToken }
%destructor index_name { }
index_name(A) ::= NK_ID(B). { A = B; }
%type topic_name { SToken }
%destructor topic_name { }
topic_name(A) ::= NK_ID(B). { A = B; }
...
...
source/libs/parser/src/parAstCreater.c
浏览文件 @
b6d2778e
...
...
@@ -1402,19 +1402,18 @@ SNode* createAlterDnodeStmt(SAstCreateContext* pCxt, const SToken* pDnode, const
return
(
SNode
*
)
pStmt
;
}
SNode
*
createCreateIndexStmt
(
SAstCreateContext
*
pCxt
,
EIndexType
type
,
bool
ignoreExists
,
S
Token
*
pIndexName
,
SNode
*
createCreateIndexStmt
(
SAstCreateContext
*
pCxt
,
EIndexType
type
,
bool
ignoreExists
,
S
Node
*
pIndexName
,
SNode
*
pRealTable
,
SNodeList
*
pCols
,
SNode
*
pOptions
)
{
CHECK_PARSER_STATUS
(
pCxt
);
if
(
!
checkIndexName
(
pCxt
,
pIndexName
))
{
return
NULL
;
}
SCreateIndexStmt
*
pStmt
=
(
SCreateIndexStmt
*
)
nodesMakeNode
(
QUERY_NODE_CREATE_INDEX_STMT
);
CHECK_OUT_OF_MEM
(
pStmt
);
pStmt
->
indexType
=
type
;
pStmt
->
ignoreExists
=
ignoreExists
;
COPY_STRING_FORM_ID_TOKEN
(
pStmt
->
indexName
,
pIndexName
);
strcpy
(
pStmt
->
indexDbName
,
((
SRealTableNode
*
)
pIndexName
)
->
table
.
dbName
);
strcpy
(
pStmt
->
indexName
,
((
SRealTableNode
*
)
pIndexName
)
->
table
.
tableName
);
strcpy
(
pStmt
->
dbName
,
((
SRealTableNode
*
)
pRealTable
)
->
table
.
dbName
);
strcpy
(
pStmt
->
tableName
,
((
SRealTableNode
*
)
pRealTable
)
->
table
.
tableName
);
nodesDestroyNode
(
pIndexName
);
nodesDestroyNode
(
pRealTable
);
pStmt
->
pCols
=
pCols
;
pStmt
->
pOptions
=
(
SIndexOptions
*
)
pOptions
;
...
...
@@ -1434,15 +1433,14 @@ SNode* createIndexOption(SAstCreateContext* pCxt, SNodeList* pFuncs, SNode* pInt
return
(
SNode
*
)
pOptions
;
}
SNode
*
createDropIndexStmt
(
SAstCreateContext
*
pCxt
,
bool
ignoreNotExists
,
S
Token
*
pIndexName
)
{
SNode
*
createDropIndexStmt
(
SAstCreateContext
*
pCxt
,
bool
ignoreNotExists
,
S
Node
*
pIndexName
)
{
CHECK_PARSER_STATUS
(
pCxt
);
if
(
!
checkDbName
(
pCxt
,
NULL
,
true
)
||
!
checkIndexName
(
pCxt
,
pIndexName
))
{
return
NULL
;
}
SDropIndexStmt
*
pStmt
=
(
SDropIndexStmt
*
)
nodesMakeNode
(
QUERY_NODE_DROP_INDEX_STMT
);
CHECK_OUT_OF_MEM
(
pStmt
);
pStmt
->
ignoreNotExists
=
ignoreNotExists
;
COPY_STRING_FORM_ID_TOKEN
(
pStmt
->
indexName
,
pIndexName
);
strcpy
(
pStmt
->
indexDbName
,
((
SRealTableNode
*
)
pIndexName
)
->
table
.
dbName
);
strcpy
(
pStmt
->
indexName
,
((
SRealTableNode
*
)
pIndexName
)
->
table
.
tableName
);
nodesDestroyNode
(
pIndexName
);
return
(
SNode
*
)
pStmt
;
}
...
...
source/libs/parser/src/parAstParser.c
浏览文件 @
b6d2778e
...
...
@@ -269,16 +269,15 @@ static int32_t collectMetaKeyFromUseDatabase(SCollectMetaKeyCxt* pCxt, SUseDatab
static
int32_t
collectMetaKeyFromCreateIndex
(
SCollectMetaKeyCxt
*
pCxt
,
SCreateIndexStmt
*
pStmt
)
{
int32_t
code
=
TSDB_CODE_SUCCESS
;
if
(
INDEX_TYPE_SMA
==
pStmt
->
indexType
)
{
code
=
reserveTableMetaInCache
(
pCxt
->
pParseCxt
->
acctId
,
p
Cxt
->
pParseCxt
->
db
,
pStmt
->
tableName
,
pCxt
->
pMetaCache
);
code
=
reserveTableMetaInCache
(
pCxt
->
pParseCxt
->
acctId
,
p
Stmt
->
dbName
,
pStmt
->
tableName
,
pCxt
->
pMetaCache
);
if
(
TSDB_CODE_SUCCESS
==
code
)
{
code
=
reserveTableVgroupInCache
(
pCxt
->
pParseCxt
->
acctId
,
pCxt
->
pParseCxt
->
db
,
pStmt
->
tableName
,
pCxt
->
pMetaCache
);
code
=
reserveTableVgroupInCache
(
pCxt
->
pParseCxt
->
acctId
,
pStmt
->
dbName
,
pStmt
->
tableName
,
pCxt
->
pMetaCache
);
}
if
(
TSDB_CODE_SUCCESS
==
code
)
{
code
=
reserveDbVgInfoInCache
(
pCxt
->
pParseCxt
->
acctId
,
p
Cxt
->
pParseCxt
->
db
,
pCxt
->
pMetaCache
);
code
=
reserveDbVgInfoInCache
(
pCxt
->
pParseCxt
->
acctId
,
p
Stmt
->
dbName
,
pCxt
->
pMetaCache
);
}
if
(
TSDB_CODE_SUCCESS
==
code
)
{
code
=
reserveDbCfgInCache
(
pCxt
->
pParseCxt
->
acctId
,
p
Cxt
->
pParseCxt
->
db
,
pCxt
->
pMetaCache
);
code
=
reserveDbCfgInCache
(
pCxt
->
pParseCxt
->
acctId
,
p
Stmt
->
dbName
,
pCxt
->
pMetaCache
);
}
}
return
code
;
...
...
@@ -366,8 +365,8 @@ static int32_t collectMetaKeyFromShowStreams(SCollectMetaKeyCxt* pCxt, SShowStmt
}
static
int32_t
collectMetaKeyFromShowTables
(
SCollectMetaKeyCxt
*
pCxt
,
SShowStmt
*
pStmt
)
{
int32_t
code
=
reserveTableMetaInCache
(
pCxt
->
pParseCxt
->
acctId
,
TSDB_INFORMATION_SCHEMA_DB
,
TSDB_INS_TABLE_TABLES
,
pCxt
->
pMetaCache
);
int32_t
code
=
reserveTableMetaInCache
(
pCxt
->
pParseCxt
->
acctId
,
TSDB_INFORMATION_SCHEMA_DB
,
TSDB_INS_TABLE_TABLES
,
pCxt
->
pMetaCache
);
if
(
TSDB_CODE_SUCCESS
==
code
)
{
if
(
NULL
!=
pStmt
->
pDbName
)
{
code
=
reserveDbVgInfoInCache
(
pCxt
->
pParseCxt
->
acctId
,
((
SValueNode
*
)
pStmt
->
pDbName
)
->
literal
,
pCxt
->
pMetaCache
);
...
...
@@ -457,6 +456,9 @@ static int32_t collectMetaKeyFromShowCreateTable(SCollectMetaKeyCxt* pCxt, SShow
if
(
TSDB_CODE_SUCCESS
==
code
)
{
code
=
reserveTableCfgInCache
(
pCxt
->
pParseCxt
->
acctId
,
pStmt
->
dbName
,
pStmt
->
tableName
,
pCxt
->
pMetaCache
);
}
if
(
TSDB_CODE_SUCCESS
==
code
)
{
code
=
reserveDbCfgInCache
(
pCxt
->
pParseCxt
->
acctId
,
pStmt
->
dbName
,
pCxt
->
pMetaCache
);
}
return
code
;
}
...
...
source/libs/parser/src/parTranslater.c
浏览文件 @
b6d2778e
...
...
@@ -1751,8 +1751,7 @@ static int32_t dnodeToVgroupsInfo(SArray* pDnodes, SVgroupsInfo** pVgsInfo) {
static
bool
sysTableFromVnode
(
const
char
*
pTable
)
{
return
(
0
==
strcmp
(
pTable
,
TSDB_INS_TABLE_TABLES
))
||
(
0
==
strcmp
(
pTable
,
TSDB_INS_TABLE_TABLE_DISTRIBUTED
)
||
(
0
==
strcmp
(
pTable
,
TSDB_INS_TABLE_TAGS
)));
(
0
==
strcmp
(
pTable
,
TSDB_INS_TABLE_TABLE_DISTRIBUTED
)
||
(
0
==
strcmp
(
pTable
,
TSDB_INS_TABLE_TAGS
)));
}
static
bool
sysTableFromDnode
(
const
char
*
pTable
)
{
return
0
==
strcmp
(
pTable
,
TSDB_INS_TABLE_DNODE_VARIABLES
);
}
...
...
@@ -3705,6 +3704,11 @@ static int32_t checkTableWatermarkOption(STranslateContext* pCxt, STableOptions*
}
static
int32_t
checkCreateTable
(
STranslateContext
*
pCxt
,
SCreateTableStmt
*
pStmt
,
bool
createStable
)
{
if
(
NULL
!=
strchr
(
pStmt
->
tableName
,
'.'
))
{
return
generateSyntaxErrMsgExt
(
&
pCxt
->
msgBuf
,
TSDB_CODE_PAR_INVALID_IDENTIFIER_NAME
,
"The table name cannot contain '.'"
);
}
SDbCfgInfo
dbCfg
=
{
0
};
int32_t
code
=
getDBCfg
(
pCxt
,
pStmt
->
dbName
,
&
dbCfg
);
if
(
TSDB_CODE_SUCCESS
==
code
&&
!
createStable
&&
NULL
!=
dbCfg
.
pRetensions
)
{
...
...
@@ -4282,9 +4286,10 @@ static int32_t translateAlterDnode(STranslateContext* pCxt, SAlterDnodeStmt* pSt
return
buildCmdMsg
(
pCxt
,
TDMT_MND_CONFIG_DNODE
,
(
FSerializeFunc
)
tSerializeSMCfgDnodeReq
,
&
cfgReq
);
}
static
int32_t
getSmaIndexDstVgId
(
STranslateContext
*
pCxt
,
char
*
pTableName
,
int32_t
*
pVgId
)
{
static
int32_t
getSmaIndexDstVgId
(
STranslateContext
*
pCxt
,
const
char
*
pDbName
,
const
char
*
pTableName
,
int32_t
*
pVgId
)
{
SVgroupInfo
vg
=
{
0
};
int32_t
code
=
getTableHashVgroup
(
pCxt
,
p
Cxt
->
pParseCxt
->
db
,
pTableName
,
&
vg
);
int32_t
code
=
getTableHashVgroup
(
pCxt
,
p
DbName
,
pTableName
,
&
vg
);
if
(
TSDB_CODE_SUCCESS
==
code
)
{
*
pVgId
=
vg
.
vgId
;
}
...
...
@@ -4301,7 +4306,7 @@ static int32_t getSmaIndexSql(STranslateContext* pCxt, char** pSql, int32_t* pLe
}
static
int32_t
buildSampleAstInfoByIndex
(
STranslateContext
*
pCxt
,
SCreateIndexStmt
*
pStmt
,
SSampleAstInfo
*
pInfo
)
{
pInfo
->
pDbName
=
p
Cxt
->
pParseCxt
->
db
;
pInfo
->
pDbName
=
p
Stmt
->
dbName
;
pInfo
->
pTableName
=
pStmt
->
tableName
;
pInfo
->
pFuncs
=
nodesCloneList
(
pStmt
->
pOptions
->
pFuncs
);
pInfo
->
pInterval
=
nodesCloneNode
(
pStmt
->
pOptions
->
pInterval
);
...
...
@@ -4328,7 +4333,7 @@ static int32_t getSmaIndexAst(STranslateContext* pCxt, SCreateIndexStmt* pStmt,
static
int32_t
buildCreateSmaReq
(
STranslateContext
*
pCxt
,
SCreateIndexStmt
*
pStmt
,
SMCreateSmaReq
*
pReq
)
{
SName
name
;
tNameExtractFullName
(
toName
(
pCxt
->
pParseCxt
->
acctId
,
p
Cxt
->
pParseCxt
->
db
,
pStmt
->
indexName
,
&
name
),
pReq
->
name
);
tNameExtractFullName
(
toName
(
pCxt
->
pParseCxt
->
acctId
,
p
Stmt
->
indexDbName
,
pStmt
->
indexName
,
&
name
),
pReq
->
name
);
memset
(
&
name
,
0
,
sizeof
(
SName
));
tNameExtractFullName
(
toName
(
pCxt
->
pParseCxt
->
acctId
,
pStmt
->
dbName
,
pStmt
->
tableName
,
&
name
),
pReq
->
stb
);
pReq
->
igExists
=
pStmt
->
ignoreExists
;
...
...
@@ -4352,7 +4357,7 @@ static int32_t buildCreateSmaReq(STranslateContext* pCxt, SCreateIndexStmt* pStm
}
}
int32_t
code
=
getSmaIndexDstVgId
(
pCxt
,
pStmt
->
tableName
,
&
pReq
->
dstVgId
);
int32_t
code
=
getSmaIndexDstVgId
(
pCxt
,
pStmt
->
dbName
,
pStmt
->
tableName
,
&
pReq
->
dstVgId
);
if
(
TSDB_CODE_SUCCESS
==
code
)
{
code
=
getSmaIndexSql
(
pCxt
,
&
pReq
->
sql
,
&
pReq
->
sqlLen
);
}
...
...
@@ -4365,7 +4370,7 @@ static int32_t buildCreateSmaReq(STranslateContext* pCxt, SCreateIndexStmt* pStm
static
int32_t
checkCreateSmaIndex
(
STranslateContext
*
pCxt
,
SCreateIndexStmt
*
pStmt
)
{
SDbCfgInfo
dbCfg
=
{
0
};
int32_t
code
=
getDBCfg
(
pCxt
,
p
Cxt
->
pParseCxt
->
db
,
&
dbCfg
);
int32_t
code
=
getDBCfg
(
pCxt
,
p
Stmt
->
dbName
,
&
dbCfg
);
if
(
TSDB_CODE_SUCCESS
==
code
&&
NULL
!=
dbCfg
.
pRetensions
)
{
code
=
generateSyntaxErrMsgExt
(
&
pCxt
->
msgBuf
,
TSDB_CODE_PAR_INVALID_SMA_INDEX
,
"Tables configured with the 'ROLLUP' option do not support creating sma index"
);
...
...
@@ -4883,10 +4888,17 @@ static int32_t translateShowCreateDatabase(STranslateContext* pCxt, SShowCreateD
}
static
int32_t
translateShowCreateTable
(
STranslateContext
*
pCxt
,
SShowCreateTableStmt
*
pStmt
)
{
SName
name
;
toName
(
pCxt
->
pParseCxt
->
acctId
,
pStmt
->
dbName
,
pStmt
->
tableName
,
&
name
);
return
getTableCfg
(
pCxt
,
&
name
,
(
STableCfg
**
)
&
pStmt
->
pCfg
);
pStmt
->
pDbCfg
=
taosMemoryCalloc
(
1
,
sizeof
(
SDbCfgInfo
));
if
(
NULL
==
pStmt
->
pDbCfg
)
{
return
TSDB_CODE_OUT_OF_MEMORY
;
}
int32_t
code
=
getDBCfg
(
pCxt
,
pStmt
->
dbName
,
(
SDbCfgInfo
*
)
pStmt
->
pDbCfg
);
if
(
TSDB_CODE_SUCCESS
==
code
)
{
SName
name
;
toName
(
pCxt
->
pParseCxt
->
acctId
,
pStmt
->
dbName
,
pStmt
->
tableName
,
&
name
);
code
=
getTableCfg
(
pCxt
,
&
name
,
(
STableCfg
**
)
&
pStmt
->
pTableCfg
);
}
return
code
;
}
static
int32_t
translateQuery
(
STranslateContext
*
pCxt
,
SNode
*
pNode
)
{
...
...
@@ -5917,6 +5929,10 @@ static int32_t checkCreateSubTable(STranslateContext* pCxt, SCreateSubTableClaus
if
(
0
!=
strcmp
(
pStmt
->
dbName
,
pStmt
->
useDbName
))
{
return
generateSyntaxErrMsg
(
&
pCxt
->
msgBuf
,
TSDB_CODE_PAR_CORRESPONDING_STABLE_ERR
);
}
if
(
NULL
!=
strchr
(
pStmt
->
tableName
,
'.'
))
{
return
generateSyntaxErrMsgExt
(
&
pCxt
->
msgBuf
,
TSDB_CODE_PAR_INVALID_IDENTIFIER_NAME
,
"The table name cannot contain '.'"
);
}
return
TSDB_CODE_SUCCESS
;
}
static
int32_t
rewriteCreateSubTable
(
STranslateContext
*
pCxt
,
SCreateSubTableClause
*
pStmt
,
SHashObj
*
pVgroupHashmap
)
{
...
...
source/libs/parser/src/sql.c
浏览文件 @
b6d2778e
因为 它太大了无法显示 source diff 。你可以改为
查看blob
。
source/libs/parser/test/parShowToUse.cpp
浏览文件 @
b6d2778e
...
...
@@ -54,7 +54,8 @@ TEST_F(ParserShowToUseTest, showCreateSTable) {
ASSERT_EQ
(
nodeType
(
pQuery
->
pRoot
),
QUERY_NODE_SHOW_CREATE_STABLE_STMT
);
ASSERT_EQ
(
pQuery
->
execMode
,
QUERY_EXEC_MODE_LOCAL
);
ASSERT_TRUE
(
pQuery
->
haveResultSet
);
ASSERT_NE
(((
SShowCreateTableStmt
*
)
pQuery
->
pRoot
)
->
pCfg
,
nullptr
);
ASSERT_NE
(((
SShowCreateTableStmt
*
)
pQuery
->
pRoot
)
->
pDbCfg
,
nullptr
);
ASSERT_NE
(((
SShowCreateTableStmt
*
)
pQuery
->
pRoot
)
->
pTableCfg
,
nullptr
);
});
run
(
"SHOW CREATE STABLE st1"
);
...
...
@@ -67,7 +68,8 @@ TEST_F(ParserShowToUseTest, showCreateTable) {
ASSERT_EQ
(
nodeType
(
pQuery
->
pRoot
),
QUERY_NODE_SHOW_CREATE_TABLE_STMT
);
ASSERT_EQ
(
pQuery
->
execMode
,
QUERY_EXEC_MODE_LOCAL
);
ASSERT_TRUE
(
pQuery
->
haveResultSet
);
ASSERT_NE
(((
SShowCreateTableStmt
*
)
pQuery
->
pRoot
)
->
pCfg
,
nullptr
);
ASSERT_NE
(((
SShowCreateTableStmt
*
)
pQuery
->
pRoot
)
->
pDbCfg
,
nullptr
);
ASSERT_NE
(((
SShowCreateTableStmt
*
)
pQuery
->
pRoot
)
->
pTableCfg
,
nullptr
);
});
run
(
"SHOW CREATE TABLE t1"
);
...
...
source/libs/planner/inc/planInt.h
浏览文件 @
b6d2778e
...
...
@@ -23,13 +23,13 @@ extern "C" {
#include "planner.h"
#include "taoserror.h"
#define planFatal(param, ...) qFatal("PLAN: " param, __VA_ARGS__)
#define planError(param, ...) qError("PLAN: " param, __VA_ARGS__)
#define planWarn(param, ...) qWarn("PLAN: " param, __VA_ARGS__)
#define planInfo(param, ...) qInfo("PLAN: " param, __VA_ARGS__)
#define planDebug(param, ...) qDebug("PLAN: " param, __VA_ARGS__)
#define planDebugL(param, ...) qDebugL("PLAN: " param, __VA_ARGS__)
#define planTrace(param, ...) qTrace("PLAN: " param, __VA_ARGS__)
#define planFatal(param, ...) qFatal("PLAN: " param,
##
__VA_ARGS__)
#define planError(param, ...) qError("PLAN: " param,
##
__VA_ARGS__)
#define planWarn(param, ...) qWarn("PLAN: " param,
##
__VA_ARGS__)
#define planInfo(param, ...) qInfo("PLAN: " param,
##
__VA_ARGS__)
#define planDebug(param, ...) qDebug("PLAN: " param,
##
__VA_ARGS__)
#define planDebugL(param, ...) qDebugL("PLAN: " param,
##
__VA_ARGS__)
#define planTrace(param, ...) qTrace("PLAN: " param,
##
__VA_ARGS__)
int32_t
generateUsageErrMsg
(
char
*
pBuf
,
int32_t
len
,
int32_t
errCode
,
...);
int32_t
createColumnByRewriteExprs
(
SNodeList
*
pExprs
,
SNodeList
**
pList
);
...
...
source/libs/planner/src/planUtil.c
浏览文件 @
b6d2778e
...
...
@@ -159,6 +159,10 @@ static bool isKeepOrderAggFunc(SNodeList* pFuncs) {
static
int32_t
adjustAggDataRequirement
(
SAggLogicNode
*
pAgg
,
EDataOrderLevel
requirement
)
{
// The sort level of agg with group by output data can only be DATA_ORDER_LEVEL_NONE
if
(
requirement
>
DATA_ORDER_LEVEL_NONE
&&
(
NULL
!=
pAgg
->
pGroupKeys
||
!
isKeepOrderAggFunc
(
pAgg
->
pAggFuncs
)))
{
planError
(
"The output of aggregate cannot meet the requirements(%s) of the upper operator. "
"Illegal statement, should be intercepted in parser"
,
dataOrderStr
(
requirement
));
return
TSDB_CODE_PLAN_INTERNAL_ERROR
;
}
pAgg
->
node
.
resultDataOrder
=
requirement
;
...
...
@@ -231,6 +235,10 @@ static int32_t adjustSortDataRequirement(SSortLogicNode* pSort, EDataOrderLevel
static
int32_t
adjustPartitionDataRequirement
(
SPartitionLogicNode
*
pPart
,
EDataOrderLevel
requirement
)
{
if
(
DATA_ORDER_LEVEL_GLOBAL
==
requirement
)
{
planError
(
"The output of partition cannot meet the requirements(%s) of the upper operator. "
"Illegal statement, should be intercepted in parser"
,
dataOrderStr
(
requirement
));
return
TSDB_CODE_PLAN_INTERNAL_ERROR
;
}
pPart
->
node
.
resultDataOrder
=
requirement
;
...
...
source/libs/sync/src/syncMain.c
浏览文件 @
b6d2778e
...
...
@@ -484,7 +484,7 @@ SyncIndex syncNodeGetSnapshotConfigIndex(SSyncNode* pSyncNode, SyncIndex snapsho
lastIndex
=
(
pSyncNode
->
pRaftCfg
->
configIndexArr
)[
i
];
}
}
sTrace
(
"vgId:%d, sync get
snapshot
last config index, index:%"
PRId64
" lcindex:%"
PRId64
,
pSyncNode
->
vgId
,
sTrace
(
"vgId:%d, sync get last config index, index:%"
PRId64
" lcindex:%"
PRId64
,
pSyncNode
->
vgId
,
snapshotLastApplyIndex
,
lastIndex
);
return
lastIndex
;
...
...
source/libs/sync/src/syncTimeout.c
浏览文件 @
b6d2778e
...
...
@@ -41,18 +41,21 @@ int32_t syncNodeOnTimeoutCb(SSyncNode* ths, SyncTimeout* pMsg) {
// syncNodePingAll(ths);
// syncNodePingPeers(ths);
sTrace
(
"vgId:%d, sync timeout, type:ping count:%d"
,
ths
->
vgId
,
ths
->
pingTimerCounter
);
syncNodeTimerRoutine
(
ths
);
}
}
else
if
(
pMsg
->
timeoutType
==
SYNC_TIMEOUT_ELECTION
)
{
if
(
atomic_load_64
(
&
ths
->
electTimerLogicClockUser
)
<=
pMsg
->
logicClock
)
{
++
(
ths
->
electTimerCounter
);
sInfo
(
"vgId:%d, sync timeout, type:election count:%d"
,
ths
->
vgId
,
ths
->
electTimerCounter
);
syncNodeElect
(
ths
);
}
}
else
if
(
pMsg
->
timeoutType
==
SYNC_TIMEOUT_HEARTBEAT
)
{
if
(
atomic_load_64
(
&
ths
->
heartbeatTimerLogicClockUser
)
<=
pMsg
->
logicClock
)
{
++
(
ths
->
heartbeatTimerCounter
);
sInfo
(
"vgId:%d, sync timeout, type:replicate count:%d"
,
ths
->
vgId
,
ths
->
heartbeatTimerCounter
);
syncNodeReplicate
(
ths
);
}
}
else
{
...
...
tests/system-test/2-query/json_tag.py
浏览文件 @
b6d2778e
...
...
@@ -506,7 +506,7 @@ class TDTestCase:
#show create table
tdSql
.
query
(
"show create table jsons1"
)
tdSql
.
checkData
(
0
,
1
,
'CREATE STABLE `jsons1` (`ts` TIMESTAMP, `dataint` INT, `databool` BOOL, `datastr` NCHAR(50), `datastrbin` VARCHAR(150)) TAGS (`jtag` JSON)
WATERMARK 5000a, 5000a
'
)
tdSql
.
checkData
(
0
,
1
,
'CREATE STABLE `jsons1` (`ts` TIMESTAMP, `dataint` INT, `databool` BOOL, `datastr` NCHAR(50), `datastrbin` VARCHAR(150)) TAGS (`jtag` JSON)'
)
#test aggregate function:count/avg/twa/irate/sum/stddev/leastsquares
tdSql
.
query
(
"select count(*) from jsons1 where jtag is not null"
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录