Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
小楼昨夜-听风雨
TDengine
提交
96b24d70
T
TDengine
项目概览
小楼昨夜-听风雨
/
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看板
体验新版 GitCode,发现更多精彩内容 >>
提交
96b24d70
编写于
5月 01, 2020
作者:
H
hjxilinx
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[td-186] merge develop branch
上级
077825ed
变更
11
隐藏空白更改
内联
并排
Showing
11 changed file
with
42 addition
and
28 deletion
+42
-28
src/client/src/tscUtil.c
src/client/src/tscUtil.c
+4
-2
src/common/inc/tdataformat.h
src/common/inc/tdataformat.h
+1
-1
src/query/inc/qsqlparser.h
src/query/inc/qsqlparser.h
+1
-1
src/query/inc/sql.y
src/query/inc/sql.y
+1
-1
src/query/src/qparserImpl.c
src/query/src/qparserImpl.c
+8
-5
src/query/src/sql.c
src/query/src/sql.c
+1
-1
src/rpc/src/rpcMain.c
src/rpc/src/rpcMain.c
+17
-8
src/tsdb/src/tsdbRead.c
src/tsdb/src/tsdbRead.c
+4
-3
src/util/src/tcache.c
src/util/src/tcache.c
+1
-1
src/util/tests/CMakeLists.txt
src/util/tests/CMakeLists.txt
+1
-2
tests/examples/c/demo.c
tests/examples/c/demo.c
+3
-3
未找到文件。
src/client/src/tscUtil.c
浏览文件 @
96b24d70
...
...
@@ -603,14 +603,16 @@ static int trimDataBlock(void* pDataBlock, STableDataBlocks* pTableDataBlock) {
memcpy
(
pDataBlock
,
pTableDataBlock
->
pData
,
sizeof
(
SSubmitBlk
));
pDataBlock
+=
sizeof
(
SSubmitBlk
);
int32_t
flen
=
0
;
int32_t
flen
=
0
;
// original total length of row
for
(
int32_t
i
=
0
;
i
<
tinfo
.
numOfColumns
;
++
i
)
{
flen
+=
TYPE_BYTES
[
pSchema
[
i
].
type
];
}
char
*
p
=
pTableDataBlock
->
pData
+
sizeof
(
SSubmitBlk
);
pBlock
->
len
=
0
;
for
(
int32_t
i
=
0
;
i
<
htons
(
pBlock
->
numOfRows
);
++
i
)
{
int32_t
numOfRows
=
htons
(
pBlock
->
numOfRows
);
for
(
int32_t
i
=
0
;
i
<
numOfRows
;
++
i
)
{
SDataRow
trow
=
(
SDataRow
)
pDataBlock
;
dataRowSetLen
(
trow
,
TD_DATA_ROW_HEAD_SIZE
+
flen
);
...
...
src/common/inc/tdataformat.h
浏览文件 @
96b24d70
...
...
@@ -182,7 +182,7 @@ void tdInitDataCols(SDataCols *pCols, STSchema *pSchema);
SDataCols
*
tdDupDataCols
(
SDataCols
*
pCols
,
bool
keepData
);
void
tdFreeDataCols
(
SDataCols
*
pCols
);
void
tdAppendDataRowToDataCol
(
SDataRow
row
,
SDataCols
*
pCols
);
void
tdPopDataColsPoints
(
SDataCols
*
pCols
,
int
pointsToPop
);
void
tdPopDataColsPoints
(
SDataCols
*
pCols
,
int
pointsToPop
);
//!!!!
int
tdMergeDataCols
(
SDataCols
*
target
,
SDataCols
*
src
,
int
rowsToMerge
);
void
tdMergeTwoDataCols
(
SDataCols
*
target
,
SDataCols
*
src1
,
int
*
iter1
,
SDataCols
*
src2
,
int
*
iter2
,
int
tRows
);
...
...
src/query/inc/qsqlparser.h
浏览文件 @
96b24d70
...
...
@@ -277,7 +277,7 @@ SSubclauseInfo *setSubclause(SSubclauseInfo *pClause, void *pSqlExprInfo);
SSubclauseInfo
*
appendSelectClause
(
SSubclauseInfo
*
pInfo
,
void
*
pSubclause
);
void
setCreated
Meter
Name
(
SSqlInfo
*
pInfo
,
SSQLToken
*
pMeterName
,
SSQLToken
*
pIfNotExists
);
void
setCreated
Table
Name
(
SSqlInfo
*
pInfo
,
SSQLToken
*
pMeterName
,
SSQLToken
*
pIfNotExists
);
void
SQLInfoDestroy
(
SSqlInfo
*
pInfo
);
...
...
src/query/inc/sql.y
浏览文件 @
96b24d70
...
...
@@ -264,7 +264,7 @@ signed(A) ::= MINUS INTEGER(X). { A = -strtol(X.z, NULL, 10);}
////////////////////////////////// The CREATE TABLE statement ///////////////////////////////
cmd ::= CREATE TABLE ifnotexists(Y) ids(X) cpxName(Z) create_table_args. {
X.n += Z.n;
setCreated
Meter
Name(pInfo, &X, &Y);
setCreated
Table
Name(pInfo, &X, &Y);
}
%type create_table_args{SCreateTableSQL*}
...
...
src/query/src/qparserImpl.c
浏览文件 @
96b24d70
...
...
@@ -463,7 +463,8 @@ int32_t getTimestampInUsFromStrImpl(int64_t val, char unit, int64_t *result) {
void
tSQLSetColumnInfo
(
TAOS_FIELD
*
pField
,
SSQLToken
*
pName
,
TAOS_FIELD
*
pType
)
{
int32_t
maxLen
=
sizeof
(
pField
->
name
)
/
sizeof
(
pField
->
name
[
0
]);
/* truncate the column name */
// truncate the column name
if
(
pName
->
n
>=
maxLen
)
{
pName
->
n
=
maxLen
-
1
;
}
...
...
@@ -478,7 +479,9 @@ void tSQLSetColumnInfo(TAOS_FIELD *pField, SSQLToken *pName, TAOS_FIELD *pType)
void
tSQLSetColumnType
(
TAOS_FIELD
*
pField
,
SSQLToken
*
type
)
{
pField
->
type
=
-
1
;
for
(
int8_t
i
=
0
;
i
<
sizeof
(
tDataTypeDesc
)
/
sizeof
(
tDataTypeDesc
[
0
]);
++
i
)
{
int32_t
LENGTH_SIZE_OF_STR
=
2
;
// in case of nchar and binary, there two bytes to keep the length of binary|nchar.
for
(
int8_t
i
=
0
;
i
<
tListLen
(
tDataTypeDesc
);
++
i
)
{
if
((
strncasecmp
(
type
->
z
,
tDataTypeDesc
[
i
].
aName
,
tDataTypeDesc
[
i
].
nameLen
)
==
0
)
&&
(
type
->
n
==
tDataTypeDesc
[
i
].
nameLen
))
{
pField
->
type
=
i
;
...
...
@@ -490,10 +493,10 @@ void tSQLSetColumnType(TAOS_FIELD *pField, SSQLToken *type) {
* number of bytes in UCS-4 format, which is 4 times larger than the
* number of characters
*/
pField
->
bytes
=
-
(
int32_t
)
type
->
type
*
TSDB_NCHAR_SIZE
;
pField
->
bytes
=
-
(
int32_t
)
type
->
type
*
TSDB_NCHAR_SIZE
+
LENGTH_SIZE_OF_STR
;
}
else
if
(
i
==
TSDB_DATA_TYPE_BINARY
)
{
/* for binary, the TOKENTYPE is the length of binary */
pField
->
bytes
=
-
(
int32_t
)
type
->
type
;
pField
->
bytes
=
-
(
int32_t
)
type
->
type
+
LENGTH_SIZE_OF_STR
;
}
break
;
}
...
...
@@ -731,7 +734,7 @@ SSubclauseInfo* appendSelectClause(SSubclauseInfo *pQueryInfo, void *pSubclause)
return
pQueryInfo
;
}
void
setCreated
Meter
Name
(
SSqlInfo
*
pInfo
,
SSQLToken
*
pMeterName
,
SSQLToken
*
pIfNotExists
)
{
void
setCreated
Table
Name
(
SSqlInfo
*
pInfo
,
SSQLToken
*
pMeterName
,
SSQLToken
*
pIfNotExists
)
{
pInfo
->
pCreateTableInfo
->
name
=
*
pMeterName
;
pInfo
->
pCreateTableInfo
->
existCheck
=
(
pIfNotExists
->
n
!=
0
);
}
...
...
src/query/src/sql.c
浏览文件 @
96b24d70
...
...
@@ -2267,7 +2267,7 @@ static void yy_reduce(
case
103
:
/* cmd ::= CREATE TABLE ifnotexists ids cpxName create_table_args */
{
yymsp
[
-
2
].
minor
.
yy0
.
n
+=
yymsp
[
-
1
].
minor
.
yy0
.
n
;
setCreated
Meter
Name
(
pInfo
,
&
yymsp
[
-
2
].
minor
.
yy0
,
&
yymsp
[
-
3
].
minor
.
yy0
);
setCreated
Table
Name
(
pInfo
,
&
yymsp
[
-
2
].
minor
.
yy0
,
&
yymsp
[
-
3
].
minor
.
yy0
);
}
break
;
case
104
:
/* create_table_args ::= LP columnlist RP */
...
...
src/rpc/src/rpcMain.c
浏览文件 @
96b24d70
...
...
@@ -32,6 +32,8 @@
#include "rpcCache.h"
#include "rpcTcp.h"
#include "rpcHead.h"
#include "shash.h"
#define RPC_MSG_OVERHEAD (sizeof(SRpcReqContext) + sizeof(SRpcHead) + sizeof(SRpcDigest))
#define rpcHeadFromCont(cont) ((SRpcHead *) (cont - sizeof(SRpcHead)))
...
...
@@ -260,7 +262,9 @@ void *rpcOpen(const SRpcInit *pInit) {
}
if
(
pRpc
->
connType
==
TAOS_CONN_SERVER
)
{
pRpc
->
hash
=
taosHashInit
(
pRpc
->
sessions
,
taosGetDefaultHashFunction
(
TSDB_DATA_TYPE_BINARY
),
true
);
pRpc
->
hash
=
taosInitStrHash
(
pRpc
->
sessions
,
sizeof
(
pRpc
),
taosHashString
);
// pRpc->hash = taosHashInit(pRpc->sessions, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), true);
if
(
pRpc
->
hash
==
NULL
)
{
tError
(
"%s failed to init string hash"
,
pRpc
->
label
);
rpcClose
(
pRpc
);
...
...
@@ -543,9 +547,10 @@ static void rpcCloseConn(void *thandle) {
if
(
pRpc
->
connType
==
TAOS_CONN_SERVER
)
{
char
hashstr
[
40
]
=
{
0
};
size_t
size
=
sprintf
(
hashstr
,
"%x:%x:%x:%d"
,
pConn
->
peerIp
,
pConn
->
linkUid
,
pConn
->
peerId
,
pConn
->
connType
);
taosHashRemove
(
pRpc
->
hash
,
hashstr
,
size
);
/*size_t size = */
sprintf
(
hashstr
,
"%x:%x:%x:%d"
,
pConn
->
peerIp
,
pConn
->
linkUid
,
pConn
->
peerId
,
pConn
->
connType
);
// taosHashRemove(pRpc->hash, hashstr, size);
taosDeleteStrHash
(
pRpc
->
hash
,
hashstr
);
rpcFreeMsg
(
pConn
->
pRspMsg
);
// it may have a response msg saved, but not request msg
pConn
->
pRspMsg
=
NULL
;
pConn
->
inType
=
0
;
...
...
@@ -593,10 +598,12 @@ static SRpcConn *rpcAllocateServerConn(SRpcInfo *pRpc, SRecvInfo *pRecv) {
char
hashstr
[
40
]
=
{
0
};
SRpcHead
*
pHead
=
(
SRpcHead
*
)
pRecv
->
msg
;
size_t
size
=
sprintf
(
hashstr
,
"%x:%x:%x:%d"
,
pRecv
->
ip
,
pHead
->
linkUid
,
pHead
->
sourceId
,
pRecv
->
connType
);
/*size_t size = */
sprintf
(
hashstr
,
"%x:%x:%x:%d"
,
pRecv
->
ip
,
pHead
->
linkUid
,
pHead
->
sourceId
,
pRecv
->
connType
);
// check if it is already allocated
SRpcConn
**
ppConn
=
(
SRpcConn
**
)(
taosHashGet
(
pRpc
->
hash
,
hashstr
,
size
));
SRpcConn
**
ppConn
=
(
SRpcConn
**
)(
taosGetStrHashData
(
pRpc
->
hash
,
hashstr
));
// SRpcConn **ppConn = (SRpcConn **)(taosHashGet(pRpc->hash, hashstr, size));
if
(
ppConn
)
pConn
=
*
ppConn
;
if
(
pConn
)
return
pConn
;
...
...
@@ -627,8 +634,10 @@ static SRpcConn *rpcAllocateServerConn(SRpcInfo *pRpc, SRecvInfo *pRecv) {
pRpc
->
index
=
(
pRpc
->
index
+
1
)
%
pRpc
->
numOfThreads
;
pConn
->
localPort
=
(
pRpc
->
localPort
+
pRpc
->
index
);
}
taosHashPut
(
pRpc
->
hash
,
hashstr
,
size
,
(
char
*
)
&
pConn
,
POINTER_BYTES
);
taosAddStrHash
(
pRpc
->
hash
,
hashstr
,
(
char
*
)
&
pConn
);
// taosHashPut(pRpc->hash, hashstr, size, (char *)&pConn, POINTER_BYTES);
tTrace
(
"%s %p, rpc connection is allocated, sid:%d id:%s port:%u"
,
pRpc
->
label
,
pConn
,
sid
,
pConn
->
user
,
pConn
->
localPort
);
...
...
src/tsdb/src/tsdbRead.c
浏览文件 @
96b24d70
...
...
@@ -560,7 +560,6 @@ static void filterDataInDataBlock(STsdbQueryHandle* pQueryHandle, STableCheckInf
SQueryFilePos
*
cur
=
&
pQueryHandle
->
cur
;
SDataBlockInfo
blockInfo
=
getTrueDataBlockInfo
(
pCheckInfo
,
pBlock
);
// pQueryHandle->rhelper.pDataCols[0]->cols[0];
SDataCols
*
pCols
=
pQueryHandle
->
rhelper
.
pDataCols
[
0
];
int32_t
endPos
=
cur
->
pos
;
...
...
@@ -607,8 +606,10 @@ static void filterDataInDataBlock(STsdbQueryHandle* pQueryHandle, STableCheckInf
SColumnInfoData
*
pCol
=
taosArrayGet
(
pQueryHandle
->
pColumns
,
j
);
if
(
pCol
->
info
.
colId
==
colId
)
{
memmove
(
pCol
->
pData
,
pQueryHandle
->
rhelper
.
pDataCols
[
0
]
->
cols
[
i
].
pData
+
pCol
->
info
.
bytes
*
start
,
pQueryHandle
->
realNumOfRows
*
pCol
->
info
.
bytes
);
memmove
(
pCol
->
pData
,
&
pQueryHandle
->
rhelper
.
pDataCols
[
0
]
->
cols
[
i
],
sizeof
(
SDataCol
)
+
pQueryHandle
->
rhelper
.
pDataCols
[
0
]
->
cols
[
i
].
len
);
tdPopDataColsPoints
(
pCol
->
pData
,
start
);
break
;
}
}
...
...
src/util/src/tcache.c
浏览文件 @
96b24d70
...
...
@@ -79,7 +79,7 @@ static FORCE_INLINE void taosFreeNode(void *data) {
*/
static
SCacheDataNode
*
taosCreateHashNode
(
const
char
*
key
,
size_t
keyLen
,
const
char
*
pData
,
size_t
size
,
uint64_t
duration
)
{
size_t
totalSize
=
size
+
sizeof
(
SCacheDataNode
)
+
keyLen
;
size_t
totalSize
=
size
+
sizeof
(
SCacheDataNode
)
+
keyLen
+
1
;
SCacheDataNode
*
pNewNode
=
calloc
(
1
,
totalSize
);
if
(
pNewNode
==
NULL
)
{
...
...
src/util/tests/CMakeLists.txt
浏览文件 @
96b24d70
...
...
@@ -10,7 +10,6 @@ IF (HEADER_GTEST_INCLUDE_DIR AND LIB_GTEST_STATIC_DIR)
INCLUDE_DIRECTORIES
(
${
HEADER_GTEST_INCLUDE_DIR
}
)
AUX_SOURCE_DIRECTORY
(
${
CMAKE_CURRENT_SOURCE_DIR
}
SOURCE_LIST
)
# ADD_EXECUTABLE(utilTest ${SOURCE_LIST})
ADD_EXECUTABLE
(
utilTest hashTest.cpp cacheTest.cpp
)
ADD_EXECUTABLE
(
utilTest
${
SOURCE_LIST
}
)
TARGET_LINK_LIBRARIES
(
utilTest tutil common gtest pthread
)
ENDIF
()
\ No newline at end of file
tests/examples/c/demo.c
浏览文件 @
96b24d70
...
...
@@ -75,9 +75,9 @@ int main(int argc, char *argv[]) {
doQuery
(
taos
,
"create database if not exists test"
);
doQuery
(
taos
,
"use test"
);
// doQuery(taos, "
select a from m1
");
// doQuery(taos, "select m2.u
from m1, m2 where m1.ts=m2.ts and m1.a=m2.b;");
doQuery
(
taos
,
"select last_row(ts) from tm99
"
);
// doQuery(taos, "
create table t1(ts timestamp, k binary(12), f nchar(2))
");
doQuery
(
taos
,
"select m1.ts,m1.a
from m1, m2 where m1.ts=m2.ts and m1.a=m2.b;"
);
// doQuery(taos, "insert into tm0 values('2020-1-1 1:1:1', 'abc')
");
// doQuery(taos, "create table if not exists tm0 (ts timestamp, k int);");
// doQuery(taos, "insert into tm0 values('2020-1-1 1:1:1', 1);");
// doQuery(taos, "insert into tm0 values('2020-1-1 1:1:2', 2);");
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录