Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Metz
oceanbase
提交
ab2bb5a2
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看板
提交
ab2bb5a2
编写于
11月 10, 2021
作者:
C
chaser-ch
提交者:
LINGuanRen
11月 10, 2021
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix fuse row cache problem with uncommited row across micro block
上级
b5266f04
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
98 addition
and
0 deletion
+98
-0
src/storage/blocksstable/ob_micro_block_row_scanner.cpp
src/storage/blocksstable/ob_micro_block_row_scanner.cpp
+2
-0
unittest/storage/test_multi_version_sstable_single_get.cpp
unittest/storage/test_multi_version_sstable_single_get.cpp
+96
-0
未找到文件。
src/storage/blocksstable/ob_micro_block_row_scanner.cpp
浏览文件 @
ab2bb5a2
...
...
@@ -809,6 +809,7 @@ void ObMultiVersionMicroBlockRowScanner::reuse_prev_micro_row()
}
prev_micro_row_
.
flag_
=
ObActionFlag
::
OP_ROW_DOES_NOT_EXIST
;
prev_micro_row_
.
from_base_
=
false
;
prev_micro_row_
.
snapshot_version_
=
0
;
cell_allocator_
.
reuse
();
reserved_pos_
=
ObIMicroBlockReader
::
INVALID_ROW_INDEX
;
...
...
@@ -1089,6 +1090,7 @@ int ObMultiVersionMicroBlockRowScanner::cache_cur_micro_row(const bool found_fir
prev_micro_row_
.
flag_
=
cur_micro_row_
.
flag_
;
prev_micro_row_
.
from_base_
=
cur_micro_row_
.
from_base_
;
prev_micro_row_
.
row_val_
.
count_
=
cur_micro_row_
.
row_val_
.
count_
;
prev_micro_row_
.
snapshot_version_
=
cur_micro_row_
.
snapshot_version_
;
}
// The positive scan scans from new to old (trans_version is negative), so cur_row is older than prev_row
// So just add the nop column (column for which the value has not been decided)
...
...
unittest/storage/test_multi_version_sstable_single_get.cpp
浏览文件 @
ab2bb5a2
...
...
@@ -14,12 +14,16 @@
#define private public
#define protected public
#include "ob_multi_version_sstable_test.h"
#include "ob_uncommitted_trans_test.h"
#include "storage/memtable/ob_memtable.h"
#include "storage/memtable/ob_memtable_context.h"
namespace
oceanbase
{
using
namespace
common
;
using
namespace
blocksstable
;
using
namespace
storage
;
using
namespace
share
::
schema
;
using
namespace
oceanbase
::
memtable
;
namespace
unittest
{
...
...
@@ -40,6 +44,7 @@ public:
part
=
pkey
;
trans_service_
.
part_trans_ctx_mgr_
.
mgr_cache_
.
set
(
pkey
.
hash
(),
&
ctx_mgr_
);
ObPartitionService
::
get_instance
().
txs_
=
&
trans_service_
;
store_ctx_
.
trans_table_guard_
=
new
transaction
::
ObTransStateTableGuard
();
}
virtual
void
TearDown
()
{
...
...
@@ -63,7 +68,10 @@ public:
ObStoreCtx
store_ctx_
;
transaction
::
ObTransService
trans_service_
;
transaction
::
ObPartitionTransCtxMgr
ctx_mgr_
;
TestUncommittedMinorMergeScan
test_trans_part_ctx_
;
static
ObMemtableCtxFactory
fty_
;
};
ObMemtableCtxFactory
TestMultiVersionSSTableSingleGet
::
fty_
;
void
TestMultiVersionSSTableSingleGet
::
prepare_query_param
(
const
ObVersionRange
&
version_range
,
const
bool
is_reverse_scan
)
...
...
@@ -112,6 +120,10 @@ void TestMultiVersionSSTableSingleGet::prepare_query_param(
context_
.
block_cache_ws_
=
&
block_cache_ws_
;
context_
.
trans_version_range_
=
version_range
;
context_
.
is_inited_
=
true
;
store_ctx_
.
trans_table_guard_
->
set_trans_state_table
(
&
test_trans_part_ctx_
);
store_ctx_
.
snapshot_info_
.
snapshot_version_
=
10000
;
store_ctx_
.
mem_ctx_
=
fty_
.
alloc
();
store_ctx_
.
mem_ctx_
->
trans_begin
();
}
TEST_F
(
TestMultiVersionSSTableSingleGet
,
exist
)
...
...
@@ -606,6 +618,90 @@ TEST_F(TestMultiVersionSSTableSingleGet, empty_get)
// ASSERT_EQ(1, meta->empty_read_cnt_[2]);
//}
TEST_F
(
TestMultiVersionSSTableSingleGet
,
across_micro_uncommit
)
{
int
ret
=
OB_SUCCESS
;
const
int64_t
rowkey_cnt
=
4
;
const
char
*
micro_data
[
2
];
micro_data
[
0
]
=
"bigint var bigint bigint bigint bigint flag multi_version_row_flag
\n
"
"2 var3 MIN -10 NOP 12 EXIST U
\n
"
"2 var3 MIN -9 NOP 11 EXIST LU
\n
"
"3 var3 MIN -10 NOP 12 EXIST U
\n
"
"3 var3 MIN -9 NOP 11 EXIST U
\n
"
"3 var3 MIN -8 NOP 9 EXIST U
\n
"
;
micro_data
[
1
]
=
"bigint var bigint bigint bigint bigint flag multi_version_row_flag
\n
"
"3 var3 MIN -7 NOP 8 EXIST U
\n
"
"3 var3 MIN -6 6 10 EXIST U
\n
"
"3 var3 MIN -5 5 9 EXIST LU
\n
"
;
prepare_data_start
(
micro_data
,
rowkey_cnt
,
18
,
"none"
,
FLAT_ROW_STORE
,
0
);
prepare_one_macro
(
micro_data
,
2
);
prepare_data_end
();
test_trans_part_ctx_
.
clear_all
();
if
(
OB_FAIL
(
test_trans_part_ctx_
.
set_all_transaction_status
(
transaction
::
ObTransTableStatusType
::
RUNNING
,
INT64_MAX
)))
{
STORAGE_LOG
(
ERROR
,
"add transaction status failed"
,
K
(
ret
));
}
ObMockIterator
res_iter
;
ObMockIterator
rowkey_iter
;
ObStoreRowIterator
*
getter
=
NULL
;
const
ObStoreRow
*
row
=
NULL
;
ObExtStoreRowkey
ext_rowkey
;
ObVersionRange
version_range
;
version_range
.
snapshot_version_
=
20
;
version_range
.
base_version_
=
0
;
version_range
.
multi_version_start_
=
0
;
prepare_query_param
(
version_range
);
context_
.
query_flag_
.
read_latest_
=
common
::
ObQueryFlag
::
OBSF_MASK_READ_LATEST
;
const
char
*
rowkey2
=
"bigint var flag multi_version_row_flag
\n
"
"2 var3 EXIST N
\n
"
;
const
char
*
result2
=
"bigint var bigint bigint flag multi_version_row_flag
\n
"
"2 var3 NOP 12 EXIST N
\n
"
;
ext_rowkey
.
reset
();
rowkey_iter
.
reset
();
OK
(
rowkey_iter
.
from
(
rowkey2
));
OK
(
rowkey_iter
.
get_row
(
0
,
row
));
ASSERT_TRUE
(
NULL
!=
row
);
ObSSTableTest
::
convert_rowkey
(
ObStoreRowkey
(
row
->
row_val_
.
cells_
,
rowkey_cnt
-
2
),
ext_rowkey
,
allocator_
);
OK
(
sstable_
.
get
(
param_
,
context_
,
ext_rowkey
,
getter
));
res_iter
.
reset
();
OK
(
res_iter
.
from
(
result2
));
ASSERT_TRUE
(
res_iter
.
equals
(
*
getter
));
getter
->~
ObStoreRowIterator
();
OK
(
sstable_
.
get
(
param_
,
context_
,
ext_rowkey
,
getter
));
OK
(
getter
->
get_next_row
(
row
));
STORAGE_LOG
(
INFO
,
"print row2"
,
KPC
(
row
));
ASSERT_TRUE
(
INT64_MAX
==
row
->
snapshot_version_
);
getter
->~
ObStoreRowIterator
();
const
char
*
rowkey1
=
"bigint var flag multi_version_row_flag
\n
"
"3 var3 EXIST N
\n
"
;
const
char
*
result1
=
"bigint var bigint bigint flag multi_version_row_flag
\n
"
"3 var3 6 12 EXIST N
\n
"
;
ext_rowkey
.
reset
();
rowkey_iter
.
reset
();
OK
(
rowkey_iter
.
from
(
rowkey1
));
OK
(
rowkey_iter
.
get_row
(
0
,
row
));
ASSERT_TRUE
(
NULL
!=
row
);
ObSSTableTest
::
convert_rowkey
(
ObStoreRowkey
(
row
->
row_val_
.
cells_
,
rowkey_cnt
-
2
),
ext_rowkey
,
allocator_
);
context_
.
query_flag_
.
read_latest_
=
common
::
ObQueryFlag
::
OBSF_MASK_READ_LATEST
;
OK
(
sstable_
.
get
(
param_
,
context_
,
ext_rowkey
,
getter
));
res_iter
.
reset
();
OK
(
res_iter
.
from
(
result1
));
ASSERT_TRUE
(
res_iter
.
equals
(
*
getter
));
getter
->~
ObStoreRowIterator
();
OK
(
sstable_
.
get
(
param_
,
context_
,
ext_rowkey
,
getter
));
OK
(
getter
->
get_next_row
(
row
));
STORAGE_LOG
(
INFO
,
"print row"
,
KPC
(
row
));
ASSERT_TRUE
(
INT64_MAX
==
row
->
snapshot_version_
);
getter
->~
ObStoreRowIterator
();
}
}
// namespace unittest
}
// namespace oceanbase
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录