Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
3d972f81
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看板
提交
3d972f81
编写于
4月 24, 2022
作者:
L
Liu Jicong
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
refacor(wal): rename len to bodyLen
上级
d16a2e27
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
32 addition
and
31 deletion
+32
-31
include/common/tmsg.h
include/common/tmsg.h
+10
-11
include/libs/wal/wal.h
include/libs/wal/wal.h
+1
-1
source/dnode/mnode/impl/src/mndOffset.c
source/dnode/mnode/impl/src/mndOffset.c
+1
-1
source/libs/sync/src/syncRaftLog.c
source/libs/sync/src/syncRaftLog.c
+4
-4
source/libs/wal/inc/walInt.h
source/libs/wal/inc/walInt.h
+4
-4
source/libs/wal/src/walRead.c
source/libs/wal/src/walRead.c
+8
-6
source/libs/wal/src/walWrite.c
source/libs/wal/src/walWrite.c
+1
-1
source/libs/wal/test/walMetaTest.cpp
source/libs/wal/test/walMetaTest.cpp
+3
-3
未找到文件。
include/common/tmsg.h
浏览文件 @
3d972f81
...
...
@@ -491,7 +491,7 @@ typedef struct {
char
intervalUnit
;
char
slidingUnit
;
char
offsetUnit
;
// TODO Remove it, the offset is the number of precision tickle, and it must be a immutable duration.
offsetUnit
;
// TODO Remove it, the offset is the number of precision tickle, and it must be a immutable duration.
int8_t
precision
;
int64_t
interval
;
int64_t
sliding
;
...
...
@@ -651,7 +651,6 @@ typedef struct SQueryNodeAddr {
SEpSet
epSet
;
}
SQueryNodeAddr
;
typedef
struct
{
SArray
*
pArray
;
// Array of SUseDbRsp
}
SUseDbBatchRsp
;
...
...
@@ -724,7 +723,7 @@ typedef struct {
int32_t
tSerializeSRetrieveFuncRsp
(
void
*
buf
,
int32_t
bufLen
,
SRetrieveFuncRsp
*
pRsp
);
int32_t
tDeserializeSRetrieveFuncRsp
(
void
*
buf
,
int32_t
bufLen
,
SRetrieveFuncRsp
*
pRsp
);
void
tFreeSFuncInfo
(
SFuncInfo
*
pInfo
);
void
tFreeSFuncInfo
(
SFuncInfo
*
pInfo
);
void
tFreeSRetrieveFuncRsp
(
SRetrieveFuncRsp
*
pRsp
);
typedef
struct
{
...
...
@@ -1289,14 +1288,14 @@ typedef struct {
}
SMVCreateStreamRsp
,
SMSCreateStreamRsp
;
typedef
struct
{
char
name
[
TSDB_TOPIC_FNAME_LEN
];
// accout.topic
int8_t
igExists
;
int8_t
withTbName
;
int8_t
withSchema
;
int8_t
withTag
;
char
*
sql
;
char
*
ast
;
char
subscribeDbName
[
TSDB_DB_NAME_LEN
];
char
name
[
TSDB_TOPIC_FNAME_LEN
];
// accout.topic
int8_t
igExists
;
int8_t
withTbName
;
int8_t
withSchema
;
int8_t
withTag
;
char
*
sql
;
char
*
ast
;
char
subscribeDbName
[
TSDB_DB_NAME_LEN
];
}
SCMCreateTopicReq
;
int32_t
tSerializeSCMCreateTopicReq
(
void
*
buf
,
int32_t
bufLen
,
const
SCMCreateTopicReq
*
pReq
);
...
...
include/libs/wal/wal.h
浏览文件 @
3d972f81
...
...
@@ -92,7 +92,7 @@ typedef struct SWalReadHead {
int8_t
headVer
;
int8_t
reserved
;
int16_t
msgType
;
int32_t
l
en
;
int32_t
bodyL
en
;
int64_t
ingestTs
;
// not implemented
int64_t
version
;
...
...
source/dnode/mnode/impl/src/mndOffset.c
浏览文件 @
3d972f81
...
...
@@ -172,7 +172,7 @@ static int32_t mndProcessCommitOffsetReq(SNodeMsg *pMsg) {
bool
create
=
false
;
SMqOffsetObj
*
pOffsetObj
=
mndAcquireOffset
(
pMnode
,
key
);
if
(
pOffsetObj
==
NULL
)
{
pOffsetObj
=
taosMemoryMalloc
(
sizeof
(
SMqOffset
));
pOffsetObj
=
taosMemoryMalloc
(
sizeof
(
SMqOffset
Obj
));
memcpy
(
pOffsetObj
->
key
,
key
,
TSDB_PARTITION_KEY_LEN
);
create
=
true
;
}
...
...
source/libs/sync/src/syncRaftLog.c
浏览文件 @
3d972f81
...
...
@@ -71,7 +71,7 @@ SSyncRaftEntry* logStoreGetEntry(SSyncLogStore* pLogStore, SyncIndex index) {
SWalReadHandle
*
pWalHandle
=
walOpenReadHandle
(
pWal
);
assert
(
walReadWithHandle
(
pWalHandle
,
index
)
==
0
);
SSyncRaftEntry
*
pEntry
=
syncEntryBuild
(
pWalHandle
->
pHead
->
head
.
l
en
);
SSyncRaftEntry
*
pEntry
=
syncEntryBuild
(
pWalHandle
->
pHead
->
head
.
bodyL
en
);
assert
(
pEntry
!=
NULL
);
pEntry
->
msgType
=
TDMT_VND_SYNC_CLIENT_REQUEST
;
...
...
@@ -80,8 +80,8 @@ SSyncRaftEntry* logStoreGetEntry(SSyncLogStore* pLogStore, SyncIndex index) {
pEntry
->
isWeak
=
pWalHandle
->
pHead
->
head
.
syncMeta
.
isWeek
;
pEntry
->
term
=
pWalHandle
->
pHead
->
head
.
syncMeta
.
term
;
pEntry
->
index
=
index
;
assert
(
pEntry
->
dataLen
==
pWalHandle
->
pHead
->
head
.
l
en
);
memcpy
(
pEntry
->
data
,
pWalHandle
->
pHead
->
head
.
body
,
pWalHandle
->
pHead
->
head
.
l
en
);
assert
(
pEntry
->
dataLen
==
pWalHandle
->
pHead
->
head
.
bodyL
en
);
memcpy
(
pEntry
->
data
,
pWalHandle
->
pHead
->
head
.
body
,
pWalHandle
->
pHead
->
head
.
bodyL
en
);
// need to hold, do not new every time!!
walCloseReadHandle
(
pWalHandle
);
...
...
@@ -257,4 +257,4 @@ void logStoreSimpleLog2(char* s, SSyncLogStore* pLogStore) {
char
*
serialized
=
logStoreSimple2Str
(
pLogStore
);
sTrace
(
"logStoreSimpleLog2 | len:%lu | %s | %s"
,
strlen
(
serialized
),
s
,
serialized
);
taosMemoryFree
(
serialized
);
}
\ No newline at end of file
}
source/libs/wal/inc/walInt.h
浏览文件 @
3d972f81
...
...
@@ -16,10 +16,10 @@
#ifndef _TD_WAL_INT_H_
#define _TD_WAL_INT_H_
#include "tcompare.h"
#include "taoserror.h"
#include "tchecksum.h"
#include "tcoding.h"
#include "tcompare.h"
#include "wal.h"
#ifdef __cplusplus
...
...
@@ -41,10 +41,10 @@ typedef struct WalIdxEntry {
}
SWalIdxEntry
;
static
inline
int
tSerializeWalIdxEntry
(
void
**
buf
,
SWalIdxEntry
*
pIdxEntry
)
{
int
tlen
;
int
tlen
=
0
;
tlen
+=
taosEncodeFixedI64
(
buf
,
pIdxEntry
->
ver
);
tlen
+=
taosEncodeFixedI64
(
buf
,
pIdxEntry
->
offset
);
return
0
;
return
tlen
;
}
static
inline
void
*
tDeserializeWalIdxEntry
(
void
*
buf
,
SWalIdxEntry
*
pIdxEntry
)
{
...
...
@@ -103,7 +103,7 @@ static inline int walValidHeadCksum(SWalHead* pHead) {
}
static
inline
int
walValidBodyCksum
(
SWalHead
*
pHead
)
{
return
taosCheckChecksum
((
uint8_t
*
)
pHead
->
head
.
body
,
pHead
->
head
.
l
en
,
pHead
->
cksumBody
);
return
taosCheckChecksum
((
uint8_t
*
)
pHead
->
head
.
body
,
pHead
->
head
.
bodyL
en
,
pHead
->
cksumBody
);
}
static
inline
int
walValidCksum
(
SWalHead
*
pHead
,
void
*
body
,
int64_t
bodyLen
)
{
...
...
source/libs/wal/src/walRead.c
浏览文件 @
3d972f81
...
...
@@ -144,12 +144,12 @@ int32_t walReadWithHandle_s(SWalReadHandle *pRead, int64_t ver, SWalReadHead **p
taosThreadMutexUnlock
(
&
pRead
->
mutex
);
return
-
1
;
}
*
ppHead
=
taosMemoryMalloc
(
sizeof
(
SWalReadHead
)
+
pRead
->
pHead
->
head
.
l
en
);
*
ppHead
=
taosMemoryMalloc
(
sizeof
(
SWalReadHead
)
+
pRead
->
pHead
->
head
.
bodyL
en
);
if
(
*
ppHead
==
NULL
)
{
taosThreadMutexUnlock
(
&
pRead
->
mutex
);
return
-
1
;
}
memcpy
(
*
ppHead
,
&
pRead
->
pHead
->
head
,
sizeof
(
SWalReadHead
)
+
pRead
->
pHead
->
head
.
l
en
);
memcpy
(
*
ppHead
,
&
pRead
->
pHead
->
head
,
sizeof
(
SWalReadHead
)
+
pRead
->
pHead
->
head
.
bodyL
en
);
taosThreadMutexUnlock
(
&
pRead
->
mutex
);
return
0
;
}
...
...
@@ -178,16 +178,18 @@ int32_t walReadWithHandle(SWalReadHandle *pRead, int64_t ver) {
terrno
=
TSDB_CODE_WAL_FILE_CORRUPTED
;
return
-
1
;
}
if
(
pRead
->
capacity
<
pRead
->
pHead
->
head
.
l
en
)
{
void
*
ptr
=
taosMemoryRealloc
(
pRead
->
pHead
,
sizeof
(
SWalHead
)
+
pRead
->
pHead
->
head
.
l
en
);
if
(
pRead
->
capacity
<
pRead
->
pHead
->
head
.
bodyL
en
)
{
void
*
ptr
=
taosMemoryRealloc
(
pRead
->
pHead
,
sizeof
(
SWalHead
)
+
pRead
->
pHead
->
head
.
bodyL
en
);
if
(
ptr
==
NULL
)
{
terrno
=
TSDB_CODE_WAL_OUT_OF_MEMORY
;
return
-
1
;
}
pRead
->
pHead
=
ptr
;
pRead
->
capacity
=
pRead
->
pHead
->
head
.
l
en
;
pRead
->
capacity
=
pRead
->
pHead
->
head
.
bodyL
en
;
}
if
(
pRead
->
pHead
->
head
.
len
!=
taosReadFile
(
pRead
->
pReadLogTFile
,
pRead
->
pHead
->
head
.
body
,
pRead
->
pHead
->
head
.
len
))
{
if
(
pRead
->
pHead
->
head
.
bodyLen
!=
taosReadFile
(
pRead
->
pReadLogTFile
,
pRead
->
pHead
->
head
.
body
,
pRead
->
pHead
->
head
.
bodyLen
))
{
return
-
1
;
}
...
...
source/libs/wal/src/walWrite.c
浏览文件 @
3d972f81
...
...
@@ -295,7 +295,7 @@ int64_t walWriteWithSyncInfo(SWal *pWal, int64_t index, tmsg_t msgType, SSyncLog
pWal
->
writeHead
.
head
.
version
=
index
;
int64_t
offset
=
walGetCurFileOffset
(
pWal
);
pWal
->
writeHead
.
head
.
l
en
=
bodyLen
;
pWal
->
writeHead
.
head
.
bodyL
en
=
bodyLen
;
pWal
->
writeHead
.
head
.
msgType
=
msgType
;
// sync info
...
...
source/libs/wal/test/walMetaTest.cpp
浏览文件 @
3d972f81
...
...
@@ -320,7 +320,7 @@ TEST_F(WalKeepEnv, readHandleRead) {
char
newStr
[
100
];
sprintf
(
newStr
,
"%s-%d"
,
ranStr
,
ver
);
int
len
=
strlen
(
newStr
);
ASSERT_EQ
(
pRead
->
pHead
->
head
.
l
en
,
len
);
ASSERT_EQ
(
pRead
->
pHead
->
head
.
bodyL
en
,
len
);
for
(
int
j
=
0
;
j
<
len
;
j
++
)
{
EXPECT_EQ
(
newStr
[
j
],
pRead
->
pHead
->
head
.
body
[
j
]);
}
...
...
@@ -372,7 +372,7 @@ TEST_F(WalRetentionEnv, repairMeta1) {
char
newStr
[
100
];
sprintf
(
newStr
,
"%s-%d"
,
ranStr
,
ver
);
int
len
=
strlen
(
newStr
);
ASSERT_EQ
(
pRead
->
pHead
->
head
.
l
en
,
len
);
ASSERT_EQ
(
pRead
->
pHead
->
head
.
bodyL
en
,
len
);
for
(
int
j
=
0
;
j
<
len
;
j
++
)
{
EXPECT_EQ
(
newStr
[
j
],
pRead
->
pHead
->
head
.
body
[
j
]);
}
...
...
@@ -402,7 +402,7 @@ TEST_F(WalRetentionEnv, repairMeta1) {
char
newStr
[
100
];
sprintf
(
newStr
,
"%s-%d"
,
ranStr
,
ver
);
int
len
=
strlen
(
newStr
);
ASSERT_EQ
(
pRead
->
pHead
->
head
.
l
en
,
len
);
ASSERT_EQ
(
pRead
->
pHead
->
head
.
bodyL
en
,
len
);
for
(
int
j
=
0
;
j
<
len
;
j
++
)
{
EXPECT_EQ
(
newStr
[
j
],
pRead
->
pHead
->
head
.
body
[
j
]);
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录