Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
大炮V587
oceanbase
提交
a00463ed
O
oceanbase
项目概览
大炮V587
/
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看板
体验新版 GitCode,发现更多精彩内容 >>
提交
a00463ed
编写于
2月 07, 2023
作者:
H
Handora
提交者:
ob-robot
2月 07, 2023
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[BUG]fix query engine not atomic flag
上级
b34367a7
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
94 addition
and
84 deletion
+94
-84
src/storage/memtable/mvcc/ob_mvcc_row.cpp
src/storage/memtable/mvcc/ob_mvcc_row.cpp
+0
-64
src/storage/memtable/mvcc/ob_mvcc_row.h
src/storage/memtable/mvcc/ob_mvcc_row.h
+94
-20
未找到文件。
src/storage/memtable/mvcc/ob_mvcc_row.cpp
浏览文件 @
a00463ed
...
...
@@ -136,28 +136,6 @@ void ObMvccTransNode::set_snapshot_version_barrier(const SCN version)
snapshot_version_barrier_
=
version
;
}
void
ObMvccTransNode
::
set_elr
()
{
while
(
true
)
{
const
uint8_t
flag
=
ATOMIC_LOAD
(
&
flag_
);
const
uint8_t
tmp
=
(
flag
|
F_ELR
);
if
(
ATOMIC_BCAS
(
&
flag_
,
flag
,
tmp
))
{
break
;
}
}
}
void
ObMvccTransNode
::
set_committed
()
{
while
(
true
)
{
const
uint8_t
flag
=
ATOMIC_LOAD
(
&
flag_
);
const
uint8_t
tmp
=
(
flag
|
F_COMMITTED
);
if
(
ATOMIC_BCAS
(
&
flag_
,
flag
,
tmp
))
{
break
;
}
}
}
void
ObMvccTransNode
::
get_trans_id_and_seq_no
(
ObTransID
&
tx_id
,
int64_t
&
seq_no
)
{
...
...
@@ -165,47 +143,6 @@ void ObMvccTransNode::get_trans_id_and_seq_no(ObTransID &tx_id,
seq_no
=
seq_no_
;
}
void
ObMvccTransNode
::
clear_aborted
()
{
const
uint8_t
consistent_flag
=
F_ABORTED
;
while
(
true
)
{
const
uint8_t
flag
=
ATOMIC_LOAD
(
&
flag_
);
const
uint8_t
tmp
=
(
flag
&
(
~
consistent_flag
));
if
(
ATOMIC_BCAS
(
&
flag_
,
flag
,
tmp
))
{
break
;
}
}
}
void
ObMvccTransNode
::
set_aborted
()
{
while
(
true
)
{
const
uint8_t
flag
=
ATOMIC_LOAD
(
&
flag_
);
const
uint8_t
tmp
=
(
flag
|
F_ABORTED
);
if
(
ATOMIC_BCAS
(
&
flag_
,
flag
,
tmp
))
{
break
;
}
}
}
void
ObMvccTransNode
::
set_delayed_cleanout
(
const
bool
delayed_cleanout
)
{
while
(
true
)
{
const
uint8_t
flag
=
ATOMIC_LOAD
(
&
flag_
);
const
uint8_t
tmp
=
delayed_cleanout
?
flag
|
F_DELAYED_CLEANOUT
:
flag
&
~
F_DELAYED_CLEANOUT
;
if
(
ATOMIC_BCAS
(
&
flag_
,
flag
,
tmp
))
{
break
;
}
}
}
bool
ObMvccTransNode
::
is_delayed_cleanout
()
const
{
return
ATOMIC_LOAD
(
&
flag_
)
&
F_DELAYED_CLEANOUT
;
}
int
ObMvccTransNode
::
fill_trans_version
(
const
SCN
version
)
{
trans_version_
.
atomic_store
(
version
);
...
...
@@ -1185,6 +1122,5 @@ void ObMvccRow::print_row()
}
}
}
};
// end namespace mvcc
};
// end namespace oceanbase
src/storage/memtable/mvcc/ob_mvcc_row.h
浏览文件 @
a00463ed
...
...
@@ -37,6 +37,24 @@ class ObIMemtableCtx;
class
ObMemtableKey
;
class
ObMvccRowCallback
;
#define ATOMIC_ADD_TAG(tag) \
while (true) { \
const uint8_t old = ATOMIC_LOAD(&(flag_)); \
const uint8_t tmp = (old | (tag)); \
if (ATOMIC_BCAS(&(flag_), old, tmp)) { \
break; \
} \
}
#define ATOMIC_SUB_TAG(tag) \
while (true) { \
const uint8_t old = ATOMIC_LOAD(&(flag_)); \
const uint8_t tmp = (old & (~(tag))); \
if (ATOMIC_BCAS(&(flag_), old, tmp)) { \
break; \
} \
}
// ObMvccTransNode is the multi-version data used for mvcc and stored on
// memtable. It only saves updated columns for write and write by aggregating tx
// nodes to data contains all columns.
...
...
@@ -104,15 +122,46 @@ public:
void
set_snapshot_version_barrier
(
const
share
::
SCN
version
);
// ===================== ObMvccTransNode Flag Interface =====================
void
set_committed
();
bool
is_committed
()
const
{
return
ATOMIC_LOAD
(
&
flag_
)
&
F_COMMITTED
;
}
void
set_elr
();
bool
is_elr
()
const
{
return
ATOMIC_LOAD
(
&
flag_
)
&
F_ELR
;
}
void
set_aborted
();
void
clear_aborted
();
bool
is_aborted
()
const
{
return
ATOMIC_LOAD
(
&
flag_
)
&
F_ABORTED
;
}
void
set_delayed_cleanout
(
const
bool
delayed_cleanout
);
bool
is_delayed_cleanout
()
const
;
OB_INLINE
void
set_committed
()
{
ATOMIC_ADD_TAG
(
F_COMMITTED
);
}
OB_INLINE
bool
is_committed
()
const
{
return
ATOMIC_LOAD
(
&
flag_
)
&
F_COMMITTED
;
}
OB_INLINE
void
set_elr
()
{
ATOMIC_ADD_TAG
(
F_ELR
);
}
OB_INLINE
bool
is_elr
()
const
{
return
ATOMIC_LOAD
(
&
flag_
)
&
F_ELR
;
}
OB_INLINE
void
set_aborted
()
{
ATOMIC_ADD_TAG
(
F_ABORTED
);
}
OB_INLINE
void
clear_aborted
()
{
ATOMIC_SUB_TAG
(
F_ABORTED
);
}
OB_INLINE
bool
is_aborted
()
const
{
return
ATOMIC_LOAD
(
&
flag_
)
&
F_ABORTED
;
}
OB_INLINE
void
set_delayed_cleanout
(
const
bool
delayed_cleanout
)
{
if
(
OB_LIKELY
(
delayed_cleanout
))
{
ATOMIC_ADD_TAG
(
F_DELAYED_CLEANOUT
);
}
else
{
ATOMIC_SUB_TAG
(
F_DELAYED_CLEANOUT
);
}
}
OB_INLINE
bool
is_delayed_cleanout
()
const
{
return
ATOMIC_LOAD
(
&
flag_
)
&
F_DELAYED_CLEANOUT
;
}
// ===================== ObMvccTransNode Setter/Getter =====================
blocksstable
::
ObDmlFlag
get_dml_flag
()
const
;
...
...
@@ -314,18 +363,43 @@ struct ObMvccRow
// ===================== ObMvccRow Event Statistic =====================
void
lock_begin
(
ObIMemtableCtx
&
ctx
)
const
;
void
mvcc_write_end
(
ObIMemtableCtx
&
ctx
,
int64_t
ret
)
const
;
// ===================== ObMvccRow Flag Interface =====================
bool
is_btree_indexed
()
{
return
flag_
&
F_BTREE_INDEX
;
}
void
set_btree_indexed
()
{
flag_
|=
F_BTREE_INDEX
;
}
void
clear_btree_indexed
()
{
flag_
&=
static_cast
<
uint8_t
>
(
~
F_BTREE_INDEX
);
}
bool
is_btree_tag_del
()
{
return
flag_
&
F_BTREE_TAG_DEL
;
}
void
set_btree_tag_del
()
{
flag_
|=
F_BTREE_TAG_DEL
;
}
void
clear_btree_tag_del
()
{
flag_
&=
static_cast
<
uint8_t
>
(
~
F_BTREE_TAG_DEL
);
}
void
set_hash_indexed
()
{
flag_
|=
F_HASH_INDEX
;
}
bool
is_lower_lock_scaned
()
const
{
return
flag_
&
F_LOWER_LOCK_SCANED
;
}
void
set_lower_lock_scaned
()
{
flag_
|=
F_LOWER_LOCK_SCANED
;
}
OB_INLINE
bool
is_btree_indexed
()
const
{
return
ATOMIC_LOAD
(
&
flag_
)
&
F_BTREE_INDEX
;
}
OB_INLINE
void
set_btree_indexed
()
{
ATOMIC_ADD_TAG
(
F_BTREE_INDEX
);
}
OB_INLINE
void
clear_btree_indexed
()
{
ATOMIC_SUB_TAG
(
F_BTREE_INDEX
);
}
OB_INLINE
bool
is_btree_tag_del
()
const
{
return
ATOMIC_LOAD
(
&
flag_
)
&
F_BTREE_TAG_DEL
;
}
OB_INLINE
void
set_btree_tag_del
()
{
ATOMIC_ADD_TAG
(
F_BTREE_TAG_DEL
);
}
OB_INLINE
void
clear_btree_tag_del
()
{
ATOMIC_SUB_TAG
(
F_BTREE_TAG_DEL
);
}
OB_INLINE
void
set_hash_indexed
()
{
ATOMIC_ADD_TAG
(
F_HASH_INDEX
);
}
OB_INLINE
bool
is_lower_lock_scaned
()
const
{
return
ATOMIC_LOAD
(
&
flag_
)
&
F_LOWER_LOCK_SCANED
;
}
OB_INLINE
void
set_lower_lock_scaned
()
{
ATOMIC_ADD_TAG
(
F_LOWER_LOCK_SCANED
);
}
// ===================== ObMvccRow Helper Function =====================
int64_t
to_string
(
char
*
buf
,
const
int64_t
buf_len
)
const
;
int64_t
to_string
(
char
*
buf
,
const
int64_t
buf_len
,
const
bool
verbose
)
const
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录