Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Metz
oceanbase
提交
a809ae9f
O
oceanbase
项目概览
Metz
/
oceanbase
与 Fork 源项目一致
Fork自
oceanbase / oceanbase
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
O
oceanbase
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
a809ae9f
编写于
10月 19, 2021
作者:
Y
yishenglanlingzui
提交者:
wangzelin.wzl
10月 19, 2021
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix bug multi_replace stmt hang in fetch_conflict
上级
e54cab6c
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
32 addition
and
14 deletion
+32
-14
src/storage/ob_partition_storage.cpp
src/storage/ob_partition_storage.cpp
+12
-6
src/storage/ob_partition_storage.h
src/storage/ob_partition_storage.h
+1
-1
src/storage/ob_value_row_iterator.cpp
src/storage/ob_value_row_iterator.cpp
+17
-6
src/storage/ob_value_row_iterator.h
src/storage/ob_value_row_iterator.h
+2
-1
未找到文件。
src/storage/ob_partition_storage.cpp
浏览文件 @
a809ae9f
...
...
@@ -1748,7 +1748,7 @@ int ObPartitionStorage::fetch_conflict_rows(const ObStoreCtx& ctx, const ObDMLBa
int
ObPartitionStorage
::
multi_get_rows
(
const
ObStoreCtx
&
store_ctx
,
const
ObTableAccessParam
&
access_param
,
ObTableAccessContext
&
access_ctx
,
ObRelativeTable
&
relative_table
,
const
GetRowkeyArray
&
rowkeys
,
ObNewRowIterator
*&
duplicated_rows
)
ObNewRowIterator
*&
duplicated_rows
,
int64_t
data_table_rowkey_cnt
)
{
int
ret
=
OB_SUCCESS
;
const
ObTablesHandle
&
tables_handle
=
relative_table
.
tables_handle_
;
...
...
@@ -1795,7 +1795,7 @@ int ObPartitionStorage::multi_get_rows(const ObStoreCtx& store_ctx, const ObTabl
STORAGE_LOG
(
ERROR
,
"no memory to alloc ObValueRowIterator"
,
K
(
ret
));
}
else
{
duplicated_rows
=
dup_iter
;
if
(
OB_FAIL
(
dup_iter
->
init
(
true
)))
{
if
(
OB_FAIL
(
dup_iter
->
init
(
true
,
data_table_rowkey_cnt
)))
{
STORAGE_LOG
(
WARN
,
"failed to initialize ObValueRowIterator"
,
K
(
ret
));
}
}
...
...
@@ -1825,7 +1825,9 @@ int ObPartitionStorage::multi_get_rows(const ObStoreCtx& store_ctx, const ObTabl
row
->
row_val_
.
count_
=
access_param
.
output_exprs_
->
count
();
LOG_DEBUG
(
"get conflict row"
,
K_
(
row
->
row_val
));
}
if
(
OB_FAIL
(
dup_iter
->
add_row
(
row
->
row_val_
)))
{
if
(
OB_FAIL
(
ret
))
{
}
else
if
(
OB_FAIL
(
dup_iter
->
add_row
(
row
->
row_val_
)))
{
STORAGE_LOG
(
WARN
,
"failed to store conflict row"
,
K
(
*
row
));
}
else
{
LOG_DEBUG
(
"get conflict row"
,
K_
(
row
->
row_val
));
...
...
@@ -1894,13 +1896,15 @@ int ObPartitionStorage::get_index_conflict_row(ObDMLRunningCtx& run_ctx, const O
LOG_WARN
(
"get conflict row failed"
,
K
(
relative_table
),
K
(
index_rowkey
),
K
(
pk_out_descs
));
}
if
(
OB_SUCC
(
ret
)
&&
OB_UNLIKELY
(
need_index_back
)
&&
OB_UNLIKELY
(
tmp_rowkey_iter
!=
NULL
))
{
int64_t
data_table_rowkey_cnt
=
run_ctx
.
relative_tables_
.
data_table_
.
get_rowkey_column_num
();
OZ
(
convert_row_to_rowkey
(
*
dup_rowkey_iter
,
rowkeys
));
OZ
(
multi_get_rows
(
run_ctx
.
store_ctx_
,
table_access_param
,
table_access_ctx
,
run_ctx
.
relative_tables_
.
data_table_
,
rowkeys
,
duplicated_rows
));
duplicated_rows
,
data_table_rowkey_cnt
));
}
}
if
(
dup_rowkey_iter
!=
NULL
)
{
...
...
@@ -1917,9 +1921,11 @@ int ObPartitionStorage::get_conflict_row(ObDMLRunningCtx& run_ctx, const ObTable
int
ret
=
OB_SUCCESS
;
ObExtStoreRowkey
ext_rowkey
(
rowkey
);
GetRowkeyArray
rowkeys
;
int64_t
data_table_rowkey_cnt
=
run_ctx
.
relative_tables_
.
data_table_
.
get_rowkey_column_num
();
OZ
(
rowkeys
.
push_back
(
ext_rowkey
));
OZ
(
multi_get_rows
(
run_ctx
.
store_ctx_
,
access_param
,
access_ctx
,
relative_table
,
rowkeys
,
duplicated_rows
));
LOG_DEBUG
(
"get conflict row"
,
K
(
ret
),
K
(
rowkey
),
K
(
relative_table
),
K
(
access_param
));
OZ
(
multi_get_rows
(
run_ctx
.
store_ctx_
,
access_param
,
access_ctx
,
relative_table
,
rowkeys
,
duplicated_rows
,
data_table_rowkey_cnt
));
LOG_DEBUG
(
"get conflict row"
,
K
(
ret
),
K
(
rowkey
),
K
(
relative_table
),
K
(
access_param
),
K
(
data_table_rowkey_cnt
));
return
ret
;
}
...
...
src/storage/ob_partition_storage.h
浏览文件 @
a809ae9f
...
...
@@ -556,7 +556,7 @@ private:
const
common
::
ObNewRow
&
row
,
common
::
ObNewRowIterator
*&
duplicated_rows
);
int
multi_get_rows
(
const
ObStoreCtx
&
store_ctx
,
const
ObTableAccessParam
&
access_param
,
ObTableAccessContext
&
access_ctx
,
ObRelativeTable
&
relative_table
,
const
GetRowkeyArray
&
rowkeys
,
common
::
ObNewRowIterator
*&
duplicated_rows
);
common
::
ObNewRowIterator
*&
duplicated_rows
,
int64_t
data_table_rowkey_cnt
);
int
get_conflict_rows
(
ObDMLRunningCtx
&
run_ctx
,
const
ObInsertFlag
flag
,
const
common
::
ObIArray
<
uint64_t
>&
dup_col_ids
,
const
common
::
ObNewRow
&
row
,
common
::
ObNewRowIterator
*&
duplicated_rows
);
...
...
src/storage/ob_value_row_iterator.cpp
浏览文件 @
a809ae9f
...
...
@@ -22,13 +22,14 @@ ObValueRowIterator::ObValueRowIterator()
unique_
(
false
),
allocator_
(
ObModIds
::
OB_VALUE_ROW_ITER
),
rows_
(),
cur_idx_
(
0
)
cur_idx_
(
0
),
data_table_rowkey_cnt_
(
0
)
{}
ObValueRowIterator
::~
ObValueRowIterator
()
{}
int
ObValueRowIterator
::
init
(
bool
unique
)
int
ObValueRowIterator
::
init
(
bool
unique
,
int64_t
data_table_rowkey_cnt
)
{
int
ret
=
OB_SUCCESS
;
if
(
OB_UNLIKELY
(
is_inited_
))
{
...
...
@@ -38,6 +39,7 @@ int ObValueRowIterator::init(bool unique)
is_inited_
=
true
;
unique_
=
unique
;
cur_idx_
=
0
;
data_table_rowkey_cnt_
=
data_table_rowkey_cnt
;
}
return
ret
;
}
...
...
@@ -52,6 +54,9 @@ int ObValueRowIterator::add_row(common::ObNewRow& row)
}
else
if
(
OB_UNLIKELY
(
!
is_inited_
))
{
ret
=
OB_NOT_INIT
;
STORAGE_LOG
(
WARN
,
"ObValueRowIterator is not initialized"
,
K
(
ret
));
}
else
if
(
data_table_rowkey_cnt_
>
row
.
count_
)
{
ret
=
OB_INVALID_ARGUMENT
;
STORAGE_LOG
(
WARN
,
"invalid row"
,
K
(
ret
),
K
(
row
),
K
(
data_table_rowkey_cnt_
));
}
else
{
bool
exist
=
false
;
// check whether exists
...
...
@@ -60,11 +65,17 @@ int ObValueRowIterator::add_row(common::ObNewRow& row)
// on multiple unique index is small, so there is usually only one row in the value row iterator
// so using list traversal to deduplicate unique index is more efficiently
// and also saves the CPU overhead that constructs the hash map
ObStoreRowkey
rowkey
(
row
.
cells_
,
row
.
cou
nt_
);
ObStoreRowkey
rowkey
(
row
.
cells_
,
data_table_rowkey_c
nt_
);
for
(
int64_t
i
=
0
;
OB_SUCC
(
ret
)
&&
!
exist
&&
i
<
rows_
.
count
();
++
i
)
{
ObStoreRowkey
tmp_rowkey
(
rows_
.
at
(
i
).
cells_
,
rows_
.
at
(
i
).
count_
);
if
(
OB_UNLIKELY
(
tmp_rowkey
==
rowkey
))
{
exist
=
true
;
if
(
data_table_rowkey_cnt_
>
rows_
.
at
(
i
).
count_
)
{
ret
=
OB_INVALID_ARGUMENT
;
STORAGE_LOG
(
WARN
,
"invalid row"
,
K
(
ret
),
K
(
row
),
K
(
data_table_rowkey_cnt_
));
}
else
{
ObStoreRowkey
tmp_rowkey
(
rows_
.
at
(
i
).
cells_
,
data_table_rowkey_cnt_
);
STORAGE_LOG
(
DEBUG
,
"print rowkey info"
,
K
(
rowkey
),
K
(
tmp_rowkey
),
K
(
data_table_rowkey_cnt_
));
if
(
OB_UNLIKELY
(
tmp_rowkey
==
rowkey
))
{
exist
=
true
;
}
}
}
}
...
...
src/storage/ob_value_row_iterator.h
浏览文件 @
a809ae9f
...
...
@@ -29,7 +29,7 @@ class ObValueRowIterator : public common::ObNewRowIterator {
public:
ObValueRowIterator
();
virtual
~
ObValueRowIterator
();
virtual
int
init
(
bool
unique
);
virtual
int
init
(
bool
unique
,
int64_t
data_table_rowkey_cnt
);
virtual
int
get_next_row
(
common
::
ObNewRow
*&
row
);
virtual
int
get_next_rows
(
common
::
ObNewRow
*&
rows
,
int64_t
&
row_count
);
virtual
int
add_row
(
common
::
ObNewRow
&
row
);
...
...
@@ -41,6 +41,7 @@ private:
common
::
ObArenaAllocator
allocator_
;
RowArray
rows_
;
int64_t
cur_idx_
;
int64_t
data_table_rowkey_cnt_
;
private:
DISALLOW_COPY_AND_ASSIGN
(
ObValueRowIterator
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录