Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
baa238ee
T
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22017
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看板
提交
baa238ee
编写于
3月 31, 2022
作者:
X
Xiaoyu Wang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
TD-14409 TD-14436 bugfix
上级
59862e45
变更
9
展开全部
隐藏空白更改
内联
并排
Showing
9 changed file
with
1232 addition
and
1214 deletion
+1232
-1214
include/common/tmsg.h
include/common/tmsg.h
+1
-0
include/util/taoserror.h
include/util/taoserror.h
+2
-0
include/util/tdef.h
include/util/tdef.h
+1
-1
source/common/src/tmsg.c
source/common/src/tmsg.c
+2
-0
source/libs/parser/inc/sql.y
source/libs/parser/inc/sql.y
+1
-0
source/libs/parser/src/parAstCreater.c
source/libs/parser/src/parAstCreater.c
+29
-22
source/libs/parser/src/parTranslater.c
source/libs/parser/src/parTranslater.c
+1
-0
source/libs/parser/src/parUtil.c
source/libs/parser/src/parUtil.c
+4
-0
source/libs/parser/src/sql.c
source/libs/parser/src/sql.c
+1191
-1191
未找到文件。
include/common/tmsg.h
浏览文件 @
baa238ee
...
...
@@ -524,6 +524,7 @@ typedef struct {
int8_t
walLevel
;
int8_t
quorum
;
int8_t
cacheLastRow
;
int8_t
replications
;
}
SAlterDbReq
;
int32_t
tSerializeSAlterDbReq
(
void
*
buf
,
int32_t
bufLen
,
SAlterDbReq
*
pReq
);
...
...
include/util/taoserror.h
浏览文件 @
baa238ee
...
...
@@ -478,6 +478,8 @@ int32_t* taosGetErrno();
#define TSDB_CODE_PAR_INVALID_ENDPOINT TAOS_DEF_ERROR_CODE(0, 0x2613)
#define TSDB_CODE_PAR_EXPRIE_STATEMENT TAOS_DEF_ERROR_CODE(0, 0x2614)
#define TSDB_CODE_PAR_INTERVAL_VALUE_TOO_SMALL TAOS_DEF_ERROR_CODE(0, 0x2615)
#define TSDB_CODE_PAR_DB_NOT_SPECIFIED TAOS_DEF_ERROR_CODE(0, 0x2616)
#define TSDB_CODE_PAR_INVALID_IDENTIFIER_NAME TAOS_DEF_ERROR_CODE(0, 0x2617)
#ifdef __cplusplus
}
...
...
include/util/tdef.h
浏览文件 @
baa238ee
...
...
@@ -327,7 +327,7 @@ typedef enum ELogicConditionType {
#define TSDB_MAX_FSYNC_PERIOD 180000 // millisecond
#define TSDB_DEFAULT_FSYNC_PERIOD 3000 // three second
#define TSDB_MIN_WAL_LEVEL
0
#define TSDB_MIN_WAL_LEVEL
1
#define TSDB_MAX_WAL_LEVEL 2
#define TSDB_DEFAULT_WAL_LEVEL 1
...
...
source/common/src/tmsg.c
浏览文件 @
baa238ee
...
...
@@ -1629,6 +1629,7 @@ int32_t tSerializeSAlterDbReq(void *buf, int32_t bufLen, SAlterDbReq *pReq) {
if
(
tEncodeI8
(
&
encoder
,
pReq
->
walLevel
)
<
0
)
return
-
1
;
if
(
tEncodeI8
(
&
encoder
,
pReq
->
quorum
)
<
0
)
return
-
1
;
if
(
tEncodeI8
(
&
encoder
,
pReq
->
cacheLastRow
)
<
0
)
return
-
1
;
if
(
tEncodeI8
(
&
encoder
,
pReq
->
replications
)
<
0
)
return
-
1
;
tEndEncode
(
&
encoder
);
int32_t
tlen
=
encoder
.
pos
;
...
...
@@ -1650,6 +1651,7 @@ int32_t tDeserializeSAlterDbReq(void *buf, int32_t bufLen, SAlterDbReq *pReq) {
if
(
tDecodeI8
(
&
decoder
,
&
pReq
->
walLevel
)
<
0
)
return
-
1
;
if
(
tDecodeI8
(
&
decoder
,
&
pReq
->
quorum
)
<
0
)
return
-
1
;
if
(
tDecodeI8
(
&
decoder
,
&
pReq
->
cacheLastRow
)
<
0
)
return
-
1
;
if
(
tDecodeI8
(
&
decoder
,
&
pReq
->
replications
)
<
0
)
return
-
1
;
tEndDecode
(
&
decoder
);
tCoderClear
(
&
decoder
);
...
...
source/libs/parser/inc/sql.y
浏览文件 @
baa238ee
...
...
@@ -159,6 +159,7 @@ alter_db_option(A) ::= KEEP NK_INTEGER(B).
alter_db_option(A) ::= WAL NK_INTEGER(B). { A.type = DB_OPTION_WAL; A.val = B; }
alter_db_option(A) ::= QUORUM NK_INTEGER(B). { A.type = DB_OPTION_QUORUM; A.val = B; }
alter_db_option(A) ::= CACHELAST NK_INTEGER(B). { A.type = DB_OPTION_CACHELAST; A.val = B; }
alter_db_option(A) ::= REPLICA NK_INTEGER(B). { A.type = DB_OPTION_REPLICA; A.val = B; }
/************************************************ create/drop table/stable ********************************************/
cmd ::= CREATE TABLE not_exists_opt(A) full_table_name(B)
...
...
source/libs/parser/src/parAstCreater.c
浏览文件 @
baa238ee
...
...
@@ -180,9 +180,9 @@ static SDatabaseOptions* setDbQuorum(SAstCreateContext* pCxt, SDatabaseOptions*
static
SDatabaseOptions
*
setDbReplica
(
SAstCreateContext
*
pCxt
,
SDatabaseOptions
*
pOptions
,
const
SToken
*
pVal
)
{
int64_t
val
=
strtol
(
pVal
->
z
,
NULL
,
10
);
if
(
val
<
TSDB_MIN_DB_REPLICA_OPTION
||
val
>
TSDB_MAX_DB_REPLICA_OPTION
)
{
if
(
!
(
val
==
TSDB_MIN_DB_REPLICA_OPTION
||
val
==
TSDB_MAX_DB_REPLICA_OPTION
)
)
{
snprintf
(
pCxt
->
pQueryCxt
->
pMsg
,
pCxt
->
pQueryCxt
->
msgLen
,
"invalid db option replications: %"
PRId64
"
valid range: [%d, %d]"
,
val
,
TSDB_MIN_DB_REPLICA_OPTION
,
TSDB_MAX_DB_REPLICA_OPTION
);
"invalid db option replications: %"
PRId64
"
, only 1, 3 allowed"
,
val
);
pCxt
->
valid
=
false
;
return
pOptions
;
}
...
...
@@ -397,7 +397,9 @@ static bool checkUserName(SAstCreateContext* pCxt, SToken* pUserName) {
pCxt
->
valid
=
false
;
}
}
trimEscape
(
pUserName
);
if
(
pCxt
->
valid
)
{
trimEscape
(
pUserName
);
}
return
pCxt
->
valid
;
}
...
...
@@ -472,45 +474,50 @@ static bool checkPort(SAstCreateContext* pCxt, const SToken* pPortToken, int32_t
static
bool
checkDbName
(
SAstCreateContext
*
pCxt
,
SToken
*
pDbName
,
bool
query
)
{
if
(
NULL
==
pDbName
)
{
pCxt
->
valid
=
(
query
?
NULL
!=
pCxt
->
pQueryCxt
->
db
:
true
);
if
(
!
pCxt
->
valid
)
{
snprintf
(
pCxt
->
pQueryCxt
->
pMsg
,
pCxt
->
pQueryCxt
->
msgLen
,
"db not specified"
)
;
if
(
query
&&
NULL
==
pCxt
->
pQueryCxt
->
db
)
{
generateSyntaxErrMsg
(
&
pCxt
->
msgBuf
,
TSDB_CODE_PAR_DB_NOT_SPECIFIED
);
pCxt
->
valid
=
false
;
}
}
else
{
pCxt
->
valid
=
pDbName
->
n
<
TSDB_DB_NAME_LEN
?
true
:
false
;
if
(
pDbName
->
n
>=
TSDB_DB_NAME_LEN
)
{
generateSyntaxErrMsg
(
&
pCxt
->
msgBuf
,
TSDB_CODE_PAR_INVALID_IDENTIFIER_NAME
,
pDbName
->
z
);
pCxt
->
valid
=
false
;
}
}
if
(
pCxt
->
valid
)
{
trimEscape
(
pDbName
);
}
trimEscape
(
pDbName
);
return
pCxt
->
valid
;
}
static
bool
checkTableName
(
SAstCreateContext
*
pCxt
,
SToken
*
pTableName
)
{
if
(
NULL
==
pTableName
)
{
pCxt
->
valid
=
true
;
}
else
{
pCxt
->
valid
=
pTableName
->
n
<
TSDB_TABLE_NAME_LEN
?
true
:
false
;
if
(
NULL
!=
pTableName
&&
pTableName
->
n
>=
TSDB_TABLE_NAME_LEN
)
{
generateSyntaxErrMsg
(
&
pCxt
->
msgBuf
,
TSDB_CODE_PAR_INVALID_IDENTIFIER_NAME
,
pTableName
->
z
)
;
pCxt
->
valid
=
false
;
return
false
;
}
trimEscape
(
pTableName
);
return
pCxt
->
valid
;
return
true
;
}
static
bool
checkColumnName
(
SAstCreateContext
*
pCxt
,
SToken
*
pColumnName
)
{
if
(
NULL
==
pColumnName
)
{
pCxt
->
valid
=
true
;
}
else
{
pCxt
->
valid
=
pColumnName
->
n
<
TSDB_COL_NAME_LEN
?
true
:
false
;
if
(
NULL
!=
pColumnName
&&
pColumnName
->
n
>=
TSDB_COL_NAME_LEN
)
{
generateSyntaxErrMsg
(
&
pCxt
->
msgBuf
,
TSDB_CODE_PAR_INVALID_IDENTIFIER_NAME
,
pColumnName
->
z
)
;
pCxt
->
valid
=
false
;
return
false
;
}
trimEscape
(
pColumnName
);
return
pCxt
->
valid
;
return
true
;
}
static
bool
checkIndexName
(
SAstCreateContext
*
pCxt
,
SToken
*
pIndexName
)
{
if
(
NULL
==
pIndexName
)
{
if
(
NULL
!=
pIndexName
&&
pIndexName
->
n
>=
TSDB_INDEX_NAME_LEN
)
{
generateSyntaxErrMsg
(
&
pCxt
->
msgBuf
,
TSDB_CODE_PAR_INVALID_IDENTIFIER_NAME
,
pIndexName
->
z
);
pCxt
->
valid
=
false
;
}
else
{
pCxt
->
valid
=
pIndexName
->
n
<
TSDB_INDEX_NAME_LEN
?
true
:
false
;
return
false
;
}
trimEscape
(
pIndexName
);
return
pCxt
->
valid
;
return
true
;
}
SNode
*
createRawExprNode
(
SAstCreateContext
*
pCxt
,
const
SToken
*
pToken
,
SNode
*
pNode
)
{
...
...
source/libs/parser/src/parTranslater.c
浏览文件 @
baa238ee
...
...
@@ -1048,6 +1048,7 @@ static void buildAlterDbReq(STranslateContext* pCxt, SAlterDatabaseStmt* pStmt,
pReq
->
walLevel
=
pStmt
->
pOptions
->
walLevel
;
pReq
->
quorum
=
pStmt
->
pOptions
->
quorum
;
pReq
->
cacheLastRow
=
pStmt
->
pOptions
->
cachelast
;
pReq
->
replications
=
pStmt
->
pOptions
->
replica
;
return
;
}
...
...
source/libs/parser/src/parUtil.c
浏览文件 @
baa238ee
...
...
@@ -61,6 +61,10 @@ static char* getSyntaxErrFormat(int32_t errCode) {
return
"This statement is no longer supported"
;
case
TSDB_CODE_PAR_INTERVAL_VALUE_TOO_SMALL
:
return
"This interval value is too small : %s"
;
case
TSDB_CODE_PAR_DB_NOT_SPECIFIED
:
return
"db not specified"
;
case
TSDB_CODE_PAR_INVALID_IDENTIFIER_NAME
:
return
"Invalid identifier name : %s"
;
case
TSDB_CODE_OUT_OF_MEMORY
:
return
"Out of memory"
;
default:
...
...
source/libs/parser/src/sql.c
浏览文件 @
baa238ee
此差异已折叠。
点击以展开。
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录