Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
0c8b7bb0
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看板
提交
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 {
...
@@ -2596,7 +2596,7 @@ typedef struct {
int64_t
suid
;
int64_t
suid
;
int64_t
uid
;
int64_t
uid
;
int32_t
sver
;
int32_t
sver
;
uint
64
_t
nData
;
uint
32
_t
nData
;
const
uint8_t
*
pData
;
const
uint8_t
*
pData
;
SVCreateTbReq
cTbReq
;
SVCreateTbReq
cTbReq
;
}
SVSubmitBlk
;
}
SVSubmitBlk
;
...
...
include/util/tencode.h
浏览文件 @
0c8b7bb0
...
@@ -102,19 +102,12 @@ static FORCE_INLINE void* tCoderMalloc(SCoder* pCoder, int32_t size) {
...
@@ -102,19 +102,12 @@ static FORCE_INLINE void* tCoderMalloc(SCoder* pCoder, int32_t size) {
} \
} \
tCoderClear(&coder); \
tCoderClear(&coder); \
} while (0)
} while (0)
// #define tEncodeSize(E, S, SIZE) \
// ({ \
typedef
struct
SEncoder
SEncoder
;
// SCoder coder = {0}; \
typedef
struct
SDecoder
SDecoder
;
// int ret = 0; \
// tCoderInit(&coder, TD_LITTLE_ENDIAN, NULL, 0, TD_ENCODER); \
void
tEncoderInit
(
SEncoder
*
pEncoder
,
uint8_t
*
data
,
uint32_t
size
);
// if ((E)(&coder, S) == 0) { \
void
tDecoderInit
(
SDecoder
*
pDecoder
,
const
uint8_t
*
data
,
uint32_t
size
);
// SIZE = coder.pos; \
// } else { \
// ret = -1; \
// } \
// tCoderClear(&coder); \
// ret; \
// })
void
tCoderInit
(
SCoder
*
pCoder
,
td_endian_t
endian
,
uint8_t
*
data
,
int32_t
size
,
td_coder_t
type
);
void
tCoderInit
(
SCoder
*
pCoder
,
td_endian_t
endian
,
uint8_t
*
data
,
int32_t
size
,
td_coder_t
type
);
void
tCoderClear
(
SCoder
*
pCoder
);
void
tCoderClear
(
SCoder
*
pCoder
);
...
@@ -138,8 +131,8 @@ static int32_t tEncodeU64v(SCoder* pEncoder, uint64_t val);
...
@@ -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
tEncodeI64v
(
SCoder
*
pEncoder
,
int64_t
val
);
static
int32_t
tEncodeFloat
(
SCoder
*
pEncoder
,
float
val
);
static
int32_t
tEncodeFloat
(
SCoder
*
pEncoder
,
float
val
);
static
int32_t
tEncodeDouble
(
SCoder
*
pEncoder
,
double
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
tEncodeBinary
(
SCoder
*
pEncoder
,
const
uint8_t
*
val
,
uint
32
_t
len
);
static
int32_t
tEncodeCStrWithLen
(
SCoder
*
pEncoder
,
const
char
*
val
,
uint
64
_t
len
);
static
int32_t
tEncodeCStrWithLen
(
SCoder
*
pEncoder
,
const
char
*
val
,
uint
32
_t
len
);
static
int32_t
tEncodeCStr
(
SCoder
*
pEncoder
,
const
char
*
val
);
static
int32_t
tEncodeCStr
(
SCoder
*
pEncoder
,
const
char
*
val
);
/* ------------------------ DECODE ------------------------ */
/* ------------------------ DECODE ------------------------ */
...
@@ -162,8 +155,8 @@ static int32_t tDecodeU64v(SCoder* pDecoder, uint64_t* val);
...
@@ -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
tDecodeI64v
(
SCoder
*
pDecoder
,
int64_t
*
val
);
static
int32_t
tDecodeFloat
(
SCoder
*
pDecoder
,
float
*
val
);
static
int32_t
tDecodeFloat
(
SCoder
*
pDecoder
,
float
*
val
);
static
int32_t
tDecodeDouble
(
SCoder
*
pDecoder
,
double
*
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
tDecodeBinary
(
SCoder
*
pDecoder
,
const
uint8_t
**
val
,
uint
32
_t
*
len
);
static
int32_t
tDecodeCStrAndLen
(
SCoder
*
pDecoder
,
const
char
**
val
,
uint
64
_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
tDecodeCStr
(
SCoder
*
pDecoder
,
const
char
**
val
);
static
int32_t
tDecodeCStrTo
(
SCoder
*
pDecoder
,
char
*
val
);
static
int32_t
tDecodeCStrTo
(
SCoder
*
pDecoder
,
char
*
val
);
...
@@ -292,8 +285,8 @@ static FORCE_INLINE int32_t tEncodeDouble(SCoder* pEncoder, double val) {
...
@@ -292,8 +285,8 @@ static FORCE_INLINE int32_t tEncodeDouble(SCoder* pEncoder, double val) {
return
tEncodeU64
(
pEncoder
,
v
.
ui
);
return
tEncodeU64
(
pEncoder
,
v
.
ui
);
}
}
static
FORCE_INLINE
int32_t
tEncodeBinary
(
SCoder
*
pEncoder
,
const
uint8_t
*
val
,
uint
64
_t
len
)
{
static
FORCE_INLINE
int32_t
tEncodeBinary
(
SCoder
*
pEncoder
,
const
uint8_t
*
val
,
uint
32
_t
len
)
{
if
(
tEncodeU
64
v
(
pEncoder
,
len
)
<
0
)
return
-
1
;
if
(
tEncodeU
32
v
(
pEncoder
,
len
)
<
0
)
return
-
1
;
if
(
pEncoder
->
data
)
{
if
(
pEncoder
->
data
)
{
if
(
TD_CODER_CHECK_CAPACITY_FAILED
(
pEncoder
,
len
))
return
-
1
;
if
(
TD_CODER_CHECK_CAPACITY_FAILED
(
pEncoder
,
len
))
return
-
1
;
memcpy
(
TD_CODER_CURRENT
(
pEncoder
),
val
,
len
);
memcpy
(
TD_CODER_CURRENT
(
pEncoder
),
val
,
len
);
...
@@ -303,12 +296,12 @@ static FORCE_INLINE int32_t tEncodeBinary(SCoder* pEncoder, const uint8_t* val,
...
@@ -303,12 +296,12 @@ static FORCE_INLINE int32_t tEncodeBinary(SCoder* pEncoder, const uint8_t* val,
return
0
;
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
);
return
tEncodeBinary
(
pEncoder
,
(
void
*
)
val
,
len
+
1
);
}
}
static
FORCE_INLINE
int32_t
tEncodeCStr
(
SCoder
*
pEncoder
,
const
char
*
val
)
{
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 ------------------------ */
/* ------------------------ FOR DECODER ------------------------ */
...
@@ -413,8 +406,8 @@ static FORCE_INLINE int32_t tDecodeDouble(SCoder* pDecoder, double* val) {
...
@@ -413,8 +406,8 @@ static FORCE_INLINE int32_t tDecodeDouble(SCoder* pDecoder, double* val) {
return
0
;
return
0
;
}
}
static
FORCE_INLINE
int32_t
tDecodeBinary
(
SCoder
*
pDecoder
,
const
uint8_t
**
val
,
uint
64
_t
*
len
)
{
static
FORCE_INLINE
int32_t
tDecodeBinary
(
SCoder
*
pDecoder
,
const
uint8_t
**
val
,
uint
32
_t
*
len
)
{
if
(
tDecodeU
64
v
(
pDecoder
,
len
)
<
0
)
return
-
1
;
if
(
tDecodeU
32
v
(
pDecoder
,
len
)
<
0
)
return
-
1
;
if
(
TD_CODER_CHECK_CAPACITY_FAILED
(
pDecoder
,
*
len
))
return
-
1
;
if
(
TD_CODER_CHECK_CAPACITY_FAILED
(
pDecoder
,
*
len
))
return
-
1
;
if
(
val
)
{
if
(
val
)
{
...
@@ -425,20 +418,20 @@ static FORCE_INLINE int32_t tDecodeBinary(SCoder* pDecoder, const uint8_t** val,
...
@@ -425,20 +418,20 @@ static FORCE_INLINE int32_t tDecodeBinary(SCoder* pDecoder, const uint8_t** val,
return
0
;
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
;
if
(
tDecodeBinary
(
pDecoder
,
(
const
uint8_t
**
)
val
,
len
)
<
0
)
return
-
1
;
(
*
len
)
-=
1
;
(
*
len
)
-=
1
;
return
0
;
return
0
;
}
}
static
FORCE_INLINE
int32_t
tDecodeCStr
(
SCoder
*
pDecoder
,
const
char
**
val
)
{
static
FORCE_INLINE
int32_t
tDecodeCStr
(
SCoder
*
pDecoder
,
const
char
**
val
)
{
uint
64
_t
len
;
uint
32
_t
len
;
return
tDecodeCStrAndLen
(
pDecoder
,
val
,
&
len
);
return
tDecodeCStrAndLen
(
pDecoder
,
val
,
&
len
);
}
}
static
int32_t
tDecodeCStrTo
(
SCoder
*
pDecoder
,
char
*
val
)
{
static
int32_t
tDecodeCStrTo
(
SCoder
*
pDecoder
,
char
*
val
)
{
const
char
*
pStr
;
const
char
*
pStr
;
uint
64
_t
len
;
uint
32
_t
len
;
if
(
tDecodeCStrAndLen
(
pDecoder
,
&
pStr
,
&
len
)
<
0
)
return
-
1
;
if
(
tDecodeCStrAndLen
(
pDecoder
,
&
pStr
,
&
len
)
<
0
)
return
-
1
;
memcpy
(
val
,
pStr
,
len
+
1
);
memcpy
(
val
,
pStr
,
len
+
1
);
...
...
source/common/src/tmsg.c
浏览文件 @
0c8b7bb0
...
@@ -3766,7 +3766,7 @@ int tEncodeSVCreateTbReq(SCoder *pCoder, const SVCreateTbReq *pReq) {
...
@@ -3766,7 +3766,7 @@ int tEncodeSVCreateTbReq(SCoder *pCoder, const SVCreateTbReq *pReq) {
}
}
int
tDecodeSVCreateTbReq
(
SCoder
*
pCoder
,
SVCreateTbReq
*
pReq
)
{
int
tDecodeSVCreateTbReq
(
SCoder
*
pCoder
,
SVCreateTbReq
*
pReq
)
{
uint
64
_t
len
;
uint
32
_t
len
;
if
(
tStartDecode
(
pCoder
)
<
0
)
return
-
1
;
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) {
...
@@ -44,7 +44,7 @@ int metaEncodeEntry(SCoder *pCoder, const SMetaEntry *pME) {
}
}
int
metaDecodeEntry
(
SCoder
*
pCoder
,
SMetaEntry
*
pME
)
{
int
metaDecodeEntry
(
SCoder
*
pCoder
,
SMetaEntry
*
pME
)
{
uint
64
_t
len
;
uint
32
_t
len
;
if
(
tStartDecode
(
pCoder
)
<
0
)
return
-
1
;
if
(
tStartDecode
(
pCoder
)
<
0
)
return
-
1
;
if
(
tDecodeI64
(
pCoder
,
&
pME
->
version
)
<
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
...
@@ -177,15 +177,20 @@ int32_t tsdbInsertData2(SMemTable *pMemTb, int64_t version, const SVSubmitBlk *p
// do insert data to SMemData
// do insert data to SMemData
SMemSkipListCurosr
slc
=
{
0
};
SMemSkipListCurosr
slc
=
{
0
};
const
uint8_t
*
p
=
pSubmitBlk
->
pData
;
const
uint8_t
*
p
=
pSubmitBlk
->
pData
;
const
uint8_t
*
pt
;
const
STSRow
*
pRow
;
uint64_t
szRow
;
SCoder
coder
=
{
0
};
// t
sdbMemSkipListCursorOpen(&slc, &pMemData->sl
);
// t
CoderInit(&coder, TD_LITTLE_ENDIAN, pSubmitBlk->pData, pSubmitBlk->nData, TD_DECODER
);
for
(;
p
-
pSubmitBlk
->
pData
<
pSubmitBlk
->
nData
;)
{
for
(;;)
{
//
if (p - (uint8_t *)pSubmitBlk->pData >= pSubmitBlk->nData
) break;
//
if (tDecodeIsEnd(&coder)
) break;
// const uint8_t *pt = p;
// if (tDecodeBinary(&coder, (const uint8_t **)&pRow, &szRow) < 0) {
// p = tGetBinary(p, &pTSRow, &rlen);
// terrno = TSDB_CODE_INVALID_MSG;
// return -1;
// // check the row (todo)
// }
// check the row (todo)
// // move the cursor to position to write (todo)
// // move the cursor to position to write (todo)
// int32_t c;
// int32_t c;
...
@@ -206,10 +211,11 @@ int32_t tsdbInsertData2(SMemTable *pMemTb, int64_t version, const SVSubmitBlk *p
...
@@ -206,10 +211,11 @@ int32_t tsdbInsertData2(SMemTable *pMemTb, int64_t version, const SVSubmitBlk *p
// // insert row
// // insert row
// tsdbMemSkipListCursorPut(&slc, pSlNode);
// tsdbMemSkipListCursorPut(&slc, pSlNode);
//
//
update status
// update status
// if (pTSRow->ts < pMemData->minKey) pMemData->minKey = pTS
Row->ts;
if
(
pRow
->
ts
<
pMemData
->
minKey
)
pMemData
->
minKey
=
p
Row
->
ts
;
// if (pTSRow->ts > pMemData->maxKey) pMemData->maxKey = pTS
Row->ts;
if
(
pRow
->
ts
>
pMemData
->
maxKey
)
pMemData
->
maxKey
=
p
Row
->
ts
;
}
}
// tCoderClear(&coder);
// tsdbMemSkipListCursorClose(&slc);
// tsdbMemSkipListCursorClose(&slc);
// update status
// update status
...
...
source/libs/sync/src/syncMessage.c
浏览文件 @
0c8b7bb0
...
@@ -409,7 +409,7 @@ SyncPing* syncPingDeserialize3(void* buf, int32_t bufLen) {
...
@@ -409,7 +409,7 @@ SyncPing* syncPingDeserialize3(void* buf, int32_t bufLen) {
if
(
tDecodeU32
(
&
decoder
,
&
pMsg
->
dataLen
)
<
0
)
{
if
(
tDecodeU32
(
&
decoder
,
&
pMsg
->
dataLen
)
<
0
)
{
return
NULL
;
return
NULL
;
}
}
uint
64
_t
len
;
uint
32
_t
len
;
char
*
data
=
NULL
;
char
*
data
=
NULL
;
if
(
tDecodeBinary
(
&
decoder
,
(
const
uint8_t
**
)(
&
data
),
&
len
)
<
0
)
{
if
(
tDecodeBinary
(
&
decoder
,
(
const
uint8_t
**
)(
&
data
),
&
len
)
<
0
)
{
return
NULL
;
return
NULL
;
...
@@ -668,7 +668,7 @@ SyncPingReply* syncPingReplyDeserialize3(void* buf, int32_t bufLen) {
...
@@ -668,7 +668,7 @@ SyncPingReply* syncPingReplyDeserialize3(void* buf, int32_t bufLen) {
if
(
tDecodeU32
(
&
decoder
,
&
pMsg
->
dataLen
)
<
0
)
{
if
(
tDecodeU32
(
&
decoder
,
&
pMsg
->
dataLen
)
<
0
)
{
return
NULL
;
return
NULL
;
}
}
uint
64
_t
len
;
uint
32
_t
len
;
char
*
data
=
NULL
;
char
*
data
=
NULL
;
if
(
tDecodeBinary
(
&
decoder
,
(
const
uint8_t
**
)(
&
data
),
&
len
)
<
0
)
{
if
(
tDecodeBinary
(
&
decoder
,
(
const
uint8_t
**
)(
&
data
),
&
len
)
<
0
)
{
return
NULL
;
return
NULL
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录