Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
天地威能
oceanbase
提交
e99cf210
O
oceanbase
项目概览
天地威能
/
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,发现更多精彩内容 >>
提交
e99cf210
编写于
6月 24, 2022
作者:
O
obdev
提交者:
wangzelin.wzl
6月 24, 2022
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix ttl wrong unit of time to life and change active_memstore_used to total_memstore_used
上级
f0f5ba08
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
26 addition
and
25 deletion
+26
-25
src/observer/table/ob_htable_filter_operator.cpp
src/observer/table/ob_htable_filter_operator.cpp
+2
-2
src/observer/table/ob_table_service.cpp
src/observer/table/ob_table_service.cpp
+6
-10
src/observer/table/ob_table_service.h
src/observer/table/ob_table_service.h
+3
-3
src/observer/table/ob_table_ttl_manager.cpp
src/observer/table/ob_table_ttl_manager.cpp
+9
-4
src/observer/table/ob_table_ttl_manager.h
src/observer/table/ob_table_ttl_manager.h
+1
-1
src/observer/table/ob_table_ttl_task.cpp
src/observer/table/ob_table_ttl_task.cpp
+1
-1
src/share/table/ob_table.h
src/share/table/ob_table.h
+4
-4
未找到文件。
src/observer/table/ob_htable_filter_operator.cpp
浏览文件 @
e99cf210
...
...
@@ -46,12 +46,12 @@ int ObHColumnDescriptor::from_string(const common::ObString &str)
if
(
elem
->
name_
.
case_compare
(
"TimeToLive"
)
==
0
)
{
json
::
Value
*
ttl_val
=
elem
->
value_
;
if
(
NULL
!=
ttl_val
&&
ttl_val
->
get_type
()
==
json
::
JT_NUMBER
)
{
time_to_live_
=
static_cast
<
int
64
_t
>
(
ttl_val
->
get_number
());
time_to_live_
=
static_cast
<
int
32
_t
>
(
ttl_val
->
get_number
());
}
}
else
if
(
elem
->
name_
.
case_compare
(
"MaxVersions"
)
==
0
)
{
json
::
Value
*
max_version_val
=
elem
->
value_
;
if
(
NULL
!=
max_version_val
&&
max_version_val
->
get_type
()
==
json
::
JT_NUMBER
)
{
max_version_
=
static_cast
<
int
64
_t
>
(
max_version_val
->
get_number
());
max_version_
=
static_cast
<
int
32
_t
>
(
max_version_val
->
get_number
());
}
}
}
// end foreach
...
...
src/observer/table/ob_table_service.cpp
浏览文件 @
e99cf210
...
...
@@ -2175,9 +2175,7 @@ int ObTableService::execute_ttl_delete(ObTableServiceTTLCtx &ctx, const ObTableT
query
.
get_offset
(),
ctx
.
scan_param_
)))
{
LOG_WARN
(
"failed to fill param"
,
K
(
ret
));
}
else
if
(
OB_FAIL
(
part_service_
->
table_scan
(
ctx
.
scan_param_
,
ctx
.
scan_result_
)))
{
if
(
OB_TRY_LOCK_ROW_CONFLICT
!=
ret
)
{
LOG_WARN
(
"fail to scan table"
,
K
(
ret
));
}
LOG_WARN
(
"fail to scan table"
,
K
(
ret
));
}
else
{
ttl_row_iter
.
set_scan_result
(
ctx
.
scan_result_
);
int64_t
affected_rows
=
0
;
...
...
@@ -2196,9 +2194,7 @@ int ObTableService::execute_ttl_delete(ObTableServiceTTLCtx &ctx, const ObTableT
ctx
.
scan_param_
.
column_ids_
,
&
ttl_row_iter
,
affected_rows
)))
{
if
(
OB_TRY_LOCK_ROW_CONFLICT
!=
ret
)
{
LOG_WARN
(
"failed to delete"
,
K
(
ret
),
K
(
table_id
));
}
LOG_WARN
(
"failed to delete"
,
K
(
ret
),
K
(
table_id
));
}
else
{
LOG_DEBUG
(
"delete rows"
,
K
(
ret
),
K
(
affected_rows
));
}
...
...
@@ -2287,7 +2283,7 @@ int ObTableTTLDeleteRowIterator::get_next_row(ObNewRow*& row)
ObHTableCellEntity
cell
(
row
);
ObString
cell_rowkey
=
cell
.
get_rowkey
();
ObString
cell_qualifier
=
cell
.
get_qualifier
();
int64_t
cell_ts
=
-
cell
.
get_timestamp
();
// obhtable timestamp is nagative
int64_t
cell_ts
=
-
cell
.
get_timestamp
();
// obhtable timestamp is nagative
in ms
if
((
cell_rowkey
!=
cur_rowkey_
)
||
(
cell_qualifier
!=
cur_qualifier_
))
{
cur_version_
=
1
;
cur_rowkey_
=
cell_rowkey
;
...
...
@@ -2300,7 +2296,7 @@ int ObTableTTLDeleteRowIterator::get_next_row(ObNewRow*& row)
cur_del_rows_
++
;
is_last_row_ttl_
=
false
;
break
;
}
else
if
(
time_to_live_
>
0
&&
(
cell_ts
+
time_to_live_
<
ObTimeUtility
::
current_time
()))
{
}
else
if
(
time_to_live_
ms_
>
0
&&
(
cell_ts
+
time_to_live_ms_
<
ObHTableUtils
::
current_time_millis
()))
{
ttl_cnt_
++
;
cur_del_rows_
++
;
is_last_row_ttl_
=
true
;
...
...
@@ -2333,7 +2329,7 @@ void ObTableTTLDeleteRowIterator::reset()
{
is_inited_
=
false
;
scan_result_
=
NULL
;
time_to_live_
=
0
;
time_to_live_
ms_
=
0
;
max_version_
=
0
;
limit_del_rows_
=
0
;
cur_del_rows_
=
0
;
...
...
@@ -2352,7 +2348,7 @@ int ObTableTTLDeleteRowIterator::init(const ObTableTTLOperation &ttl_operation)
ret
=
OB_INVALID_ARGUMENT
;
LOG_WARN
(
"invalid ttl operation"
,
K
(
ret
),
K
(
ttl_operation
));
}
else
{
time_to_live_
=
ttl_operation
.
time_to_live_
;
time_to_live_
ms_
=
ttl_operation
.
time_to_live_
*
1000l
;
max_version_
=
ttl_operation
.
max_version_
;
limit_del_rows_
=
ttl_operation
.
del_row_limit_
;
cur_rowkey_
=
ttl_operation
.
start_rowkey_
;
...
...
src/observer/table/ob_table_service.h
浏览文件 @
e99cf210
...
...
@@ -166,7 +166,7 @@ class ObTableTTLDeleteRowIterator : public common::ObNewRowIterator
{
public:
ObTableTTLDeleteRowIterator
()
:
is_inited_
(
false
),
time_to_live_
(
0
),
max_version
_
(
0
),
is_inited_
(
false
),
max_version_
(
0
),
time_to_live_ms
_
(
0
),
limit_del_rows_
(
-
1
),
cur_del_rows_
(
0
),
cur_version_
(
0
),
cur_rowkey_
(),
cur_qualifier_
(),
max_version_cnt_
(
0
),
ttl_cnt_
(
0
),
scan_cnt_
(
0
),
is_last_row_ttl_
(
true
)
{}
~
ObTableTTLDeleteRowIterator
()
{}
...
...
@@ -177,8 +177,8 @@ public:
public:
bool
is_inited_
;
common
::
ObNewRowIterator
*
scan_result_
;
uint64_t
time_to_live
_
;
uint64_t
max_version_
;
int32_t
max_version
_
;
int64_t
time_to_live_ms_
;
// ttl in millisecond
uint64_t
limit_del_rows_
;
// maximum delete row
uint64_t
cur_del_rows_
;
// current delete row
uint64_t
cur_version_
;
...
...
src/observer/table/ob_table_ttl_manager.cpp
浏览文件 @
e99cf210
...
...
@@ -853,11 +853,16 @@ int ObTTLManager::check_all_tenant_mem()
memstore_limit
,
freeze_cnt
))
)
{
LOG_WARN
(
"fail to get tenant memstore info for tenant "
,
K
(
ret
),
K
(
tenant_id
));
}
else
if
(
active_memstore_used
>
minor_freeze_trigger
)
{
tenant_info
->
ttl_continue_
=
false
;
LOG_INFO
(
"will stop all the running task"
,
K
(
tenant_id
),
K
(
active_memstore_used
),
K
(
minor_freeze_trigger
));
}
else
if
(
total_memstore_used
>
minor_freeze_trigger
)
{
if
(
tenant_info
->
ttl_continue_
)
{
tenant_info
->
ttl_continue_
=
false
;
LOG_INFO
(
"will stop all the running ttl task"
,
K
(
tenant_id
),
K
(
total_memstore_used
),
K
(
minor_freeze_trigger
));
}
}
else
{
tenant_info
->
ttl_continue_
=
true
;
if
(
!
tenant_info
->
ttl_continue_
)
{
tenant_info
->
ttl_continue_
=
true
;
LOG_INFO
(
"continue to execute all the ttl task"
,
K
(
tenant_id
),
K
(
total_memstore_used
),
K
(
minor_freeze_trigger
));
}
}
}
}
...
...
src/observer/table/ob_table_ttl_manager.h
浏览文件 @
e99cf210
...
...
@@ -101,7 +101,7 @@ private:
is_usr_trigger_
(
false
),
need_check_
(
false
),
is_dirty_
(
false
),
ttl_continue_
(
fals
e
),
ttl_continue_
(
tru
e
),
cmd_type_
(
obrpc
::
ObTTLRequestArg
::
TTL_INVALID_TYPE
),
rsp_time_
(
OB_INVALID_ID
),
state_
(
common
::
ObTTLTaskStatus
::
OB_TTL_TASK_INVALID
),
...
...
src/observer/table/ob_table_ttl_task.cpp
浏览文件 @
e99cf210
...
...
@@ -303,7 +303,7 @@ int ObTableTTLDeleteTask::process_one()
if
(
OB_FAIL
(
start_trans
()))
{
LOG_WARN
(
"fail to start tx"
,
K
(
ret
));
}
else
if
(
OB_FAIL
(
GCTX
.
table_service_
->
execute_ttl_delete
(
ctx
,
op
,
result
)))
{
LOG_WARN
(
"fail to execute ttl delete"
,
K
(
ret
));
LOG_WARN
(
"fail to execute ttl delete
, need rollback
"
,
K
(
ret
));
}
else
{
/* do nothing */
}
ctx
.
reset_ttl_ctx
(
GCTX
.
par_ser_
);
...
...
src/share/table/ob_table.h
浏览文件 @
e99cf210
...
...
@@ -329,8 +329,8 @@ private:
class
ObTableTTLOperation
{
public:
ObTableTTLOperation
(
uint64_t
tenant_id
,
uint64_t
table_id
,
uint64
_t
max_version
,
int
64
_t
time_to_live
,
uint64_t
del_row_limit
,
ObString
start_rowkey
,
ObTableTTLOperation
(
uint64_t
tenant_id
,
uint64_t
table_id
,
int32
_t
max_version
,
int
32
_t
time_to_live
,
uint64_t
del_row_limit
,
ObString
start_rowkey
,
ObString
start_qualifier
)
:
tenant_id_
(
tenant_id
),
table_id_
(
table_id
),
max_version_
(
max_version
),
time_to_live_
(
time_to_live
),
del_row_limit_
(
del_row_limit
),
...
...
@@ -346,8 +346,8 @@ public:
public:
uint64_t
tenant_id_
;
uint64_t
table_id_
;
uint64
_t
max_version_
;
int
64
_t
time_to_live_
;
int32
_t
max_version_
;
int
32
_t
time_to_live_
;
uint64_t
del_row_limit_
;
ObString
start_rowkey_
;
ObString
start_qualifier_
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录