Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
0122fd12
T
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22016
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看板
未验证
提交
0122fd12
编写于
5月 23, 2022
作者:
H
Hongze Cheng
提交者:
GitHub
5月 23, 2022
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #12857 from taosdata/fix/hzcheng_3.0
feat: discard const when decode
上级
136abb13
d784da0d
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
115 addition
and
110 deletion
+115
-110
include/common/tmsg.h
include/common/tmsg.h
+46
-46
include/util/tencode.h
include/util/tencode.h
+15
-15
source/dnode/vnode/inc/vnode.h
source/dnode/vnode/inc/vnode.h
+9
-9
source/dnode/vnode/src/meta/metaTable.c
source/dnode/vnode/src/meta/metaTable.c
+29
-24
source/dnode/vnode/src/tsdb/tsdbMemTable2.c
source/dnode/vnode/src/tsdb/tsdbMemTable2.c
+4
-4
source/libs/parser/test/parInitialATest.cpp
source/libs/parser/test/parInitialATest.cpp
+5
-5
source/libs/sync/src/syncMessage.c
source/libs/sync/src/syncMessage.c
+2
-2
source/util/src/tencode.c
source/util/src/tencode.c
+5
-5
未找到文件。
include/common/tmsg.h
浏览文件 @
0122fd12
...
...
@@ -1697,7 +1697,7 @@ int32_t tDecodeSRSmaParam(SDecoder* pCoder, SRSmaParam* pRSmaParam);
// TDMT_VND_CREATE_STB ==============
typedef
struct
SVCreateStbReq
{
c
onst
char
*
name
;
c
har
*
name
;
tb_uid_t
suid
;
int8_t
rollup
;
SSchemaWrapper
schema
;
...
...
@@ -1710,8 +1710,8 @@ int tDecodeSVCreateStbReq(SDecoder* pCoder, SVCreateStbReq* pReq);
// TDMT_VND_DROP_STB ==============
typedef
struct
SVDropStbReq
{
c
onst
char
*
name
;
tb_uid_t
suid
;
c
har
*
name
;
tb_uid_t
suid
;
}
SVDropStbReq
;
int32_t
tEncodeSVDropStbReq
(
SEncoder
*
pCoder
,
const
SVDropStbReq
*
pReq
);
...
...
@@ -1720,16 +1720,16 @@ int32_t tDecodeSVDropStbReq(SDecoder* pCoder, SVDropStbReq* pReq);
// TDMT_VND_CREATE_TABLE ==============
#define TD_CREATE_IF_NOT_EXISTS 0x1
typedef
struct
SVCreateTbReq
{
int32_t
flags
;
tb_uid_t
uid
;
int64_t
ctime
;
c
onst
char
*
name
;
int32_t
ttl
;
int8_t
type
;
int32_t
flags
;
tb_uid_t
uid
;
int64_t
ctime
;
c
har
*
name
;
int32_t
ttl
;
int8_t
type
;
union
{
struct
{
tb_uid_t
suid
;
const
uint8_t
*
pTag
;
tb_uid_t
suid
;
uint8_t
*
pTag
;
}
ctb
;
struct
{
SSchemaWrapper
schema
;
...
...
@@ -1777,8 +1777,8 @@ int32_t tDeserializeSVCreateTbBatchRsp(void* buf, int32_t bufLen, SVCreateTbBatc
// TDMT_VND_DROP_TABLE =================
typedef
struct
{
c
onst
char
*
name
;
int8_t
igNotExists
;
c
har
*
name
;
int8_t
igNotExists
;
}
SVDropTbReq
;
typedef
struct
{
...
...
@@ -1809,9 +1809,9 @@ int32_t tDecodeSVDropTbBatchRsp(SDecoder* pCoder, SVDropTbBatchRsp* pRsp);
// TDMT_VND_ALTER_TABLE =====================
typedef
struct
{
c
onst
char
*
tbName
;
int8_t
action
;
c
onst
char
*
colName
;
c
har
*
tbName
;
int8_t
action
;
c
har
*
colName
;
// TSDB_ALTER_TABLE_ADD_COLUMN
int8_t
type
;
int8_t
flags
;
...
...
@@ -1820,17 +1820,17 @@ typedef struct {
// TSDB_ALTER_TABLE_UPDATE_COLUMN_BYTES
int32_t
colModBytes
;
// TSDB_ALTER_TABLE_UPDATE_COLUMN_NAME
c
onst
c
har
*
colNewName
;
char
*
colNewName
;
// TSDB_ALTER_TABLE_UPDATE_TAG_VAL
c
onst
c
har
*
tagName
;
int8_t
isNull
;
uint32_t
nTagVal
;
const
uint8_t
*
pTagVal
;
char
*
tagName
;
int8_t
isNull
;
uint32_t
nTagVal
;
uint8_t
*
pTagVal
;
// TSDB_ALTER_TABLE_UPDATE_OPTIONS
int8_t
updateTTL
;
int32_t
newTTL
;
int8_t
updateComment
;
c
onst
char
*
newComment
;
int8_t
updateTTL
;
int32_t
newTTL
;
int8_t
updateComment
;
c
har
*
newComment
;
}
SVAlterTbReq
;
int32_t
tEncodeSVAlterTbReq
(
SEncoder
*
pEncoder
,
const
SVAlterTbReq
*
pReq
);
...
...
@@ -2020,7 +2020,7 @@ static FORCE_INLINE void tFreeClientHbBatchRsp(void* pRsp) {
int32_t
tSerializeSClientHbBatchRsp
(
void
*
buf
,
int32_t
bufLen
,
const
SClientHbBatchRsp
*
pBatchRsp
);
int32_t
tDeserializeSClientHbBatchRsp
(
void
*
buf
,
int32_t
bufLen
,
SClientHbBatchRsp
*
pBatchRsp
);
void
tFreeSClientHbBatchRsp
(
SClientHbBatchRsp
*
pBatchRsp
);
void
tFreeSClientHbBatchRsp
(
SClientHbBatchRsp
*
pBatchRsp
);
static
FORCE_INLINE
int32_t
tEncodeSKv
(
SEncoder
*
pEncoder
,
const
SKv
*
pKv
)
{
if
(
tEncodeI32
(
pEncoder
,
pKv
->
key
)
<
0
)
return
-
1
;
...
...
@@ -2255,20 +2255,20 @@ int32_t tSerializeSMDropSmaReq(void* buf, int32_t bufLen, SMDropSmaReq* pReq);
int32_t
tDeserializeSMDropSmaReq
(
void
*
buf
,
int32_t
bufLen
,
SMDropSmaReq
*
pReq
);
typedef
struct
{
int8_t
version
;
// for compatibility(default 0)
int8_t
intervalUnit
;
// MACRO: TIME_UNIT_XXX
int8_t
slidingUnit
;
// MACRO: TIME_UNIT_XXX
int8_t
timezoneInt
;
// sma data expired if timezone changes.
char
indexName
[
TSDB_INDEX_NAME_LEN
];
int32_t
exprLen
;
int32_t
tagsFilterLen
;
int64_t
indexUid
;
tb_uid_t
tableUid
;
// super/child/common table uid
int64_t
interval
;
int64_t
offset
;
// use unit by precision of DB
int64_t
sliding
;
c
onst
char
*
expr
;
// sma expression
c
onst
char
*
tagsFilter
;
int8_t
version
;
// for compatibility(default 0)
int8_t
intervalUnit
;
// MACRO: TIME_UNIT_XXX
int8_t
slidingUnit
;
// MACRO: TIME_UNIT_XXX
int8_t
timezoneInt
;
// sma data expired if timezone changes.
char
indexName
[
TSDB_INDEX_NAME_LEN
];
int32_t
exprLen
;
int32_t
tagsFilterLen
;
int64_t
indexUid
;
tb_uid_t
tableUid
;
// super/child/common table uid
int64_t
interval
;
int64_t
offset
;
// use unit by precision of DB
int64_t
sliding
;
c
har
*
expr
;
// sma expression
c
har
*
tagsFilter
;
}
STSma
;
// Time-range-wise SMA
typedef
STSma
SVCreateTSmaReq
;
...
...
@@ -2596,12 +2596,12 @@ static FORCE_INLINE void tDeleteSMqAskEpRsp(SMqAskEpRsp* pRsp) {
#define TD_AUTO_CREATE_TABLE 0x1
typedef
struct
{
int64_t
suid
;
int64_t
uid
;
int32_t
sver
;
uint32_t
nData
;
const
uint8_t
*
pData
;
SVCreateTbReq
cTbReq
;
int64_t
suid
;
int64_t
uid
;
int32_t
sver
;
uint32_t
nData
;
uint8_t
*
pData
;
SVCreateTbReq
cTbReq
;
}
SVSubmitBlk
;
typedef
struct
{
...
...
include/util/tencode.h
浏览文件 @
0122fd12
...
...
@@ -39,11 +39,11 @@ typedef struct {
}
SEncoder
;
typedef
struct
{
const
uint8_t
*
data
;
uint32_t
size
;
uint32_t
pos
;
SCoderMem
*
mList
;
SDecoderNode
*
dStack
;
uint8_t
*
data
;
uint32_t
size
;
uint32_t
pos
;
SCoderMem
*
mList
;
SDecoderNode
*
dStack
;
}
SDecoder
;
#define tPut(TYPE, BUF, VAL) ((TYPE*)(BUF))[0] = (VAL)
...
...
@@ -120,7 +120,7 @@ static int32_t tEncodeCStrWithLen(SEncoder* pCoder, const char* val, uint32_t le
static
int32_t
tEncodeCStr
(
SEncoder
*
pCoder
,
const
char
*
val
);
/* ------------------------ DECODE ------------------------ */
void
tDecoderInit
(
SDecoder
*
pCoder
,
const
uint8_t
*
data
,
uint32_t
size
);
void
tDecoderInit
(
SDecoder
*
pCoder
,
uint8_t
*
data
,
uint32_t
size
);
void
tDecoderClear
(
SDecoder
*
SDecoder
);
int32_t
tStartDecode
(
SDecoder
*
pCoder
);
void
tEndDecode
(
SDecoder
*
pCoder
);
...
...
@@ -141,9 +141,9 @@ static int32_t tDecodeU64v(SDecoder* pCoder, uint64_t* val);
static
int32_t
tDecodeI64v
(
SDecoder
*
pCoder
,
int64_t
*
val
);
static
int32_t
tDecodeFloat
(
SDecoder
*
pCoder
,
float
*
val
);
static
int32_t
tDecodeDouble
(
SDecoder
*
pCoder
,
double
*
val
);
static
int32_t
tDecodeBinary
(
SDecoder
*
pCoder
,
const
uint8_t
**
val
,
uint32_t
*
len
);
static
int32_t
tDecodeCStrAndLen
(
SDecoder
*
pCoder
,
c
onst
c
har
**
val
,
uint32_t
*
len
);
static
int32_t
tDecodeCStr
(
SDecoder
*
pCoder
,
c
onst
c
har
**
val
);
static
int32_t
tDecodeBinary
(
SDecoder
*
pCoder
,
uint8_t
**
val
,
uint32_t
*
len
);
static
int32_t
tDecodeCStrAndLen
(
SDecoder
*
pCoder
,
char
**
val
,
uint32_t
*
len
);
static
int32_t
tDecodeCStr
(
SDecoder
*
pCoder
,
char
**
val
);
static
int32_t
tDecodeCStrTo
(
SDecoder
*
pCoder
,
char
*
val
);
/* ------------------------ IMPL ------------------------ */
...
...
@@ -377,7 +377,7 @@ static FORCE_INLINE int32_t tDecodeDouble(SDecoder* pCoder, double* val) {
return
0
;
}
static
FORCE_INLINE
int32_t
tDecodeBinary
(
SDecoder
*
pCoder
,
const
uint8_t
**
val
,
uint32_t
*
len
)
{
static
FORCE_INLINE
int32_t
tDecodeBinary
(
SDecoder
*
pCoder
,
uint8_t
**
val
,
uint32_t
*
len
)
{
if
(
tDecodeU32v
(
pCoder
,
len
)
<
0
)
return
-
1
;
if
(
TD_CODER_CHECK_CAPACITY_FAILED
(
pCoder
,
*
len
))
return
-
1
;
...
...
@@ -389,20 +389,20 @@ static FORCE_INLINE int32_t tDecodeBinary(SDecoder* pCoder, const uint8_t** val,
return
0
;
}
static
FORCE_INLINE
int32_t
tDecodeCStrAndLen
(
SDecoder
*
pCoder
,
c
onst
c
har
**
val
,
uint32_t
*
len
)
{
if
(
tDecodeBinary
(
pCoder
,
(
const
uint8_t
**
)
val
,
len
)
<
0
)
return
-
1
;
static
FORCE_INLINE
int32_t
tDecodeCStrAndLen
(
SDecoder
*
pCoder
,
char
**
val
,
uint32_t
*
len
)
{
if
(
tDecodeBinary
(
pCoder
,
(
uint8_t
**
)
val
,
len
)
<
0
)
return
-
1
;
(
*
len
)
-=
1
;
return
0
;
}
static
FORCE_INLINE
int32_t
tDecodeCStr
(
SDecoder
*
pCoder
,
c
onst
c
har
**
val
)
{
static
FORCE_INLINE
int32_t
tDecodeCStr
(
SDecoder
*
pCoder
,
char
**
val
)
{
uint32_t
len
;
return
tDecodeCStrAndLen
(
pCoder
,
val
,
&
len
);
}
static
int32_t
tDecodeCStrTo
(
SDecoder
*
pCoder
,
char
*
val
)
{
c
onst
char
*
pStr
;
uint32_t
len
;
c
har
*
pStr
;
uint32_t
len
;
if
(
tDecodeCStrAndLen
(
pCoder
,
&
pStr
,
&
len
)
<
0
)
return
-
1
;
memcpy
(
val
,
pStr
,
len
+
1
);
...
...
source/dnode/vnode/inc/vnode.h
浏览文件 @
0122fd12
...
...
@@ -126,7 +126,7 @@ STqReadHandle *tqInitSubmitMsgScanner(SMeta *pMeta);
void
tqReadHandleSetColIdList
(
STqReadHandle
*
pReadHandle
,
SArray
*
pColIdList
);
int32_t
tqReadHandleSetTbUidList
(
STqReadHandle
*
pHandle
,
const
SArray
*
tbUidList
);
int32_t
tqReadHandleAddTbUidList
(
STqReadHandle
*
pHandle
,
const
SArray
*
tbUidList
);
int32_t
tqReadHandleRemoveTbUidList
(
STqReadHandle
*
pHandle
,
const
SArray
*
tbUidList
);
int32_t
tqReadHandleRemoveTbUidList
(
STqReadHandle
*
pHandle
,
const
SArray
*
tbUidList
);
int32_t
tqReadHandleSetMsg
(
STqReadHandle
*
pHandle
,
SSubmitReq
*
pMsg
,
int64_t
ver
);
bool
tqNextDataBlock
(
STqReadHandle
*
pHandle
);
...
...
@@ -174,20 +174,20 @@ typedef struct {
}
STableKeyInfo
;
struct
SMetaEntry
{
int64_t
version
;
int8_t
type
;
tb_uid_t
uid
;
c
onst
char
*
name
;
int64_t
version
;
int8_t
type
;
tb_uid_t
uid
;
c
har
*
name
;
union
{
struct
{
SSchemaWrapper
schema
;
SSchemaWrapper
schemaTag
;
}
stbEntry
;
struct
{
int64_t
ctime
;
int32_t
ttlDays
;
tb_uid_t
suid
;
const
uint8_t
*
pTags
;
int64_t
ctime
;
int32_t
ttlDays
;
tb_uid_t
suid
;
uint8_t
*
pTags
;
}
ctbEntry
;
struct
{
int64_t
ctime
;
...
...
source/dnode/vnode/src/meta/metaTable.c
浏览文件 @
0122fd12
...
...
@@ -30,9 +30,9 @@ int metaCreateSTable(SMeta *pMeta, int64_t version, SVCreateStbReq *pReq) {
int
vLen
=
0
;
const
void
*
pKey
=
NULL
;
const
void
*
pVal
=
NULL
;
void
*
pBuf
=
NULL
;
void
*
pBuf
=
NULL
;
int32_t
szBuf
=
0
;
void
*
p
=
NULL
;
void
*
p
=
NULL
;
SMetaReader
mr
=
{
0
};
// validate req
...
...
@@ -71,9 +71,9 @@ _err:
}
int
metaDropSTable
(
SMeta
*
pMeta
,
int64_t
verison
,
SVDropStbReq
*
pReq
)
{
TBC
*
pNameIdxc
=
NULL
;
TBC
*
pUidIdxc
=
NULL
;
TBC
*
pCtbIdxc
=
NULL
;
TBC
*
pNameIdxc
=
NULL
;
TBC
*
pUidIdxc
=
NULL
;
TBC
*
pCtbIdxc
=
NULL
;
SCtbIdxKey
*
pCtbIdxKey
;
const
void
*
pKey
=
NULL
;
int
nKey
;
...
...
@@ -134,8 +134,8 @@ _err:
int
metaAlterSTable
(
SMeta
*
pMeta
,
int64_t
version
,
SVCreateStbReq
*
pReq
)
{
SMetaEntry
oStbEntry
=
{
0
};
SMetaEntry
nStbEntry
=
{
0
};
TBC
*
pUidIdxc
=
NULL
;
TBC
*
pTbDbc
=
NULL
;
TBC
*
pUidIdxc
=
NULL
;
TBC
*
pTbDbc
=
NULL
;
const
void
*
pData
;
int
nData
;
int64_t
oversion
;
...
...
@@ -165,7 +165,9 @@ int metaAlterSTable(SMeta *pMeta, int64_t version, SVCreateStbReq *pReq) {
ret
=
tdbTbcGet
(
pTbDbc
,
NULL
,
NULL
,
&
pData
,
&
nData
);
ASSERT
(
ret
==
0
);
tDecoderInit
(
&
dc
,
pData
,
nData
);
oStbEntry
.
pBuf
=
taosMemoryMalloc
(
nData
);
memcpy
(
oStbEntry
.
pBuf
,
pData
,
nData
);
tDecoderInit
(
&
dc
,
oStbEntry
.
pBuf
,
nData
);
metaDecodeEntry
(
&
dc
,
&
oStbEntry
);
nStbEntry
.
version
=
version
;
...
...
@@ -193,6 +195,7 @@ int metaAlterSTable(SMeta *pMeta, int64_t version, SVCreateStbReq *pReq) {
// update uid index
tdbTbcUpsert
(
pUidIdxc
,
&
pReq
->
suid
,
sizeof
(
tb_uid_t
),
&
version
,
sizeof
(
version
),
0
);
if
(
oStbEntry
.
pBuf
)
taosMemoryFree
(
oStbEntry
.
pBuf
);
metaULock
(
pMeta
);
tDecoderClear
(
&
dc
);
tdbTbcClose
(
pTbDbc
);
...
...
@@ -256,9 +259,9 @@ _err:
}
int
metaDropTable
(
SMeta
*
pMeta
,
int64_t
version
,
SVDropTbReq
*
pReq
,
SArray
*
tbUids
)
{
TBC
*
pTbDbc
=
NULL
;
TBC
*
pUidIdxc
=
NULL
;
TBC
*
pNameIdxc
=
NULL
;
TBC
*
pTbDbc
=
NULL
;
TBC
*
pUidIdxc
=
NULL
;
TBC
*
pNameIdxc
=
NULL
;
const
void
*
pData
;
int
nData
;
tb_uid_t
uid
;
...
...
@@ -377,14 +380,14 @@ int metaDropTable(SMeta *pMeta, int64_t version, SVDropTbReq *pReq, SArray *tbUi
}
static
int
metaAlterTableColumn
(
SMeta
*
pMeta
,
int64_t
version
,
SVAlterTbReq
*
pAlterTbReq
)
{
void
*
pVal
=
NULL
;
void
*
pVal
=
NULL
;
int
nVal
=
0
;
const
void
*
pData
=
NULL
;
const
void
*
pData
=
NULL
;
int
nData
=
0
;
int
ret
=
0
;
tb_uid_t
uid
;
int64_t
oversion
;
SSchema
*
pColumn
=
NULL
;
SSchema
*
pColumn
=
NULL
;
SMetaEntry
entry
=
{
0
};
SSchemaWrapper
*
pSchema
;
int
c
;
...
...
@@ -420,7 +423,9 @@ static int metaAlterTableColumn(SMeta *pMeta, int64_t version, SVAlterTbReq *pAl
// get table entry
SDecoder
dc
=
{
0
};
tDecoderInit
(
&
dc
,
pData
,
nData
);
entry
.
pBuf
=
taosMemoryMalloc
(
nData
);
memcpy
(
entry
.
pBuf
,
pData
,
nData
);
tDecoderInit
(
&
dc
,
entry
.
pBuf
,
nData
);
ret
=
metaDecodeEntry
(
&
dc
,
&
entry
);
ASSERT
(
ret
==
0
);
...
...
@@ -530,7 +535,7 @@ _err:
static
int
metaUpdateTableTagVal
(
SMeta
*
pMeta
,
int64_t
version
,
SVAlterTbReq
*
pAlterTbReq
)
{
SMetaEntry
ctbEntry
=
{
0
};
SMetaEntry
stbEntry
=
{
0
};
void
*
pVal
=
NULL
;
void
*
pVal
=
NULL
;
int
nVal
=
0
;
int
ret
;
int
c
;
...
...
@@ -561,7 +566,7 @@ static int metaUpdateTableTagVal(SMeta *pMeta, int64_t version, SVAlterTbReq *pA
oversion
=
*
(
int64_t
*
)
pData
;
// search table.db
TBC
*
pTbDbc
=
NULL
;
TBC
*
pTbDbc
=
NULL
;
SDecoder
dc1
=
{
0
};
SDecoder
dc2
=
{
0
};
...
...
@@ -585,7 +590,7 @@ static int metaUpdateTableTagVal(SMeta *pMeta, int64_t version, SVAlterTbReq *pA
metaDecodeEntry
(
&
dc2
,
&
stbEntry
);
SSchemaWrapper
*
pTagSchema
=
&
stbEntry
.
stbEntry
.
schemaTag
;
SSchema
*
pColumn
=
NULL
;
SSchema
*
pColumn
=
NULL
;
int32_t
iCol
=
0
;
for
(;;)
{
pColumn
=
NULL
;
...
...
@@ -681,8 +686,8 @@ int metaAlterTable(SMeta *pMeta, int64_t version, SVAlterTbReq *pReq) {
static
int
metaSaveToTbDb
(
SMeta
*
pMeta
,
const
SMetaEntry
*
pME
)
{
STbDbKey
tbDbKey
;
void
*
pKey
=
NULL
;
void
*
pVal
=
NULL
;
void
*
pKey
=
NULL
;
void
*
pVal
=
NULL
;
int
kLen
=
0
;
int
vLen
=
0
;
SEncoder
coder
=
{
0
};
...
...
@@ -797,14 +802,14 @@ static void metaDestroyTagIdxKey(STagIdxKey *pTagIdxKey) {
}
static
int
metaUpdateTagIdx
(
SMeta
*
pMeta
,
const
SMetaEntry
*
pCtbEntry
)
{
void
*
pData
=
NULL
;
void
*
pData
=
NULL
;
int
nData
=
0
;
STbDbKey
tbDbKey
=
{
0
};
SMetaEntry
stbEntry
=
{
0
};
STagIdxKey
*
pTagIdxKey
=
NULL
;
STagIdxKey
*
pTagIdxKey
=
NULL
;
int32_t
nTagIdxKey
;
const
SSchema
*
pTagColumn
;
// = &stbEntry.stbEntry.schema.pSchema[0];
const
void
*
pTagData
=
NULL
;
//
const
void
*
pTagData
=
NULL
;
//
SDecoder
dc
=
{
0
};
// get super table
...
...
@@ -846,7 +851,7 @@ static int metaUpdateTagIdx(SMeta *pMeta, const SMetaEntry *pCtbEntry) {
static
int
metaSaveToSkmDb
(
SMeta
*
pMeta
,
const
SMetaEntry
*
pME
)
{
SEncoder
coder
=
{
0
};
void
*
pVal
=
NULL
;
void
*
pVal
=
NULL
;
int
vLen
=
0
;
int
rcode
=
0
;
SSkmDbKey
skmDbKey
=
{
0
};
...
...
source/dnode/vnode/src/tsdb/tsdbMemTable2.c
浏览文件 @
0122fd12
...
...
@@ -38,7 +38,7 @@ struct SMemTable {
struct
SMemSkipListNode
{
int8_t
level
;
SMemSkipListNode
*
forwards
[
1
];
// Windows does not allow 0
SMemSkipListNode
*
forwards
[
1
];
// Windows does not allow 0
};
struct
SMemSkipList
{
...
...
@@ -46,7 +46,7 @@ struct SMemSkipList {
int8_t
maxLevel
;
int8_t
level
;
int32_t
size
;
SMemSkipListNode
pHead
[
1
];
// Windows does not allow 0
SMemSkipListNode
pHead
[
1
];
// Windows does not allow 0
};
struct
SMemData
{
...
...
@@ -217,7 +217,7 @@ int32_t tsdbInsertData2(SMemTable *pMemTb, int64_t version, const SVSubmitBlk *p
if
(
tDecodeIsEnd
(
&
dc
))
break
;
// decode row
if
(
tDecodeBinary
(
&
dc
,
(
const
uint8_t
**
)
&
tRow
.
pRow
,
&
tRow
.
szRow
)
<
0
)
{
if
(
tDecodeBinary
(
&
dc
,
(
uint8_t
**
)
&
tRow
.
pRow
,
&
tRow
.
szRow
)
<
0
)
{
terrno
=
TSDB_CODE_INVALID_MSG
;
return
-
1
;
}
...
...
@@ -273,7 +273,7 @@ static FORCE_INLINE int32_t tsdbEncodeRow(SEncoder *pEncoder, const STsdbRow *pR
static
FORCE_INLINE
int32_t
tsdbDecodeRow
(
SDecoder
*
pDecoder
,
STsdbRow
*
pRow
)
{
if
(
tDecodeI64
(
pDecoder
,
&
pRow
->
version
)
<
0
)
return
-
1
;
if
(
tDecodeBinary
(
pDecoder
,
(
const
uint8_t
**
)
&
pRow
->
pRow
,
&
pRow
->
szRow
)
<
0
)
return
-
1
;
if
(
tDecodeBinary
(
pDecoder
,
(
uint8_t
**
)
&
pRow
->
pRow
,
&
pRow
->
szRow
)
<
0
)
return
-
1
;
return
0
;
}
...
...
source/libs/parser/test/parInitialATest.cpp
浏览文件 @
0122fd12
...
...
@@ -204,7 +204,7 @@ TEST_F(ParserInitialATest, alterTable) {
}
};
auto
setAlterTagFunc
=
[
&
](
const
char
*
pTbname
,
const
char
*
pTagName
,
const
uint8_t
*
pNewVal
,
uint32_t
bytes
)
{
auto
setAlterTagFunc
=
[
&
](
const
char
*
pTbname
,
const
char
*
pTagName
,
uint8_t
*
pNewVal
,
uint32_t
bytes
)
{
memset
(
&
expect
,
0
,
sizeof
(
SVAlterTbReq
));
expect
.
tbName
=
strdup
(
pTbname
);
expect
.
action
=
TSDB_ALTER_TABLE_UPDATE_TAG_VAL
;
...
...
@@ -215,7 +215,7 @@ TEST_F(ParserInitialATest, alterTable) {
expect
.
pTagVal
=
pNewVal
;
};
auto
setAlterOptionsFunc
=
[
&
](
const
char
*
pTbname
,
int32_t
ttl
,
c
onst
c
har
*
pComment
=
nullptr
)
{
auto
setAlterOptionsFunc
=
[
&
](
const
char
*
pTbname
,
int32_t
ttl
,
char
*
pComment
=
nullptr
)
{
memset
(
&
expect
,
0
,
sizeof
(
SVAlterTbReq
));
expect
.
tbName
=
strdup
(
pTbname
);
expect
.
action
=
TSDB_ALTER_TABLE_UPDATE_OPTIONS
;
...
...
@@ -240,7 +240,7 @@ TEST_F(ParserInitialATest, alterTable) {
void
*
pBuf
=
POINTER_SHIFT
(
pVgData
->
pData
,
sizeof
(
SMsgHead
));
SVAlterTbReq
req
=
{
0
};
SDecoder
coder
=
{
0
};
tDecoderInit
(
&
coder
,
(
const
uint8_t
*
)
pBuf
,
pVgData
->
size
);
tDecoderInit
(
&
coder
,
(
uint8_t
*
)
pBuf
,
pVgData
->
size
);
ASSERT_EQ
(
tDecodeSVAlterTbReq
(
&
coder
,
&
req
),
TSDB_CODE_SUCCESS
);
ASSERT_EQ
(
std
::
string
(
req
.
tbName
),
std
::
string
(
expect
.
tbName
));
...
...
@@ -274,7 +274,7 @@ TEST_F(ParserInitialATest, alterTable) {
setAlterOptionsFunc
(
"t1"
,
10
,
nullptr
);
run
(
"ALTER TABLE t1 TTL 10"
);
setAlterOptionsFunc
(
"t1"
,
-
1
,
"test"
);
setAlterOptionsFunc
(
"t1"
,
-
1
,
(
char
*
)
"test"
);
run
(
"ALTER TABLE t1 COMMENT 'test'"
);
setAlterColFunc
(
"t1"
,
TSDB_ALTER_TABLE_ADD_COLUMN
,
"cc1"
,
TSDB_DATA_TYPE_BIGINT
);
...
...
@@ -290,7 +290,7 @@ TEST_F(ParserInitialATest, alterTable) {
run
(
"ALTER TABLE t1 RENAME COLUMN c1 cc1"
);
int32_t
val
=
10
;
setAlterTagFunc
(
"st1s1"
,
"tag1"
,
(
const
uint8_t
*
)
&
val
,
sizeof
(
val
));
setAlterTagFunc
(
"st1s1"
,
"tag1"
,
(
uint8_t
*
)
&
val
,
sizeof
(
val
));
run
(
"ALTER TABLE st1s1 SET TAG tag1=10"
);
// todo
...
...
source/libs/sync/src/syncMessage.c
浏览文件 @
0122fd12
...
...
@@ -411,7 +411,7 @@ SyncPing* syncPingDeserialize3(void* buf, int32_t bufLen) {
}
uint32_t
len
;
char
*
data
=
NULL
;
if
(
tDecodeBinary
(
&
decoder
,
(
const
uint8_t
**
)(
&
data
),
&
len
)
<
0
)
{
if
(
tDecodeBinary
(
&
decoder
,
(
uint8_t
**
)(
&
data
),
&
len
)
<
0
)
{
return
NULL
;
}
assert
(
len
=
pMsg
->
dataLen
);
...
...
@@ -670,7 +670,7 @@ SyncPingReply* syncPingReplyDeserialize3(void* buf, int32_t bufLen) {
}
uint32_t
len
;
char
*
data
=
NULL
;
if
(
tDecodeBinary
(
&
decoder
,
(
const
uint8_t
**
)(
&
data
),
&
len
)
<
0
)
{
if
(
tDecodeBinary
(
&
decoder
,
(
uint8_t
**
)(
&
data
),
&
len
)
<
0
)
{
return
NULL
;
}
assert
(
len
=
pMsg
->
dataLen
);
...
...
source/util/src/tencode.c
浏览文件 @
0122fd12
...
...
@@ -29,10 +29,10 @@ struct SEncoderNode {
};
struct
SDecoderNode
{
SDecoderNode
*
pNext
;
const
uint8_t
*
data
;
uint32_t
size
;
uint32_t
pos
;
SDecoderNode
*
pNext
;
uint8_t
*
data
;
uint32_t
size
;
uint32_t
pos
;
};
void
tEncoderInit
(
SEncoder
*
pEncoder
,
uint8_t
*
data
,
uint32_t
size
)
{
...
...
@@ -52,7 +52,7 @@ void tEncoderClear(SEncoder* pCoder) {
memset
(
pCoder
,
0
,
sizeof
(
*
pCoder
));
}
void
tDecoderInit
(
SDecoder
*
pDecoder
,
const
uint8_t
*
data
,
uint32_t
size
)
{
void
tDecoderInit
(
SDecoder
*
pDecoder
,
uint8_t
*
data
,
uint32_t
size
)
{
pDecoder
->
data
=
data
;
pDecoder
->
size
=
size
;
pDecoder
->
pos
=
0
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录