Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
12f716b3
TDengine
项目概览
taosdata
/
TDengine
大约 2 年 前同步成功
通知
1192
Star
22018
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
12f716b3
编写于
3月 28, 2022
作者:
A
Alex Duan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[TS-238-D]<fix>(tsdb): deal block readonly modify delete status
上级
6185cef9
变更
6
展开全部
显示空白变更内容
内联
并排
Showing
6 changed file
with
391 addition
and
258 deletion
+391
-258
src/client/src/tscServer.c
src/client/src/tscServer.c
+11
-9
src/inc/taosmsg.h
src/inc/taosmsg.h
+4
-0
src/tsdb/inc/tsdbTruncate.h
src/tsdb/inc/tsdbTruncate.h
+2
-5
src/tsdb/src/tsdbCommit.c
src/tsdb/src/tsdbCommit.c
+4
-2
src/tsdb/src/tsdbMemTable.c
src/tsdb/src/tsdbMemTable.c
+15
-10
src/tsdb/src/tsdbTruncate.c
src/tsdb/src/tsdbTruncate.c
+355
-232
未找到文件。
src/client/src/tscServer.c
浏览文件 @
12f716b3
...
...
@@ -3331,7 +3331,7 @@ int buildTableDelDataMsg(SSqlObj* pSql, SSqlCmd* pCmd, SQueryInfo* pQueryInfo, S
tscDebug
(
"0x%"
PRIx64
" table deldata submit msg built, numberOfEP:%d"
,
pSql
->
self
,
pSql
->
epSet
.
numOfEps
);
// set payload
size_t
payloadLen
=
sizeof
(
SMsgDesc
)
+
sizeof
(
SSubmitMsg
)
+
sizeof
(
SSubmitBlk
)
+
sizeof
(
SControlData
);
size_t
payloadLen
=
sizeof
(
SMsgDesc
)
+
sizeof
(
SSubmitMsg
)
+
sizeof
(
SSubmitBlk
)
+
sizeof
(
SControlData
)
+
sizeof
(
int32_t
)
;
int32_t
ret
=
tscAllocPayload
(
pCmd
,
payloadLen
);
if
(
ret
!=
TSDB_CODE_SUCCESS
)
{
return
ret
;
...
...
@@ -3362,11 +3362,13 @@ int buildTableDelDataMsg(SSqlObj* pSql, SSqlCmd* pCmd, SQueryInfo* pQueryInfo, S
pSubmitBlk
->
numOfRows
=
htons
(
1
);
pSubmitBlk
->
schemaLen
=
0
;
// only server return TSDB_CODE_TDB_TABLE_RECONFIGURE need schema attached
pSubmitBlk
->
sversion
=
htonl
(
pTableMeta
->
sversion
);
pSubmitBlk
->
dataLen
=
htonl
(
sizeof
(
SControlData
));
pSubmitBlk
->
dataLen
=
htonl
(
sizeof
(
SControlData
)
+
sizeof
(
int32_t
));
// SControlData
pControlData
->
command
=
htonl
(
CMD_DELETE_DATA
);
pControlData
->
win
.
skey
=
htobe64
(
pQueryInfo
->
window
.
skey
);
pControlData
->
win
.
ekey
=
htobe64
(
pQueryInfo
->
window
.
ekey
);
pControlData
->
tnum
=
htonl
(
1
);
pControlData
->
tids
[
0
]
=
htonl
(
pTableMeta
->
id
.
tid
);
return
TSDB_CODE_SUCCESS
;
}
...
...
src/inc/taosmsg.h
浏览文件 @
12f716b3
...
...
@@ -1005,9 +1005,13 @@ typedef struct {
#define CMD_DELETE_DATA 0x00000001
#define CMD_TRUNCATE 0x00000002
#define GET_CTLDATA_SIZE(p) (sizeof(SControlData) + p->tnum * sizeof(int32_t))
typedef
struct
SControlData
{
uint32_t
command
;
// see define CMD_???
STimeWindow
win
;
int32_t
tnum
;
// tids nums
int32_t
tids
[];
// delete table tid
}
SControlData
;
enum
{
...
...
src/tsdb/inc/tsdbTruncate.h
浏览文件 @
12f716b3
...
...
@@ -20,16 +20,13 @@ extern "C" {
#endif
// SControlData addition information
#define GET_CTLINFO_SIZE(p) (sizeof(SControlDataInfo) + p.ctlData.tnum * sizeof(int32_t))
typedef
struct
{
SControlData
ctlData
;
// addition info
uint64_t
uid
;
// table unique id
int32_t
tid
;
// table id
tsem_t
*
pSem
;
bool
memNull
;
// pRepo->mem is NULL, this is true
uint64_t
*
uids
;
// delete table
int32_t
uidCount
;
SShellSubmitRspMsg
*
pRsp
;
SControlData
ctlData
;
}
SControlDataInfo
;
// -------- interface ---------
...
...
src/tsdb/src/tsdbCommit.c
浏览文件 @
12f716b3
...
...
@@ -240,7 +240,8 @@ int tsdbWriteBlockIdx(SDFile *pHeadf, SArray *pIdxA, void **ppBuf) {
pBlkIdx
=
(
SBlockIdx
*
)
taosArrayGet
(
pIdxA
,
i
);
size
=
tsdbEncodeSBlockIdx
(
NULL
,
pBlkIdx
);
if
(
tsdbMakeRoom
(
ppBuf
,
tlen
+
size
)
<
0
)
return
-
1
;
if
(
tsdbMakeRoom
(
ppBuf
,
tlen
+
size
)
<
0
)
return
-
1
;
void
*
ptr
=
POINTER_SHIFT
(
*
ppBuf
,
tlen
);
tsdbEncodeSBlockIdx
(
&
ptr
,
pBlkIdx
);
...
...
@@ -249,7 +250,8 @@ int tsdbWriteBlockIdx(SDFile *pHeadf, SArray *pIdxA, void **ppBuf) {
}
tlen
+=
sizeof
(
TSCKSUM
);
if
(
tsdbMakeRoom
(
ppBuf
,
tlen
)
<
0
)
return
-
1
;
if
(
tsdbMakeRoom
(
ppBuf
,
tlen
)
<
0
)
return
-
1
;
taosCalcChecksumAppend
(
0
,
(
uint8_t
*
)(
*
ppBuf
),
tlen
);
if
(
tsdbAppendDFile
(
pHeadf
,
*
ppBuf
,
tlen
,
&
offset
)
<
tlen
)
{
...
...
src/tsdb/src/tsdbMemTable.c
浏览文件 @
12f716b3
...
...
@@ -1122,7 +1122,6 @@ static int tsdbUpdateTableLatestInfo(STsdbRepo *pRepo, STable *pTable, SMemRow r
// Control Data
int32_t
tsdbInsertControlData
(
STsdbRepo
*
pRepo
,
SSubmitBlk
*
pBlock
,
SShellSubmitRspMsg
*
pRsp
,
tsem_t
**
ppSem
)
{
int32_t
ret
=
TSDB_CODE_SUCCESS
;
assert
(
pBlock
->
dataLen
==
sizeof
(
SControlData
));
SControlData
*
pCtlData
=
(
SControlData
*
)
pBlock
->
data
;
// INIT SEM FOR ASYNC WAIT COMMIT RESULT
...
...
@@ -1136,15 +1135,18 @@ int32_t tsdbInsertControlData(STsdbRepo* pRepo, SSubmitBlk* pBlock, SShellSubmit
// anti-serialize
pCtlData
->
command
=
htonl
(
pCtlData
->
command
);
pCtlData
->
tnum
=
htonl
(
pCtlData
->
tnum
);
pCtlData
->
win
.
skey
=
htobe64
(
pCtlData
->
win
.
skey
);
pCtlData
->
win
.
ekey
=
htobe64
(
pCtlData
->
win
.
ekey
);
for
(
int32_t
i
=
0
;
i
<
pCtlData
->
tnum
;
i
++
)
{
pCtlData
->
tids
[
i
]
=
htonl
(
pCtlData
->
tids
[
i
]);
}
// server data set
SControlDataInfo
*
pNew
=
(
SControlDataInfo
*
)
tmalloc
(
sizeof
(
SControlDataInfo
));
memset
(
pNew
,
0
,
sizeof
(
SControlDataInfo
));
pNew
->
ctlData
=
*
pCtlData
;
pNew
->
uid
=
pBlock
->
uid
;
pNew
->
tid
=
pBlock
->
tid
;
size_t
nsize
=
sizeof
(
SControlDataInfo
)
+
pCtlData
->
tnum
*
sizeof
(
int32_t
);
SControlDataInfo
*
pNew
=
(
SControlDataInfo
*
)
tmalloc
(
nsize
);
memset
(
pNew
,
0
,
nsize
);
memcpy
(
&
pNew
->
ctlData
,
pCtlData
,
GET_CTLDATA_SIZE
(
pCtlData
));
pNew
->
pRsp
=
pRsp
;
if
(
ppSem
)
pNew
->
pSem
=
*
ppSem
;
...
...
@@ -1155,10 +1157,13 @@ int32_t tsdbInsertControlData(STsdbRepo* pRepo, SSubmitBlk* pBlock, SShellSubmit
}
// if async post failed , must set wait event ppSem NULL
if
(
ret
!=
TSDB_CODE_SUCCESS
&&
ppSem
)
{
if
(
ret
!=
TSDB_CODE_SUCCESS
)
{
if
(
*
ppSem
)
{
tsem_destroy
(
*
ppSem
);
*
ppSem
=
NULL
;
}
tfree
(
pNew
);
}
return
ret
;
}
\ No newline at end of file
src/tsdb/src/tsdbTruncate.c
浏览文件 @
12f716b3
此差异已折叠。
点击以展开。
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录