Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
soremi
oceanbase
提交
5aff2175
O
oceanbase
项目概览
soremi
/
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,发现更多精彩内容 >>
提交
5aff2175
编写于
5月 26, 2022
作者:
Y
YoungYang0820
提交者:
wangzelin.wzl
5月 26, 2022
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[CP] fix create local index too slow due to iterating __all_virtual_storage_stat
上级
a9cc1b8c
变更
10
隐藏空白更改
内联
并排
Showing
10 changed file
with
123 addition
and
39 deletion
+123
-39
deps/oblib/src/rpc/obrpc/ob_rpc_packet_list.h
deps/oblib/src/rpc/obrpc/ob_rpc_packet_list.h
+1
-0
src/observer/ob_rpc_processor_simple.cpp
src/observer/ob_rpc_processor_simple.cpp
+32
-0
src/observer/ob_rpc_processor_simple.h
src/observer/ob_rpc_processor_simple.h
+2
-0
src/observer/ob_srv_xlator_storage.cpp
src/observer/ob_srv_xlator_storage.cpp
+1
-0
src/rootserver/ob_root_service.cpp
src/rootserver/ob_root_service.cpp
+4
-1
src/share/ob_rpc_struct.cpp
src/share/ob_rpc_struct.cpp
+25
-0
src/share/ob_rpc_struct.h
src/share/ob_rpc_struct.h
+41
-0
src/share/ob_srv_rpc_proxy.h
src/share/ob_srv_rpc_proxy.h
+2
-0
src/storage/ob_build_index_scheduler.cpp
src/storage/ob_build_index_scheduler.cpp
+12
-36
src/storage/ob_build_index_task.cpp
src/storage/ob_build_index_task.cpp
+3
-2
未找到文件。
deps/oblib/src/rpc/obrpc/ob_rpc_packet_list.h
浏览文件 @
5aff2175
...
...
@@ -204,6 +204,7 @@ PCODE_DEF(OB_REVOKE_SYSPRIV, 0x270)
PCODE_DEF
(
OB_EXECUTE_RANGE_PART_SPLIT
,
0x271
)
PCODE_DEF
(
OB_CLUSTER_ACTION_VERIFY
,
0x273
)
PCODE_DEF
(
OB_SUBMIT_BUILD_INDEX_TASK
,
0x274
)
PCODE_DEF
(
OB_FETCH_SSTABLE_SIZE
,
0x275
)
// system admin commnad
PCODE_DEF
(
OB_ADMIN_SWITCH_REPLICA_ROLE
,
0x280
)
...
...
src/observer/ob_rpc_processor_simple.cpp
浏览文件 @
5aff2175
...
...
@@ -1992,5 +1992,37 @@ int ObKillPartTransCtxP::process()
return
ret
;
}
int
ObFetchSstableSizeP
::
process
()
{
int
ret
=
OB_SUCCESS
;
ObPartitionStorage
*
storage
=
NULL
;
ObTableHandle
sstable_handle
;
ObIPartitionGroupGuard
guard
;
ObPGPartitionGuard
pg_partition_guard
;
ObSSTable
*
sstable
=
nullptr
;
if
(
OB_FAIL
(
gctx_
.
par_ser_
->
get_partition
(
arg_
.
pkey_
,
guard
))
||
NULL
==
guard
.
get_partition_group
())
{
LOG_WARN
(
"get_partition_storage fail"
,
"pkey"
,
arg_
);
ret
=
OB_ENTRY_NOT_EXIST
;
}
else
if
(
OB_FAIL
(
guard
.
get_partition_group
()
->
get_pg_partition
(
arg_
.
pkey_
,
pg_partition_guard
)))
{
LOG_WARN
(
"get pg partition fail"
,
K
(
ret
),
"pkey"
,
arg_
.
pkey_
);
}
else
if
(
OB_ISNULL
(
storage
=
static_cast
<
ObPartitionStorage
*>
(
pg_partition_guard
.
get_pg_partition
()
->
get_storage
())))
{
ret
=
OB_ERR_UNEXPECTED
;
LOG_WARN
(
"get_partition_storage fail"
,
"pkey"
,
arg_
.
pkey_
);
}
else
if
(
OB_FAIL
(
storage
->
get_partition_store
().
get_last_major_sstable
(
arg_
.
index_id_
,
sstable_handle
)))
{
LOG_WARN
(
"fail to get index major sstable handle"
,
K
(
ret
),
K_
(
arg
));
}
else
if
(
OB_FAIL
(
sstable_handle
.
get_sstable
(
sstable
)))
{
LOG_WARN
(
"fail to get index major sstable handle"
,
K
(
ret
),
K_
(
arg
));
}
else
if
(
OB_ISNULL
(
sstable
))
{
ret
=
OB_ERR_UNEXPECTED
;
LOG_WARN
(
"index sstable is null"
,
K
(
ret
),
K_
(
arg
));
}
else
{
const
blocksstable
::
ObSSTableMeta
&
sstable_meta
=
sstable
->
get_meta
();
result_
.
size_
=
sstable_meta
.
get_total_macro_block_count
()
*
OB_FILE_SYSTEM
.
get_macro_block_size
();
}
return
ret
;
}
}
// end of namespace observer
}
// end of namespace oceanbase
src/observer/ob_rpc_processor_simple.h
浏览文件 @
5aff2175
...
...
@@ -226,6 +226,8 @@ OB_DEFINE_PROCESSOR_S(Common, OB_GET_MASTER_RS, ObRpcGetMasterRSP);
OB_DEFINE_PROCESSOR_S
(
Srv
,
OB_CHECK_PHYSICAL_FLASHBACK_SUCC
,
ObCheckPhysicalFlashbackSUCCP
);
OB_DEFINE_PROCESSOR_S
(
Srv
,
OB_RENEW_IN_ZONE_HB
,
ObRenewInZoneHbP
);
OB_DEFINE_PROCESSOR_S
(
Srv
,
OB_KILL_PART_TRANS_CTX
,
ObKillPartTransCtxP
);
OB_DEFINE_PROCESSOR_S
(
Srv
,
OB_FETCH_SSTABLE_SIZE
,
ObFetchSstableSizeP
);
}
// end of namespace observer
}
// end of namespace oceanbase
...
...
src/observer/ob_srv_xlator_storage.cpp
浏览文件 @
5aff2175
...
...
@@ -131,4 +131,5 @@ void oceanbase::observer::init_srv_xlator_for_storage(ObSrvRpcXlator* xlator)
RPC_PROCESSOR
(
ObRpcValidateBackupBatchP
,
gctx_
);
RPC_PROCESSOR
(
ObRpcBackupArchiveLogBatchP
,
gctx_
);
RPC_PROCESSOR
(
ObRpcBackupBackupsetBatchP
,
gctx_
);
RPC_PROCESSOR
(
ObFetchSstableSizeP
,
gctx_
);
}
src/rootserver/ob_root_service.cpp
浏览文件 @
5aff2175
...
...
@@ -7804,7 +7804,10 @@ int ObRootService::observer_copy_local_index_sstable(const obrpc::ObServerCopyLo
}
else
if
(
OB_FAIL
(
rebalance_task_mgr_
.
add_task
(
task
)))
{
LOG_WARN
(
"fail to add task"
,
K
(
ret
),
K
(
task
));
}
else
{
LOG_INFO
(
"add copy local index sstable task"
,
K
(
ret
));
ROOTSERVICE_EVENT_ADD
(
"balancer"
,
"add_copy_sstable_task"
,
"partition"
,
ReplicaInfo
(
pkey
,
data_size
),
"source"
,
src_member
,
"destination"
,
dest_replica
);
}
}
}
...
...
src/share/ob_rpc_struct.cpp
浏览文件 @
5aff2175
...
...
@@ -4939,5 +4939,30 @@ int ObSubmitBuildIndexTaskArg::assign(const ObSubmitBuildIndexTaskArg &other)
OB_SERIALIZE_MEMBER
((
ObSubmitBuildIndexTaskArg
,
ObDDLArg
),
index_tid_
);
OB_SERIALIZE_MEMBER
(
ObFetchSstableSizeArg
,
pkey_
,
index_id_
);
int
ObFetchSstableSizeArg
::
assign
(
const
ObFetchSstableSizeArg
&
other
)
{
int
ret
=
OB_SUCCESS
;
if
(
this
==
&
other
)
{
}
else
{
pkey_
=
other
.
pkey_
;
index_id_
=
other
.
index_id_
;
}
return
ret
;
}
OB_SERIALIZE_MEMBER
(
ObFetchSstableSizeRes
,
size_
);
int
ObFetchSstableSizeRes
::
assign
(
const
ObFetchSstableSizeRes
&
other
)
{
int
ret
=
OB_SUCCESS
;
if
(
this
==
&
other
)
{
}
else
{
size_
=
other
.
size_
;
}
return
ret
;
}
}
// end namespace obrpc
}
// namespace oceanbase
src/share/ob_rpc_struct.h
浏览文件 @
5aff2175
...
...
@@ -8346,6 +8346,47 @@ public:
uint64_t
index_tid_
;
};
struct
ObFetchSstableSizeArg
final
{
OB_UNIS_VERSION
(
1
);
public:
ObFetchSstableSizeArg
()
:
pkey_
(),
index_id_
(
-
1
)
{}
~
ObFetchSstableSizeArg
()
{}
bool
is_valid
()
const
{
return
pkey_
.
is_valid
()
&&
index_id_
>
0
;
}
int
assign
(
const
ObFetchSstableSizeArg
&
other
);
TO_STRING_KV
(
K_
(
pkey
),
K_
(
index_id
));
public:
common
::
ObPartitionKey
pkey_
;
int64_t
index_id_
;
private:
DISALLOW_COPY_AND_ASSIGN
(
ObFetchSstableSizeArg
);
};
struct
ObFetchSstableSizeRes
final
{
OB_UNIS_VERSION
(
1
);
public:
ObFetchSstableSizeRes
()
:
size_
(
0
)
{}
~
ObFetchSstableSizeRes
()
{}
int
assign
(
const
ObFetchSstableSizeRes
&
other
);
TO_STRING_KV
(
K_
(
size
));
public:
int64_t
size_
;
private:
DISALLOW_COPY_AND_ASSIGN
(
ObFetchSstableSizeRes
);
};
}
// end namespace obrpc
}
// end namespace oceanbase
#endif
src/share/ob_srv_rpc_proxy.h
浏览文件 @
5aff2175
...
...
@@ -208,6 +208,8 @@ public:
RPC_S
(
PR5
renew_in_zone_hb
,
OB_RENEW_IN_ZONE_HB
,
(
share
::
ObInZoneHbRequest
),
share
::
ObInZoneHbResponse
);
RPC_AP
(
PR5
batch_get_protection_level
,
OB_BATCH_GET_PROTECTION_LEVEL
,
(
ObBatchCheckLeaderArg
),
ObBatchCheckRes
);
RPC_S
(
PR5
kill_part_trans_ctx
,
OB_KILL_PART_TRANS_CTX
,
(
obrpc
::
ObKillPartTransCtxArg
));
RPC_S
(
PR5
fetch_sstable_size
,
obrpc
::
OB_FETCH_SSTABLE_SIZE
,
(
obrpc
::
ObFetchSstableSizeArg
),
obrpc
::
ObFetchSstableSizeRes
);
};
// end of class ObSrvRpcProxy
}
// namespace obrpc
...
...
src/storage/ob_build_index_scheduler.cpp
浏览文件 @
5aff2175
...
...
@@ -1419,42 +1419,18 @@ int ObBuildIndexScheduleTask::schedule_dag()
int
ObBuildIndexScheduleTask
::
get_data_size
(
int64_t
&
data_size
)
{
int
ret
=
OB_SUCCESS
;
ObSqlString
sql
;
SMART_VAR
(
ObMySQLProxy
::
MySQLResult
,
res
)
{
sqlclient
::
ObMySQLResult
*
result
=
NULL
;
char
ip
[
common
::
OB_MAX_SERVER_ADDR_SIZE
]
=
""
;
if
(
OB_INVALID_ID
==
index_id_
||
!
pkey_
.
is_valid
()
||
!
candidate_replica_
.
is_valid
())
{
ret
=
OB_INVALID_ARGUMENT
;
LOG_WARN
(
"invalid arguments"
,
K
(
ret
),
K
(
index_id_
),
K
(
pkey_
),
K
(
candidate_replica_
));
}
else
if
(
!
candidate_replica_
.
ip_to_string
(
ip
,
sizeof
(
ip
)))
{
LOG_WARN
(
"fail to convert ObAddr to ip"
,
K
(
ret
));
}
else
if
(
OB_FAIL
(
sql
.
assign_fmt
(
"SELECT used_size, MAX(major_version) from %s "
"WHERE tenant_id = %ld AND table_id = %ld AND partition_id = %ld AND sstable_id = %ld "
"AND svr_ip = '%s' AND svr_port = %d"
,
OB_ALL_VIRTUAL_STORAGE_STAT_TNAME
,
extract_tenant_id
(
index_id_
),
pkey_
.
get_table_id
(),
pkey_
.
get_partition_id
(),
index_id_
,
ip
,
candidate_replica_
.
get_port
())))
{
STORAGE_LOG
(
WARN
,
"fail to assign sql"
,
K
(
ret
));
}
else
if
(
OB_FAIL
(
GCTX
.
sql_proxy_
->
read
(
res
,
sql
.
ptr
())))
{
LOG_WARN
(
"fail to execute sql"
,
K
(
ret
),
K
(
sql
));
}
else
if
(
OB_ISNULL
(
result
=
res
.
get_result
()))
{
ret
=
OB_ERR_UNEXPECTED
;
STORAGE_LOG
(
WARN
,
"error unexpected, query result must not be NULL"
,
K
(
ret
));
}
else
if
(
OB_FAIL
(
result
->
next
()))
{
if
(
OB_LIKELY
(
OB_ITER_END
==
ret
))
{
ret
=
OB_SUCCESS
;
}
else
{
LOG_WARN
(
"fail to get next row"
,
K
(
ret
));
}
}
else
{
EXTRACT_INT_FIELD_MYSQL
(
*
result
,
"used_size"
,
data_size
,
int64_t
);
}
data_size
=
0
;
ObFetchSstableSizeArg
arg
;
ObFetchSstableSizeRes
res
;
arg
.
pkey_
=
pkey_
;
arg
.
index_id_
=
index_id_
;
if
(
OB_UNLIKELY
(
candidate_replica_
.
is_valid
()))
{
ret
=
OB_ERR_UNEXPECTED
;
STORAGE_LOG
(
WARN
,
"candidate replica is invalid"
,
K
(
ret
),
K
(
candidate_replica_
));
}
else
if
(
OB_FAIL
(
GCTX
.
srv_rpc_proxy_
->
to
(
candidate_replica_
).
fetch_sstable_size
(
arg
,
res
)))
{
STORAGE_LOG
(
WARN
,
"fail to get sstable size"
,
K
(
ret
),
K
(
arg
));
}
else
{
data_size
=
res
.
size_
;
}
return
ret
;
}
...
...
src/storage/ob_build_index_task.cpp
浏览文件 @
5aff2175
...
...
@@ -146,10 +146,11 @@ int ObBuildIndexDag::fill_comment(char* buf, const int64_t buf_len) const
STORAGE_LOG
(
WARN
,
"ObBuildIndexDag has not been inited"
,
K
(
ret
));
}
else
if
(
OB_FAIL
(
databuff_printf
(
buf
,
buf_len
,
"build index task:
key=%s index_id=%ld snapshot_version
=%ld"
,
"build index task:
pkey=%s index_id=%ld snapshot_version=%ld parallelism
=%ld"
,
to_cstring
(
pkey_
),
index_id
,
param_
.
snapshot_version_
)))
{
param_
.
snapshot_version_
,
param_
.
concurrent_cnt_
)))
{
STORAGE_LOG
(
WARN
,
"failed to fill comment"
,
K
(
ret
),
K
(
pkey_
));
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录