Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
哥们要飞
TDengine
提交
62304aa6
T
TDengine
项目概览
哥们要飞
/
TDengine
与 Fork 源项目一致
Fork自
taosdata / TDengine
通知
1
Star
1
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看板
体验新版 GitCode,发现更多精彩内容 >>
提交
62304aa6
编写于
12月 23, 2020
作者:
S
Shengliang Guan
浏览文件
操作
浏览文件
下载
差异文件
Merge remote-tracking branch 'origin/develop' into feature/sim
上级
5b7a804c
39acac5c
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
48 addition
and
74 deletion
+48
-74
alert/go.mod
alert/go.mod
+1
-1
src/client/inc/tsclient.h
src/client/inc/tsclient.h
+0
-2
src/client/src/tscSQLParser.c
src/client/src/tscSQLParser.c
+27
-27
src/client/src/tscSql.c
src/client/src/tscSql.c
+9
-28
src/client/src/tscSystem.c
src/client/src/tscSystem.c
+0
-1
src/client/src/tscUtil.c
src/client/src/tscUtil.c
+5
-14
src/query/src/qParserImpl.c
src/query/src/qParserImpl.c
+6
-1
未找到文件。
alert/go.mod
浏览文件 @
62304aa6
...
@@ -5,7 +5,7 @@ go 1.14
...
@@ -5,7 +5,7 @@ go 1.14
require (
require (
github.com/jmoiron/sqlx v1.2.0
github.com/jmoiron/sqlx v1.2.0
github.com/mattn/go-sqlite3 v2.0.3+incompatible
github.com/mattn/go-sqlite3 v2.0.3+incompatible
github.com/taosdata/driver-go v0.0.0-2020
0727182616-1a3b1941c206
github.com/taosdata/driver-go v0.0.0-2020
1113094317-050667e5b4d0
go.uber.org/zap v1.14.1
go.uber.org/zap v1.14.1
google.golang.org/appengine v1.6.5 // indirect
google.golang.org/appengine v1.6.5 // indirect
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c
...
...
src/client/inc/tsclient.h
浏览文件 @
62304aa6
...
@@ -307,7 +307,6 @@ typedef struct STscObj {
...
@@ -307,7 +307,6 @@ typedef struct STscObj {
SRpcCorEpSet
*
tscCorMgmtEpSet
;
SRpcCorEpSet
*
tscCorMgmtEpSet
;
void
*
pDnodeConn
;
void
*
pDnodeConn
;
pthread_mutex_t
mutex
;
pthread_mutex_t
mutex
;
T_REF_DECLARE
()
}
STscObj
;
}
STscObj
;
typedef
struct
SSubqueryState
{
typedef
struct
SSubqueryState
{
...
@@ -483,7 +482,6 @@ extern int tscObjRef;
...
@@ -483,7 +482,6 @@ extern int tscObjRef;
extern
void
*
tscTmr
;
extern
void
*
tscTmr
;
extern
void
*
tscQhandle
;
extern
void
*
tscQhandle
;
extern
int
tscKeepConn
[];
extern
int
tscKeepConn
[];
extern
int
tsInsertHeadSize
;
extern
int
tscNumOfThreads
;
extern
int
tscNumOfThreads
;
extern
int
tscRefId
;
extern
int
tscRefId
;
...
...
src/client/src/tscSQLParser.c
浏览文件 @
62304aa6
...
@@ -996,33 +996,6 @@ static bool validateTagParams(SArray* pTagsList, SArray* pFieldList, SSqlCmd* pC
...
@@ -996,33 +996,6 @@ static bool validateTagParams(SArray* pTagsList, SArray* pFieldList, SSqlCmd* pC
return
false
;
return
false
;
}
}
int32_t
nLen
=
0
;
for
(
int32_t
i
=
0
;
i
<
numOfTags
;
++
i
)
{
TAOS_FIELD
*
p
=
taosArrayGet
(
pTagsList
,
i
);
if
(
p
->
bytes
==
0
)
{
invalidSqlErrMsg
(
tscGetErrorMsgPayload
(
pCmd
),
msg7
);
return
false
;
}
nLen
+=
p
->
bytes
;
}
// max tag row length must be less than TSDB_MAX_TAGS_LEN
if
(
nLen
>
TSDB_MAX_TAGS_LEN
)
{
invalidSqlErrMsg
(
tscGetErrorMsgPayload
(
pCmd
),
msg2
);
return
false
;
}
// field name must be unique
for
(
int32_t
i
=
0
;
i
<
numOfTags
;
++
i
)
{
TAOS_FIELD
*
p
=
taosArrayGet
(
pTagsList
,
i
);
if
(
has
(
pFieldList
,
0
,
p
->
name
)
==
true
)
{
invalidSqlErrMsg
(
tscGetErrorMsgPayload
(
pCmd
),
msg3
);
return
false
;
}
}
/* timestamp in tag is not allowed */
/* timestamp in tag is not allowed */
for
(
int32_t
i
=
0
;
i
<
numOfTags
;
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
numOfTags
;
++
i
)
{
TAOS_FIELD
*
p
=
taosArrayGet
(
pTagsList
,
i
);
TAOS_FIELD
*
p
=
taosArrayGet
(
pTagsList
,
i
);
...
@@ -1054,6 +1027,33 @@ static bool validateTagParams(SArray* pTagsList, SArray* pFieldList, SSqlCmd* pC
...
@@ -1054,6 +1027,33 @@ static bool validateTagParams(SArray* pTagsList, SArray* pFieldList, SSqlCmd* pC
}
}
}
}
int32_t
nLen
=
0
;
for
(
int32_t
i
=
0
;
i
<
numOfTags
;
++
i
)
{
TAOS_FIELD
*
p
=
taosArrayGet
(
pTagsList
,
i
);
if
(
p
->
bytes
==
0
)
{
invalidSqlErrMsg
(
tscGetErrorMsgPayload
(
pCmd
),
msg7
);
return
false
;
}
nLen
+=
p
->
bytes
;
}
// max tag row length must be less than TSDB_MAX_TAGS_LEN
if
(
nLen
>
TSDB_MAX_TAGS_LEN
)
{
invalidSqlErrMsg
(
tscGetErrorMsgPayload
(
pCmd
),
msg2
);
return
false
;
}
// field name must be unique
for
(
int32_t
i
=
0
;
i
<
numOfTags
;
++
i
)
{
TAOS_FIELD
*
p
=
taosArrayGet
(
pTagsList
,
i
);
if
(
has
(
pFieldList
,
0
,
p
->
name
)
==
true
)
{
invalidSqlErrMsg
(
tscGetErrorMsgPayload
(
pCmd
),
msg3
);
return
false
;
}
}
return
true
;
return
true
;
}
}
...
...
src/client/src/tscSql.c
浏览文件 @
62304aa6
...
@@ -115,9 +115,7 @@ static SSqlObj *taosConnectImpl(const char *ip, const char *user, const char *pa
...
@@ -115,9 +115,7 @@ static SSqlObj *taosConnectImpl(const char *ip, const char *user, const char *pa
pObj
->
signature
=
pObj
;
pObj
->
signature
=
pObj
;
pObj
->
pDnodeConn
=
pDnodeConn
;
pObj
->
pDnodeConn
=
pDnodeConn
;
T_REF_INIT_VAL
(
pObj
,
1
);
tstrncpy
(
pObj
->
user
,
user
,
sizeof
(
pObj
->
user
));
tstrncpy
(
pObj
->
user
,
user
,
sizeof
(
pObj
->
user
));
secretEncryptLen
=
MIN
(
secretEncryptLen
,
sizeof
(
pObj
->
pass
));
secretEncryptLen
=
MIN
(
secretEncryptLen
,
sizeof
(
pObj
->
pass
));
memcpy
(
pObj
->
pass
,
secretEncrypt
,
secretEncryptLen
);
memcpy
(
pObj
->
pass
,
secretEncrypt
,
secretEncryptLen
);
...
@@ -172,11 +170,9 @@ static SSqlObj *taosConnectImpl(const char *ip, const char *user, const char *pa
...
@@ -172,11 +170,9 @@ static SSqlObj *taosConnectImpl(const char *ip, const char *user, const char *pa
if
(
taos
!=
NULL
)
{
if
(
taos
!=
NULL
)
{
*
taos
=
pObj
;
*
taos
=
pObj
;
}
}
pObj
->
rid
=
taosAddRef
(
tscRefId
,
pObj
);
registerSqlObj
(
pSql
);
registerSqlObj
(
pSql
);
tsInsertHeadSize
=
sizeof
(
SMsgDesc
)
+
sizeof
(
SSubmitMsg
);
pObj
->
rid
=
taosAddRef
(
tscRefId
,
pObj
);
return
pSql
;
return
pSql
;
}
}
...
@@ -288,34 +284,19 @@ void taos_close(TAOS *taos) {
...
@@ -288,34 +284,19 @@ void taos_close(TAOS *taos) {
return
;
return
;
}
}
// make sure that the close connection can only be executed once.
SSqlObj
*
pHb
=
(
SSqlObj
*
)
taosAcquireRef
(
tscObjRef
,
pObj
->
hbrid
);
pObj
->
signature
=
NULL
;
if
(
pHb
!=
NULL
)
{
taosTmrStopA
(
&
(
pObj
->
pTimer
));
if
(
pHb
->
rpcRid
>
0
)
{
// wait for rsp from dnode
rpcCancelRequest
(
pHb
->
rpcRid
);
if
(
pObj
->
hbrid
>
0
)
{
pHb
->
rpcRid
=
-
1
;
SSqlObj
*
pHb
=
(
SSqlObj
*
)
taosAcquireRef
(
tscObjRef
,
pObj
->
hbrid
);
if
(
pHb
!=
NULL
)
{
if
(
pHb
->
rpcRid
>
0
)
{
// wait for rsp from dnode
rpcCancelRequest
(
pHb
->
rpcRid
);
pHb
->
rpcRid
=
-
1
;
}
tscDebug
(
"%p HB is freed"
,
pHb
);
taos_free_result
(
pHb
);
taosReleaseRef
(
tscObjRef
,
pHb
->
self
);
}
}
}
int32_t
ref
=
T_REF_DEC
(
pObj
);
assert
(
ref
>=
0
);
if
(
ref
>
0
)
{
tscDebug
(
"%p HB is freed"
,
pHb
);
t
scDebug
(
"%p %d remain sqlObjs, not free tscObj and dnodeConn:%p"
,
pObj
,
ref
,
pObj
->
pDnodeConn
);
t
aosReleaseRef
(
tscObjRef
,
pHb
->
self
);
return
;
taos_free_result
(
pHb
)
;
}
}
tscDebug
(
"%p all sqlObj are freed, free tscObj and close dnodeConn:%p"
,
pObj
,
pObj
->
pDnodeConn
);
tscDebug
(
"%p all sqlObj are freed, free tscObj and close dnodeConn:%p"
,
pObj
,
pObj
->
pDnodeConn
);
taosRemoveRef
(
tscRefId
,
pObj
->
rid
);
taosRemoveRef
(
tscRefId
,
pObj
->
rid
);
}
}
...
...
src/client/src/tscSystem.c
浏览文件 @
62304aa6
...
@@ -36,7 +36,6 @@ int tscObjRef = -1;
...
@@ -36,7 +36,6 @@ int tscObjRef = -1;
void
*
tscTmr
;
void
*
tscTmr
;
void
*
tscQhandle
;
void
*
tscQhandle
;
void
*
tscCheckDiskUsageTmr
;
void
*
tscCheckDiskUsageTmr
;
int
tsInsertHeadSize
;
int
tscRefId
=
-
1
;
int
tscRefId
=
-
1
;
int
tscNumOfThreads
;
int
tscNumOfThreads
;
...
...
src/client/src/tscUtil.c
浏览文件 @
62304aa6
...
@@ -460,15 +460,7 @@ void tscFreeRegisteredSqlObj(void *pSql) {
...
@@ -460,15 +460,7 @@ void tscFreeRegisteredSqlObj(void *pSql) {
assert
(
p
->
self
!=
0
);
assert
(
p
->
self
!=
0
);
tscFreeSqlObj
(
p
);
tscFreeSqlObj
(
p
);
taosReleaseRef
(
tscRefId
,
pTscObj
->
rid
);
int32_t
ref
=
T_REF_DEC
(
pTscObj
);
assert
(
ref
>=
0
);
tscDebug
(
"%p free sqlObj completed, tscObj:%p ref:%d"
,
p
,
pTscObj
,
ref
);
if
(
ref
==
0
)
{
tscDebug
(
"%p all sqlObj freed, free tscObj:%p"
,
p
,
pTscObj
);
taosRemoveRef
(
tscRefId
,
pTscObj
->
rid
);
}
}
}
void
tscFreeTableMetaHelper
(
void
*
pTableMeta
)
{
void
tscFreeTableMetaHelper
(
void
*
pTableMeta
)
{
...
@@ -810,6 +802,7 @@ static void extractTableMeta(SSqlCmd* pCmd) {
...
@@ -810,6 +802,7 @@ static void extractTableMeta(SSqlCmd* pCmd) {
}
}
int32_t
tscMergeTableDataBlocks
(
SSqlObj
*
pSql
)
{
int32_t
tscMergeTableDataBlocks
(
SSqlObj
*
pSql
)
{
const
int
INSERT_HEAD_SIZE
=
sizeof
(
SMsgDesc
)
+
sizeof
(
SSubmitMsg
);
SSqlCmd
*
pCmd
=
&
pSql
->
cmd
;
SSqlCmd
*
pCmd
=
&
pSql
->
cmd
;
void
*
pVnodeDataBlockHashList
=
taosHashInit
(
128
,
taosGetDefaultHashFunction
(
TSDB_DATA_TYPE_BIGINT
),
true
,
false
);
void
*
pVnodeDataBlockHashList
=
taosHashInit
(
128
,
taosGetDefaultHashFunction
(
TSDB_DATA_TYPE_BIGINT
),
true
,
false
);
...
@@ -824,7 +817,7 @@ int32_t tscMergeTableDataBlocks(SSqlObj* pSql) {
...
@@ -824,7 +817,7 @@ int32_t tscMergeTableDataBlocks(SSqlObj* pSql) {
STableDataBlocks
*
dataBuf
=
NULL
;
STableDataBlocks
*
dataBuf
=
NULL
;
int32_t
ret
=
tscGetDataBlockFromList
(
pVnodeDataBlockHashList
,
pOneTableBlock
->
vgId
,
TSDB_PAYLOAD_SIZE
,
int32_t
ret
=
tscGetDataBlockFromList
(
pVnodeDataBlockHashList
,
pOneTableBlock
->
vgId
,
TSDB_PAYLOAD_SIZE
,
tsInsertHeadSize
,
0
,
pOneTableBlock
->
tableId
,
pOneTableBlock
->
pTableMeta
,
&
dataBuf
,
pVnodeDataBlockList
);
INSERT_HEAD_SIZE
,
0
,
pOneTableBlock
->
tableId
,
pOneTableBlock
->
pTableMeta
,
&
dataBuf
,
pVnodeDataBlockList
);
if
(
ret
!=
TSDB_CODE_SUCCESS
)
{
if
(
ret
!=
TSDB_CODE_SUCCESS
)
{
tscError
(
"%p failed to prepare the data block buffer for merging table data, code:%d"
,
pSql
,
ret
);
tscError
(
"%p failed to prepare the data block buffer for merging table data, code:%d"
,
pSql
,
ret
);
taosHashCleanup
(
pVnodeDataBlockHashList
);
taosHashCleanup
(
pVnodeDataBlockHashList
);
...
@@ -1917,9 +1910,7 @@ void tscResetForNextRetrieve(SSqlRes* pRes) {
...
@@ -1917,9 +1910,7 @@ void tscResetForNextRetrieve(SSqlRes* pRes) {
}
}
void
registerSqlObj
(
SSqlObj
*
pSql
)
{
void
registerSqlObj
(
SSqlObj
*
pSql
)
{
int32_t
ref
=
T_REF_INC
(
pSql
->
pTscObj
);
taosAcquireRef
(
tscRefId
,
pSql
->
pTscObj
->
rid
);
tscDebug
(
"%p add to tscObj:%p, ref:%d"
,
pSql
,
pSql
->
pTscObj
,
ref
);
pSql
->
self
=
taosAddRef
(
tscObjRef
,
pSql
);
pSql
->
self
=
taosAddRef
(
tscObjRef
,
pSql
);
}
}
...
@@ -2629,4 +2620,4 @@ int32_t copyTagData(STagData* dst, const STagData* src) {
...
@@ -2629,4 +2620,4 @@ int32_t copyTagData(STagData* dst, const STagData* src) {
}
}
return
0
;
return
0
;
}
}
\ No newline at end of file
src/query/src/qParserImpl.c
浏览文件 @
62304aa6
...
@@ -384,7 +384,12 @@ void tSqlSetColumnInfo(TAOS_FIELD *pField, SStrToken *pName, TAOS_FIELD *pType)
...
@@ -384,7 +384,12 @@ void tSqlSetColumnInfo(TAOS_FIELD *pField, SStrToken *pName, TAOS_FIELD *pType)
pField
->
name
[
pName
->
n
]
=
0
;
pField
->
name
[
pName
->
n
]
=
0
;
pField
->
type
=
pType
->
type
;
pField
->
type
=
pType
->
type
;
pField
->
bytes
=
pType
->
bytes
;
if
(
pField
->
type
<
TSDB_DATA_TYPE_BOOL
||
pField
->
type
>
TSDB_DATA_TYPE_NCHAR
){
pField
->
bytes
=
0
;
}
else
{
pField
->
bytes
=
pType
->
bytes
;
}
}
}
void
tSqlSetColumnType
(
TAOS_FIELD
*
pField
,
SStrToken
*
type
)
{
void
tSqlSetColumnType
(
TAOS_FIELD
*
pField
,
SStrToken
*
type
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录