Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
0c8b7bb0
T
TDengine
项目概览
taosdata
/
TDengine
12 个月 前同步成功
通知
1180
Star
22014
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,发现更多精彩内容 >>
提交
0c8b7bb0
编写于
5月 07, 2022
作者:
H
Hongze Cheng
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
more refact
上级
5d150204
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
40 addition
and
41 deletion
+40
-41
include/common/tmsg.h
include/common/tmsg.h
+1
-1
include/util/tencode.h
include/util/tencode.h
+19
-26
source/common/src/tmsg.c
source/common/src/tmsg.c
+1
-1
source/dnode/vnode/src/meta/metaEntry.c
source/dnode/vnode/src/meta/metaEntry.c
+1
-1
source/dnode/vnode/src/tsdb/tsdbMemTable2.c
source/dnode/vnode/src/tsdb/tsdbMemTable2.c
+16
-10
source/libs/sync/src/syncMessage.c
source/libs/sync/src/syncMessage.c
+2
-2
未找到文件。
include/common/tmsg.h
浏览文件 @
0c8b7bb0
...
...
@@ -2596,7 +2596,7 @@ typedef struct {
int64_t
suid
;
int64_t
uid
;
int32_t
sver
;
uint
64
_t
nData
;
uint
32
_t
nData
;
const
uint8_t
*
pData
;
SVCreateTbReq
cTbReq
;
}
SVSubmitBlk
;
...
...
include/util/tencode.h
浏览文件 @
0c8b7bb0
...
...
@@ -102,19 +102,12 @@ static FORCE_INLINE void* tCoderMalloc(SCoder* pCoder, int32_t size) {
} \
tCoderClear(&coder); \
} while (0)
// #define tEncodeSize(E, S, SIZE) \
// ({ \
// SCoder coder = {0}; \
// int ret = 0; \
// tCoderInit(&coder, TD_LITTLE_ENDIAN, NULL, 0, TD_ENCODER); \
// if ((E)(&coder, S) == 0) { \
// SIZE = coder.pos; \
// } else { \
// ret = -1; \
// } \
// tCoderClear(&coder); \
// ret; \
// })
typedef
struct
SEncoder
SEncoder
;
typedef
struct
SDecoder
SDecoder
;
void
tEncoderInit
(
SEncoder
*
pEncoder
,
uint8_t
*
data
,
uint32_t
size
);
void
tDecoderInit
(
SDecoder
*
pDecoder
,
const
uint8_t
*
data
,
uint32_t
size
);
void
tCoderInit
(
SCoder
*
pCoder
,
td_endian_t
endian
,
uint8_t
*
data
,
int32_t
size
,
td_coder_t
type
);
void
tCoderClear
(
SCoder
*
pCoder
);
...
...
@@ -138,8 +131,8 @@ static int32_t tEncodeU64v(SCoder* pEncoder, uint64_t val);
static
int32_t
tEncodeI64v
(
SCoder
*
pEncoder
,
int64_t
val
);
static
int32_t
tEncodeFloat
(
SCoder
*
pEncoder
,
float
val
);
static
int32_t
tEncodeDouble
(
SCoder
*
pEncoder
,
double
val
);
static
int32_t
tEncodeBinary
(
SCoder
*
pEncoder
,
const
uint8_t
*
val
,
uint
64
_t
len
);
static
int32_t
tEncodeCStrWithLen
(
SCoder
*
pEncoder
,
const
char
*
val
,
uint
64
_t
len
);
static
int32_t
tEncodeBinary
(
SCoder
*
pEncoder
,
const
uint8_t
*
val
,
uint
32
_t
len
);
static
int32_t
tEncodeCStrWithLen
(
SCoder
*
pEncoder
,
const
char
*
val
,
uint
32
_t
len
);
static
int32_t
tEncodeCStr
(
SCoder
*
pEncoder
,
const
char
*
val
);
/* ------------------------ DECODE ------------------------ */
...
...
@@ -162,8 +155,8 @@ static int32_t tDecodeU64v(SCoder* pDecoder, uint64_t* val);
static
int32_t
tDecodeI64v
(
SCoder
*
pDecoder
,
int64_t
*
val
);
static
int32_t
tDecodeFloat
(
SCoder
*
pDecoder
,
float
*
val
);
static
int32_t
tDecodeDouble
(
SCoder
*
pDecoder
,
double
*
val
);
static
int32_t
tDecodeBinary
(
SCoder
*
pDecoder
,
const
uint8_t
**
val
,
uint
64
_t
*
len
);
static
int32_t
tDecodeCStrAndLen
(
SCoder
*
pDecoder
,
const
char
**
val
,
uint
64
_t
*
len
);
static
int32_t
tDecodeBinary
(
SCoder
*
pDecoder
,
const
uint8_t
**
val
,
uint
32
_t
*
len
);
static
int32_t
tDecodeCStrAndLen
(
SCoder
*
pDecoder
,
const
char
**
val
,
uint
32
_t
*
len
);
static
int32_t
tDecodeCStr
(
SCoder
*
pDecoder
,
const
char
**
val
);
static
int32_t
tDecodeCStrTo
(
SCoder
*
pDecoder
,
char
*
val
);
...
...
@@ -292,8 +285,8 @@ static FORCE_INLINE int32_t tEncodeDouble(SCoder* pEncoder, double val) {
return
tEncodeU64
(
pEncoder
,
v
.
ui
);
}
static
FORCE_INLINE
int32_t
tEncodeBinary
(
SCoder
*
pEncoder
,
const
uint8_t
*
val
,
uint
64
_t
len
)
{
if
(
tEncodeU
64
v
(
pEncoder
,
len
)
<
0
)
return
-
1
;
static
FORCE_INLINE
int32_t
tEncodeBinary
(
SCoder
*
pEncoder
,
const
uint8_t
*
val
,
uint
32
_t
len
)
{
if
(
tEncodeU
32
v
(
pEncoder
,
len
)
<
0
)
return
-
1
;
if
(
pEncoder
->
data
)
{
if
(
TD_CODER_CHECK_CAPACITY_FAILED
(
pEncoder
,
len
))
return
-
1
;
memcpy
(
TD_CODER_CURRENT
(
pEncoder
),
val
,
len
);
...
...
@@ -303,12 +296,12 @@ static FORCE_INLINE int32_t tEncodeBinary(SCoder* pEncoder, const uint8_t* val,
return
0
;
}
static
FORCE_INLINE
int32_t
tEncodeCStrWithLen
(
SCoder
*
pEncoder
,
const
char
*
val
,
uint
64
_t
len
)
{
static
FORCE_INLINE
int32_t
tEncodeCStrWithLen
(
SCoder
*
pEncoder
,
const
char
*
val
,
uint
32
_t
len
)
{
return
tEncodeBinary
(
pEncoder
,
(
void
*
)
val
,
len
+
1
);
}
static
FORCE_INLINE
int32_t
tEncodeCStr
(
SCoder
*
pEncoder
,
const
char
*
val
)
{
return
tEncodeCStrWithLen
(
pEncoder
,
val
,
(
uint
64
_t
)
strlen
(
val
));
return
tEncodeCStrWithLen
(
pEncoder
,
val
,
(
uint
32
_t
)
strlen
(
val
));
}
/* ------------------------ FOR DECODER ------------------------ */
...
...
@@ -413,8 +406,8 @@ static FORCE_INLINE int32_t tDecodeDouble(SCoder* pDecoder, double* val) {
return
0
;
}
static
FORCE_INLINE
int32_t
tDecodeBinary
(
SCoder
*
pDecoder
,
const
uint8_t
**
val
,
uint
64
_t
*
len
)
{
if
(
tDecodeU
64
v
(
pDecoder
,
len
)
<
0
)
return
-
1
;
static
FORCE_INLINE
int32_t
tDecodeBinary
(
SCoder
*
pDecoder
,
const
uint8_t
**
val
,
uint
32
_t
*
len
)
{
if
(
tDecodeU
32
v
(
pDecoder
,
len
)
<
0
)
return
-
1
;
if
(
TD_CODER_CHECK_CAPACITY_FAILED
(
pDecoder
,
*
len
))
return
-
1
;
if
(
val
)
{
...
...
@@ -425,20 +418,20 @@ static FORCE_INLINE int32_t tDecodeBinary(SCoder* pDecoder, const uint8_t** val,
return
0
;
}
static
FORCE_INLINE
int32_t
tDecodeCStrAndLen
(
SCoder
*
pDecoder
,
const
char
**
val
,
uint
64
_t
*
len
)
{
static
FORCE_INLINE
int32_t
tDecodeCStrAndLen
(
SCoder
*
pDecoder
,
const
char
**
val
,
uint
32
_t
*
len
)
{
if
(
tDecodeBinary
(
pDecoder
,
(
const
uint8_t
**
)
val
,
len
)
<
0
)
return
-
1
;
(
*
len
)
-=
1
;
return
0
;
}
static
FORCE_INLINE
int32_t
tDecodeCStr
(
SCoder
*
pDecoder
,
const
char
**
val
)
{
uint
64
_t
len
;
uint
32
_t
len
;
return
tDecodeCStrAndLen
(
pDecoder
,
val
,
&
len
);
}
static
int32_t
tDecodeCStrTo
(
SCoder
*
pDecoder
,
char
*
val
)
{
const
char
*
pStr
;
uint
64
_t
len
;
uint
32
_t
len
;
if
(
tDecodeCStrAndLen
(
pDecoder
,
&
pStr
,
&
len
)
<
0
)
return
-
1
;
memcpy
(
val
,
pStr
,
len
+
1
);
...
...
source/common/src/tmsg.c
浏览文件 @
0c8b7bb0
...
...
@@ -3766,7 +3766,7 @@ int tEncodeSVCreateTbReq(SCoder *pCoder, const SVCreateTbReq *pReq) {
}
int
tDecodeSVCreateTbReq
(
SCoder
*
pCoder
,
SVCreateTbReq
*
pReq
)
{
uint
64
_t
len
;
uint
32
_t
len
;
if
(
tStartDecode
(
pCoder
)
<
0
)
return
-
1
;
...
...
source/dnode/vnode/src/meta/metaEntry.c
浏览文件 @
0c8b7bb0
...
...
@@ -44,7 +44,7 @@ int metaEncodeEntry(SCoder *pCoder, const SMetaEntry *pME) {
}
int
metaDecodeEntry
(
SCoder
*
pCoder
,
SMetaEntry
*
pME
)
{
uint
64
_t
len
;
uint
32
_t
len
;
if
(
tStartDecode
(
pCoder
)
<
0
)
return
-
1
;
if
(
tDecodeI64
(
pCoder
,
&
pME
->
version
)
<
0
)
return
-
1
;
...
...
source/dnode/vnode/src/tsdb/tsdbMemTable2.c
浏览文件 @
0c8b7bb0
...
...
@@ -177,15 +177,20 @@ int32_t tsdbInsertData2(SMemTable *pMemTb, int64_t version, const SVSubmitBlk *p
// do insert data to SMemData
SMemSkipListCurosr
slc
=
{
0
};
const
uint8_t
*
p
=
pSubmitBlk
->
pData
;
const
uint8_t
*
pt
;
const
STSRow
*
pRow
;
uint64_t
szRow
;
SCoder
coder
=
{
0
};
// t
sdbMemSkipListCursorOpen(&slc, &pMemData->sl
);
for
(;
p
-
pSubmitBlk
->
pData
<
pSubmitBlk
->
nData
;)
{
//
if (p - (uint8_t *)pSubmitBlk->pData >= pSubmitBlk->nData
) break;
// t
CoderInit(&coder, TD_LITTLE_ENDIAN, pSubmitBlk->pData, pSubmitBlk->nData, TD_DECODER
);
for
(;;)
{
//
if (tDecodeIsEnd(&coder)
) break;
// const uint8_t *pt = p;
// p = tGetBinary(p, &pTSRow, &rlen);
// // check the row (todo)
// if (tDecodeBinary(&coder, (const uint8_t **)&pRow, &szRow) < 0) {
// terrno = TSDB_CODE_INVALID_MSG;
// return -1;
// }
// check the row (todo)
// // move the cursor to position to write (todo)
// int32_t c;
...
...
@@ -206,10 +211,11 @@ int32_t tsdbInsertData2(SMemTable *pMemTb, int64_t version, const SVSubmitBlk *p
// // insert row
// tsdbMemSkipListCursorPut(&slc, pSlNode);
//
//
update status
// if (pTSRow->ts < pMemData->minKey) pMemData->minKey = pTS
Row->ts;
// if (pTSRow->ts > pMemData->maxKey) pMemData->maxKey = pTS
Row->ts;
// update status
if
(
pRow
->
ts
<
pMemData
->
minKey
)
pMemData
->
minKey
=
p
Row
->
ts
;
if
(
pRow
->
ts
>
pMemData
->
maxKey
)
pMemData
->
maxKey
=
p
Row
->
ts
;
}
// tCoderClear(&coder);
// tsdbMemSkipListCursorClose(&slc);
// update status
...
...
source/libs/sync/src/syncMessage.c
浏览文件 @
0c8b7bb0
...
...
@@ -409,7 +409,7 @@ SyncPing* syncPingDeserialize3(void* buf, int32_t bufLen) {
if
(
tDecodeU32
(
&
decoder
,
&
pMsg
->
dataLen
)
<
0
)
{
return
NULL
;
}
uint
64
_t
len
;
uint
32
_t
len
;
char
*
data
=
NULL
;
if
(
tDecodeBinary
(
&
decoder
,
(
const
uint8_t
**
)(
&
data
),
&
len
)
<
0
)
{
return
NULL
;
...
...
@@ -668,7 +668,7 @@ SyncPingReply* syncPingReplyDeserialize3(void* buf, int32_t bufLen) {
if
(
tDecodeU32
(
&
decoder
,
&
pMsg
->
dataLen
)
<
0
)
{
return
NULL
;
}
uint
64
_t
len
;
uint
32
_t
len
;
char
*
data
=
NULL
;
if
(
tDecodeBinary
(
&
decoder
,
(
const
uint8_t
**
)(
&
data
),
&
len
)
<
0
)
{
return
NULL
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录