Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
2ae64cdf
T
TDengine
项目概览
taosdata
/
TDengine
大约 1 年 前同步成功
通知
1184
Star
22015
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,发现更多精彩内容 >>
提交
2ae64cdf
编写于
5月 08, 2023
作者:
K
kailixu
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'fix/TD-23623' of github.com:taosdata/TDengine into fix/TD-23623
上级
b156fada
2eec3957
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
55 addition
and
11 deletion
+55
-11
source/dnode/vnode/src/inc/tsdb.h
source/dnode/vnode/src/inc/tsdb.h
+1
-0
source/dnode/vnode/src/inc/vnodeInt.h
source/dnode/vnode/src/inc/vnodeInt.h
+3
-2
source/dnode/vnode/src/tsdb/tsdbCache.c
source/dnode/vnode/src/tsdb/tsdbCache.c
+46
-7
source/dnode/vnode/src/vnd/vnodeCommit.c
source/dnode/vnode/src/vnd/vnodeCommit.c
+5
-2
未找到文件。
source/dnode/vnode/src/inc/tsdb.h
浏览文件 @
2ae64cdf
...
...
@@ -346,6 +346,7 @@ struct STsdbFS {
typedef
struct
{
rocksdb_t
*
db
;
rocksdb_options_t
*
options
;
rocksdb_flushoptions_t
*
flushoptions
;
rocksdb_writeoptions_t
*
writeoptions
;
rocksdb_readoptions_t
*
readoptions
;
rocksdb_writebatch_t
*
writebatch
;
...
...
source/dnode/vnode/src/inc/vnodeInt.h
浏览文件 @
2ae64cdf
...
...
@@ -178,6 +178,7 @@ int tsdbClose(STsdb** pTsdb);
int32_t
tsdbBegin
(
STsdb
*
pTsdb
);
int32_t
tsdbPrepareCommit
(
STsdb
*
pTsdb
);
int32_t
tsdbCommit
(
STsdb
*
pTsdb
,
SCommitInfo
*
pInfo
);
int32_t
tsdbCacheCommit
(
STsdb
*
pTsdb
);
int32_t
tsdbCompact
(
STsdb
*
pTsdb
,
SCompactInfo
*
pInfo
);
int32_t
tsdbFinishCommit
(
STsdb
*
pTsdb
);
int32_t
tsdbRollbackCommit
(
STsdb
*
pTsdb
);
...
...
@@ -194,9 +195,9 @@ STQ* tqOpen(const char* path, SVnode* pVnode);
void
tqClose
(
STQ
*
);
int
tqPushMsg
(
STQ
*
,
void
*
msg
,
int32_t
msgLen
,
tmsg_t
msgType
,
int64_t
ver
);
int
tqRegisterPushHandle
(
STQ
*
pTq
,
void
*
pHandle
,
const
SMqPollReq
*
pRequest
,
SRpcMsg
*
pRpcMsg
,
SMqDataRsp
*
pDataRsp
,
int32_t
type
);
int32_t
type
);
int
tqUnregisterPushHandle
(
STQ
*
pTq
,
const
char
*
pKey
,
int32_t
keyLen
,
uint64_t
consumerId
,
bool
rspConsumer
);
int
tqStartStreamTasks
(
STQ
*
pTq
);
// restore all stream tasks after vnode launching completed.
int
tqStartStreamTasks
(
STQ
*
pTq
);
// restore all stream tasks after vnode launching completed.
int
tqCommit
(
STQ
*
);
int32_t
tqUpdateTbUidList
(
STQ
*
pTq
,
const
SArray
*
tbUidList
,
bool
isAdd
);
...
...
source/dnode/vnode/src/tsdb/tsdbCache.c
浏览文件 @
2ae64cdf
...
...
@@ -98,12 +98,19 @@ static int32_t tsdbOpenRocksCache(STsdb *pTsdb) {
goto
_err3
;
}
rocksdb_flushoptions_t
*
flushoptions
=
rocksdb_flushoptions_create
();
if
(
NULL
==
flushoptions
)
{
code
=
TSDB_CODE_OUT_OF_MEMORY
;
goto
_err4
;
}
rocksdb_writebatch_t
*
writebatch
=
rocksdb_writebatch_create
();
pTsdb
->
rCache
.
writebatch
=
writebatch
;
pTsdb
->
rCache
.
options
=
options
;
pTsdb
->
rCache
.
writeoptions
=
writeoptions
;
pTsdb
->
rCache
.
readoptions
=
readoptions
;
pTsdb
->
rCache
.
flushoptions
=
flushoptions
;
pTsdb
->
rCache
.
db
=
db
;
taosThreadMutexInit
(
&
pTsdb
->
rCache
.
rMutex
,
NULL
);
...
...
@@ -122,6 +129,7 @@ _err:
static
void
tsdbCloseRocksCache
(
STsdb
*
pTsdb
)
{
rocksdb_close
(
pTsdb
->
rCache
.
db
);
rocksdb_flushoptions_destroy
(
pTsdb
->
rCache
.
flushoptions
);
rocksdb_writebatch_destroy
(
pTsdb
->
rCache
.
writebatch
);
rocksdb_readoptions_destroy
(
pTsdb
->
rCache
.
readoptions
);
rocksdb_writeoptions_destroy
(
pTsdb
->
rCache
.
writeoptions
);
...
...
@@ -129,6 +137,20 @@ static void tsdbCloseRocksCache(STsdb *pTsdb) {
taosThreadMutexDestroy
(
&
pTsdb
->
rCache
.
rMutex
);
}
int32_t
tsdbCacheCommit
(
STsdb
*
pTsdb
)
{
int32_t
code
=
0
;
char
*
err
=
NULL
;
rocksdb_flush
(
pTsdb
->
rCache
.
db
,
pTsdb
->
rCache
.
flushoptions
,
&
err
);
if
(
NULL
!=
err
)
{
tsdbError
(
"vgId:%d, %s failed at line %d since %s"
,
TD_VID
(
pTsdb
->
pVnode
),
__func__
,
__LINE__
,
err
);
rocksdb_free
(
err
);
code
=
-
1
;
}
return
code
;
}
SLastCol
*
tsdbCacheDeserialize
(
char
const
*
value
)
{
if
(
!
value
)
{
return
NULL
;
...
...
@@ -365,6 +387,21 @@ int32_t tsdbCacheGet(STsdb *pTsdb, tb_uid_t uid, SArray *pLastArray, SCacheRowsR
}
// maybe store it back to rocks cache
rocksdb_writebatch_t
*
wb
=
pTsdb
->
rCache
.
writebatch
;
char
*
value
=
NULL
;
size_t
vlen
=
0
;
tsdbCacheSerialize
(
pLastCol
,
&
value
,
&
vlen
);
char
key
[
ROCKS_KEY_LEN
];
size_t
klen
=
snprintf
(
key
,
ROCKS_KEY_LEN
,
"%"
PRIi64
":%"
PRIi16
":last"
,
uid
,
pLastCol
->
colVal
.
cid
);
rocksdb_writebatch_put
(
wb
,
key
,
klen
,
value
,
vlen
);
char
*
err
=
NULL
;
rocksdb_write
(
pTsdb
->
rCache
.
db
,
pTsdb
->
rCache
.
writeoptions
,
wb
,
&
err
);
if
(
NULL
!=
err
)
{
tsdbError
(
"vgId:%d, %s failed at line %d since %s"
,
TD_VID
(
pTsdb
->
pVnode
),
__func__
,
__LINE__
,
err
);
rocksdb_free
(
err
);
}
taosMemoryFree
(
value
);
}
taosArrayPush
(
pLastArray
,
pLastCol
);
...
...
@@ -2256,7 +2293,7 @@ static int32_t mergeLastCid(tb_uid_t uid, STsdb *pTsdb, SArray **ppLastArray, SC
if
(
lastRowTs
==
TSKEY_MAX
)
{
lastRowTs
=
rowTs
;
for
(
int16_t
iCol
=
0
;
iCol
<
nCols
;
++
iCol
)
{
for
(
int16_t
iCol
=
noneCol
;
iCol
<
nCols
;
++
iCol
)
{
if
(
iCol
>=
nLastCol
)
{
break
;
}
...
...
@@ -2264,6 +2301,13 @@ static int32_t mergeLastCid(tb_uid_t uid, STsdb *pTsdb, SArray **ppLastArray, SC
if
(
pCol
->
colVal
.
cid
!=
pTSchema
->
columns
[
slotIds
[
iCol
]].
colId
)
{
continue
;
}
if
(
slotIds
[
iCol
]
==
0
)
{
STColumn
*
pTColumn
=
&
pTSchema
->
columns
[
0
];
*
pColVal
=
COL_VAL_VALUE
(
pTColumn
->
colId
,
pTColumn
->
type
,
(
SValue
){.
val
=
lastRowTs
});
taosArraySet
(
pColArray
,
0
,
&
(
SLastCol
){.
ts
=
lastRowTs
,
.
colVal
=
*
pColVal
});
continue
;
}
tsdbRowGetColVal
(
pRow
,
pTSchema
,
slotIds
[
iCol
],
pColVal
);
*
pCol
=
(
SLastCol
){.
ts
=
lastRowTs
,
.
colVal
=
*
pColVal
};
...
...
@@ -2336,10 +2380,6 @@ static int32_t mergeLastCid(tb_uid_t uid, STsdb *pTsdb, SArray **ppLastArray, SC
}
}
while
(
setNoneCol
);
// if (taosArrayGetSize(pColArray) <= 0) {
//*ppLastArray = NULL;
// taosArrayDestroy(pColArray);
//} else {
if
(
!
hasRow
)
{
if
(
ignoreEarlierTs
)
{
taosArrayDestroy
(
pColArray
);
...
...
@@ -2349,11 +2389,10 @@ static int32_t mergeLastCid(tb_uid_t uid, STsdb *pTsdb, SArray **ppLastArray, SC
}
}
*
ppLastArray
=
pColArray
;
//}
nextRowIterClose
(
&
iter
);
taosArrayDestroy
(
aColArray
);
// taosMemoryFreeClear(pTSchema);
return
code
;
_err:
...
...
source/dnode/vnode/src/vnd/vnodeCommit.c
浏览文件 @
2ae64cdf
...
...
@@ -144,8 +144,8 @@ _exit:
}
int
vnodeShouldCommit
(
SVnode
*
pVnode
,
bool
atExit
)
{
bool
diskAvail
=
osDataSpaceAvailable
();
bool
needCommit
=
false
;
bool
diskAvail
=
osDataSpaceAvailable
();
bool
needCommit
=
false
;
taosThreadMutexLock
(
&
pVnode
->
mutex
);
if
(
pVnode
->
inUse
&&
diskAvail
)
{
...
...
@@ -439,6 +439,9 @@ static int vnodeCommitImpl(SCommitInfo *pInfo) {
code
=
tsdbCommit
(
pVnode
->
pTsdb
,
pInfo
);
TSDB_CHECK_CODE
(
code
,
lino
,
_exit
);
code
=
tsdbCacheCommit
(
pVnode
->
pTsdb
);
TSDB_CHECK_CODE
(
code
,
lino
,
_exit
);
if
(
VND_IS_RSMA
(
pVnode
))
{
code
=
smaCommit
(
pVnode
->
pSma
,
pInfo
);
TSDB_CHECK_CODE
(
code
,
lino
,
_exit
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录