Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
b77b340b
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22016
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看板
未验证
提交
b77b340b
编写于
11月 26, 2021
作者:
M
Minglei Jin
提交者:
GitHub
11月 26, 2021
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #8791 from taosdata/hotfix/TS-714-D
[TS-714]<fix>: fix invalid write during cachelast
上级
ec6f6910
cfbd2271
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
22 addition
and
19 deletion
+22
-19
src/tsdb/src/tsdbMain.c
src/tsdb/src/tsdbMain.c
+22
-19
未找到文件。
src/tsdb/src/tsdbMain.c
浏览文件 @
b77b340b
...
@@ -660,9 +660,9 @@ static int tsdbRestoreLastColumns(STsdbRepo *pRepo, STable *pTable, SReadH* pRea
...
@@ -660,9 +660,9 @@ static int tsdbRestoreLastColumns(STsdbRepo *pRepo, STable *pTable, SReadH* pRea
int
numColumns
;
int
numColumns
;
int32_t
blockIdx
;
int32_t
blockIdx
;
SDataStatis
*
pBlockStatis
=
NULL
;
SDataStatis
*
pBlockStatis
=
NULL
;
SMemRow
row
=
NULL
;
//
SMemRow row = NULL;
// restore last column data with last schema
// restore last column data with last schema
int
err
=
0
;
int
err
=
0
;
numColumns
=
schemaNCols
(
pSchema
);
numColumns
=
schemaNCols
(
pSchema
);
...
@@ -676,15 +676,15 @@ static int tsdbRestoreLastColumns(STsdbRepo *pRepo, STable *pTable, SReadH* pRea
...
@@ -676,15 +676,15 @@ static int tsdbRestoreLastColumns(STsdbRepo *pRepo, STable *pTable, SReadH* pRea
}
}
}
}
row
=
taosTMalloc
(
memRowMaxBytesFromSchema
(
pSchema
));
//
row = taosTMalloc(memRowMaxBytesFromSchema(pSchema));
if
(
row
==
NULL
)
{
//
if (row == NULL) {
terrno
=
TSDB_CODE_TDB_OUT_OF_MEMORY
;
//
terrno = TSDB_CODE_TDB_OUT_OF_MEMORY;
err
=
-
1
;
//
err = -1;
goto
out
;
//
goto out;
}
//
}
memRowSetType
(
row
,
SMEM_ROW_DATA
);
//
memRowSetType(row, SMEM_ROW_DATA);
tdInitDataRow
(
memRowDataBody
(
row
),
pSchema
);
//
tdInitDataRow(memRowDataBody(row), pSchema);
// first load block index info
// first load block index info
if
(
tsdbLoadBlockInfo
(
pReadh
,
NULL
,
NULL
)
<
0
)
{
if
(
tsdbLoadBlockInfo
(
pReadh
,
NULL
,
NULL
)
<
0
)
{
...
@@ -743,10 +743,12 @@ static int tsdbRestoreLastColumns(STsdbRepo *pRepo, STable *pTable, SReadH* pRea
...
@@ -743,10 +743,12 @@ static int tsdbRestoreLastColumns(STsdbRepo *pRepo, STable *pTable, SReadH* pRea
for
(
int32_t
rowId
=
pBlock
->
numOfRows
-
1
;
rowId
>=
0
;
rowId
--
)
{
for
(
int32_t
rowId
=
pBlock
->
numOfRows
-
1
;
rowId
>=
0
;
rowId
--
)
{
SDataCol
*
pDataCol
=
pReadh
->
pDCols
[
0
]
->
cols
+
i
;
SDataCol
*
pDataCol
=
pReadh
->
pDCols
[
0
]
->
cols
+
i
;
const
void
*
pColData
=
tdGetColDataOfRow
(
pDataCol
,
rowId
);
const
void
*
pColData
=
tdGetColDataOfRow
(
pDataCol
,
rowId
);
tdAppendColVal
(
memRowDataBody
(
row
),
pColData
,
pCol
->
type
,
pCol
->
offset
);
// tdAppendColVal(memRowDataBody(row), pColData, pCol->type, pCol->offset);
//SDataCol *pDataCol = readh.pDCols[0]->cols + j;
// SDataCol *pDataCol = readh.pDCols[0]->cols + j;
void
*
value
=
tdGetRowDataOfCol
(
memRowDataBody
(
row
),
(
int8_t
)
pCol
->
type
,
TD_DATA_ROW_HEAD_SIZE
+
pCol
->
offset
);
// void *value = tdGetRowDataOfCol(memRowDataBody(row), (int8_t)pCol->type, TD_DATA_ROW_HEAD_SIZE +
if
(
isNull
(
value
,
pCol
->
type
))
{
//
// pCol->offset);
if
(
isNull
(
pColData
,
pCol
->
type
))
{
continue
;
continue
;
}
}
...
@@ -761,13 +763,14 @@ static int tsdbRestoreLastColumns(STsdbRepo *pRepo, STable *pTable, SReadH* pRea
...
@@ -761,13 +763,14 @@ static int tsdbRestoreLastColumns(STsdbRepo *pRepo, STable *pTable, SReadH* pRea
pLastCol
->
pData
=
malloc
(
bytes
);
pLastCol
->
pData
=
malloc
(
bytes
);
pLastCol
->
bytes
=
bytes
;
pLastCol
->
bytes
=
bytes
;
pLastCol
->
colId
=
pCol
->
colId
;
pLastCol
->
colId
=
pCol
->
colId
;
memcpy
(
pLastCol
->
pData
,
value
,
bytes
);
memcpy
(
pLastCol
->
pData
,
pColData
,
bytes
);
// save row ts(in column 0)
// save row ts(in column 0)
pDataCol
=
pReadh
->
pDCols
[
0
]
->
cols
+
0
;
pDataCol
=
pReadh
->
pDCols
[
0
]
->
cols
+
0
;
pCol
=
schemaColAt
(
pSchema
,
0
);
// pCol = schemaColAt(pSchema, 0);
tdAppendColVal
(
memRowDataBody
(
row
),
tdGetColDataOfRow
(
pDataCol
,
rowId
),
pCol
->
type
,
pCol
->
offset
);
// tdAppendColVal(memRowDataBody(row), tdGetColDataOfRow(pDataCol, rowId), pCol->type, pCol->offset);
pLastCol
->
ts
=
memRowKey
(
row
);
// pLastCol->ts = memRowKey(row);
pLastCol
->
ts
=
tdGetKey
(
*
(
TKEY
*
)(
tdGetColDataOfRow
(
pDataCol
,
rowId
)));
pTable
->
restoreColumnNum
+=
1
;
pTable
->
restoreColumnNum
+=
1
;
...
@@ -779,7 +782,7 @@ static int tsdbRestoreLastColumns(STsdbRepo *pRepo, STable *pTable, SReadH* pRea
...
@@ -779,7 +782,7 @@ static int tsdbRestoreLastColumns(STsdbRepo *pRepo, STable *pTable, SReadH* pRea
}
}
out:
out:
taosTZfree
(
row
);
//
taosTZfree(row);
tfree
(
pBlockStatis
);
tfree
(
pBlockStatis
);
if
(
err
==
0
&&
numColumns
<=
pTable
->
restoreColumnNum
)
{
if
(
err
==
0
&&
numColumns
<=
pTable
->
restoreColumnNum
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录