Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
4d18fa08
T
TDengine
项目概览
taosdata
/
TDengine
接近 2 年 前同步成功
通知
1192
Star
22018
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看板
提交
4d18fa08
编写于
5月 21, 2022
作者:
dengyihao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
enh: refator index/transport code
上级
84eeb2ab
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
31 addition
and
84 deletion
+31
-84
source/libs/executor/src/indexoperator.c
source/libs/executor/src/indexoperator.c
+12
-32
source/libs/index/inc/indexInt.h
source/libs/index/inc/indexInt.h
+6
-6
source/libs/index/src/index.c
source/libs/index/src/index.c
+4
-3
source/libs/index/src/indexCache.c
source/libs/index/src/indexCache.c
+1
-1
source/libs/index/src/indexTfile.c
source/libs/index/src/indexTfile.c
+4
-5
source/libs/transport/inc/transComm.h
source/libs/transport/inc/transComm.h
+0
-31
source/libs/transport/inc/transportInt.h
source/libs/transport/inc/transportInt.h
+2
-4
source/libs/transport/src/transSrv.c
source/libs/transport/src/transSrv.c
+2
-2
未找到文件。
source/libs/executor/src/indexoperator.c
浏览文件 @
4d18fa08
...
...
@@ -19,38 +19,11 @@
#include "nodes.h"
#include "tdatablock.h"
typedef
struct
SIFCtx
{
int32_t
code
;
SHashObj
*
pRes
;
/* element is SScalarParam */
bool
noExec
;
// true: just iterate condition tree, and add hint to executor plan
// SIdxFltStatus st;
}
SIFCtx
;
#define SIF_ERR_RET(c) \
do { \
int32_t _code = c; \
if (_code != TSDB_CODE_SUCCESS) { \
terrno = _code; \
return _code; \
} \
} while (0)
#define SIF_RET(c) \
do { \
int32_t _code = c; \
if (_code != TSDB_CODE_SUCCESS) { \
terrno = _code; \
} \
return _code; \
} while (0)
#define SIF_ERR_JRET(c) \
do { \
code = c; \
if (code != TSDB_CODE_SUCCESS) { \
terrno = code; \
goto _return; \
} \
} while (0)
// clang-format off
#define SIF_ERR_RET(c) do { int32_t _code = c; if (_code != TSDB_CODE_SUCCESS) { terrno = _code; return _code; } } while (0)
#define SIF_RET(c) do { int32_t _code = c; if (_code != TSDB_CODE_SUCCESS) { terrno = _code; } return _code; } while (0)
#define SIF_ERR_JRET(c) do { code = c; if (code != TSDB_CODE_SUCCESS) { terrno = code; goto _return; } } while (0)
// clang-format on
typedef
struct
SIFParam
{
SHashObj
*
pFilter
;
...
...
@@ -65,6 +38,13 @@ typedef struct SIFParam {
char
colName
[
TSDB_COL_NAME_LEN
];
}
SIFParam
;
typedef
struct
SIFCtx
{
int32_t
code
;
SHashObj
*
pRes
;
/* element is SIFParam */
bool
noExec
;
// true: just iterate condition tree, and add hint to executor plan
// SIdxFltStatus st;
}
SIFCtx
;
static
int32_t
sifGetFuncFromSql
(
EOperatorType
src
,
EIndexQueryType
*
dst
)
{
if
(
src
==
OP_TYPE_GREATER_THAN
)
{
*
dst
=
QUERY_GREATER_THAN
;
...
...
source/libs/index/inc/indexInt.h
浏览文件 @
4d18fa08
...
...
@@ -132,12 +132,12 @@ int32_t indexSerialCacheKey(ICacheKey* key, char* buf);
// int32_t indexSerialTermKey(SIndexTerm* itm, char* buf);
// clang-format off
#define indexFatal(...) do { if (sDebugFlag & DEBUG_FATAL) { taosPrintLog("
index
FATAL ", DEBUG_FATAL, 255, __VA_ARGS__); }} while (0)
#define indexError(...) do { if (sDebugFlag & DEBUG_ERROR) { taosPrintLog("
index
ERROR ", DEBUG_ERROR, 255, __VA_ARGS__); }} while (0)
#define indexWarn(...) do { if (sDebugFlag & DEBUG_WARN) { taosPrintLog("
index
WARN ", DEBUG_WARN, 255, __VA_ARGS__); }} while (0)
#define indexInfo(...) do { if (sDebugFlag & DEBUG_INFO) { taosPrintLog("
index
", DEBUG_INFO, 255, __VA_ARGS__); } } while (0)
#define indexDebug(...) do { if (sDebugFlag & DEBUG_DEBUG) { taosPrintLog("
index
", DEBUG_DEBUG, sDebugFlag, __VA_ARGS__);} } while (0)
#define indexTrace(...) do { if (sDebugFlag & DEBUG_TRACE) { taosPrintLog("
index
", DEBUG_TRACE, sDebugFlag, __VA_ARGS__);} } while (0)
#define indexFatal(...) do { if (sDebugFlag & DEBUG_FATAL) { taosPrintLog("
INDEX
FATAL ", DEBUG_FATAL, 255, __VA_ARGS__); }} while (0)
#define indexError(...) do { if (sDebugFlag & DEBUG_ERROR) { taosPrintLog("
INDEX
ERROR ", DEBUG_ERROR, 255, __VA_ARGS__); }} while (0)
#define indexWarn(...) do { if (sDebugFlag & DEBUG_WARN) { taosPrintLog("
INDEX
WARN ", DEBUG_WARN, 255, __VA_ARGS__); }} while (0)
#define indexInfo(...) do { if (sDebugFlag & DEBUG_INFO) { taosPrintLog("
INDEX
", DEBUG_INFO, 255, __VA_ARGS__); } } while (0)
#define indexDebug(...) do { if (sDebugFlag & DEBUG_DEBUG) { taosPrintLog("
INDEX
", DEBUG_DEBUG, sDebugFlag, __VA_ARGS__);} } while (0)
#define indexTrace(...) do { if (sDebugFlag & DEBUG_TRACE) { taosPrintLog("
INDEX
", DEBUG_TRACE, sDebugFlag, __VA_ARGS__);} } while (0)
// clang-format on
#define INDEX_TYPE_CONTAIN_EXTERN_TYPE(ty, exTy) (((ty >> 4) & (exTy)) != 0)
...
...
source/libs/index/src/index.c
浏览文件 @
4d18fa08
...
...
@@ -563,10 +563,11 @@ int32_t indexSerialCacheKey(ICacheKey* key, char* buf) {
bool
hasJson
=
INDEX_TYPE_CONTAIN_EXTERN_TYPE
(
key
->
colType
,
TSDB_DATA_TYPE_JSON
);
char
*
p
=
buf
;
SERIALIZE_MEM_TO_BUF
(
buf
,
key
,
suid
);
char
tbuf
[
65
]
=
{
0
};
indexInt2str
((
int64_t
)
key
->
suid
,
tbuf
,
0
);
SERIALIZE_STR_VAR_TO_BUF
(
buf
,
tbuf
,
strlen
(
tbuf
));
SERIALIZE_VAR_TO_BUF
(
buf
,
'_'
,
char
);
// SERIALIZE_MEM_TO_BUF(buf, key, colType);
// SERIALIZE_VAR_TO_BUF(buf, '_', char);
if
(
hasJson
)
{
SERIALIZE_STR_VAR_TO_BUF
(
buf
,
JSON_COLUMN
,
strlen
(
JSON_COLUMN
));
}
else
{
...
...
source/libs/index/src/indexCache.c
浏览文件 @
4d18fa08
...
...
@@ -385,7 +385,7 @@ void indexCacheDebug(IndexCache* cache) {
void
indexCacheDestroySkiplist
(
SSkipList
*
slt
)
{
SSkipListIterator
*
iter
=
tSkipListCreateIter
(
slt
);
while
(
tSkipListIterNext
(
iter
))
{
while
(
iter
!=
NULL
&&
tSkipListIterNext
(
iter
))
{
SSkipListNode
*
node
=
tSkipListIterGet
(
iter
);
CacheTerm
*
ct
=
(
CacheTerm
*
)
SL_GET_NODE_DATA
(
node
);
if
(
ct
!=
NULL
)
{
...
...
source/libs/index/src/indexTfile.c
浏览文件 @
4d18fa08
...
...
@@ -172,7 +172,6 @@ void tfileCachePut(TFileCache* tcache, ICacheKey* key, TFileReader* reader) {
oldReader
->
remove
=
true
;
tfileReaderUnRef
(
oldReader
);
}
taosHashPut
(
tcache
->
tableCache
,
buf
,
sz
,
&
reader
,
sizeof
(
void
*
));
tfileReaderRef
(
reader
);
return
;
...
...
@@ -500,15 +499,15 @@ static int32_t tfSearchCompareFunc_JSON(void* reader, SIndexTerm* tem, SIdxTempR
int
tfileReaderSearch
(
TFileReader
*
reader
,
SIndexTermQuery
*
query
,
SIdxTempResult
*
tr
)
{
SIndexTerm
*
term
=
query
->
term
;
EIndexQueryType
qtype
=
query
->
qType
;
int
ret
=
0
;
if
(
INDEX_TYPE_CONTAIN_EXTERN_TYPE
(
term
->
colType
,
TSDB_DATA_TYPE_JSON
))
{
ret
urn
tfSearch
[
1
][
qtype
](
reader
,
term
,
tr
);
ret
=
tfSearch
[
1
][
qtype
](
reader
,
term
,
tr
);
}
else
{
ret
urn
tfSearch
[
0
][
qtype
](
reader
,
term
,
tr
);
ret
=
tfSearch
[
0
][
qtype
](
reader
,
term
,
tr
);
}
tfileReaderUnRef
(
reader
);
return
0
;
return
ret
;
}
TFileWriter
*
tfileWriterOpen
(
char
*
path
,
uint64_t
suid
,
int32_t
version
,
const
char
*
colName
,
uint8_t
colType
)
{
...
...
source/libs/transport/inc/transComm.h
浏览文件 @
4d18fa08
...
...
@@ -20,22 +20,12 @@ extern "C" {
#endif
#include <uv.h>
#include "lz4.h"
#include "os.h"
#include "osSocket.h"
#include "taoserror.h"
#include "tglobal.h"
#include "thash.h"
#include "theap.h"
#include "tidpool.h"
#include "tmd5.h"
#include "tmempool.h"
#include "tmsg.h"
#include "transLog.h"
#include "transportInt.h"
#include "tref.h"
#include "trpc.h"
#include "ttimer.h"
#include "tutil.h"
typedef
void
*
queue
[
2
];
...
...
@@ -108,27 +98,6 @@ typedef void* queue[2];
#define TRANS_RETRY_INTERVAL 15 // ms retry interval
#define TRANS_CONN_TIMEOUT 3 // connect timeout
typedef
struct
{
SRpcInfo
*
pRpc
;
// associated SRpcInfo
SEpSet
epSet
;
// ip list provided by app
void
*
ahandle
;
// handle provided by app
// struct SRpcConn* pConn; // pConn allocated
tmsg_t
msgType
;
// message type
uint8_t
*
pCont
;
// content provided by app
int32_t
contLen
;
// content length
// int32_t code; // error code
// int16_t numOfTry; // number of try for different servers
// int8_t oldInUse; // server EP inUse passed by app
// int8_t redirect; // flag to indicate redirect
int8_t
connType
;
// connection type
int64_t
rid
;
// refId returned by taosAddRef
SRpcMsg
*
pRsp
;
// for synchronous API
tsem_t
*
pSem
;
// for synchronous API
char
*
ip
;
uint32_t
port
;
// SEpSet* pSet; // for synchronous API
}
SRpcReqContext
;
typedef
SRpcMsg
STransMsg
;
typedef
SRpcCtx
STransCtx
;
typedef
SRpcCtxVal
STransCtxVal
;
...
...
source/libs/transport/inc/transportInt.h
浏览文件 @
4d18fa08
...
...
@@ -22,15 +22,13 @@
#include "lz4.h"
#include "os.h"
#include "taoserror.h"
#include "tglobal.h"
#include "thash.h"
#include "t
idpool
.h"
#include "t
ref
.h"
#include "tmsg.h"
#include "transLog.h"
#include "tref.h"
#include "trpc.h"
#include "ttimer.h"
#include "tutil.h"
#include "tglobal.h"
#ifdef __cplusplus
extern
"C"
{
...
...
source/libs/transport/src/transSrv.c
浏览文件 @
4d18fa08
...
...
@@ -295,14 +295,14 @@ static void uvHandleReq(SSrvConn* pConn) {
// no ref here
}
//
if
pHead->noResp = 1,
// pHead->noResp = 1,
// 1. server application should not send resp on handle
// 2. once send out data, cli conn released to conn pool immediately
// 3. not mixed with persist
transMsg
.
info
.
handle
=
(
void
*
)
uvAcquireExHandle
(
pConn
->
refId
);
tTrace
(
"server handle %p conn: %p translated to app, refId: %"
PRIu64
""
,
transMsg
.
info
.
handle
,
pConn
,
pConn
->
refId
);
transMsg
.
info
.
refId
=
pConn
->
refId
;
tTrace
(
"server handle %p conn: %p translated to app, refId: %"
PRIu64
""
,
transMsg
.
info
.
handle
,
pConn
,
pConn
->
refId
);
assert
(
transMsg
.
info
.
handle
!=
NULL
);
if
(
pHead
->
noResp
==
1
)
{
transMsg
.
info
.
refId
=
-
1
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录