首批通过分布式安全可靠测评,为关键业务系统打造
分区守护任务管理的表
更新时间:2026-04-14 15:15:57
分区守护是 OCP 为 ocp_monitor 租户的分区表提前创建分区的任务,当创建分区失败后可能会影响监控数据的写入,此时会产生告警提醒用户潜在问题。 本节为您介绍 MonitorDB 中被分区守护任务所管理的表、守护任务为这些表创建分区的规则等信息。
MonitorDB
| 表名 | 分区规则 | 分区命名规则 | 分区保留时间 | 分区提前创建时间 |
|---|---|---|---|---|
| ob_cluster_system_event | daily | p + 每天起始时间微秒,如 p1628870400000000 | 31 天 | 2 天 |
| ocp_metric_data_1 | daily | p + 每天起始时间秒数,如 p1629907200 | 8 天 | 2 天 |
| ocp_metric_data_60 | daily | p + 每天起始时间秒数,如 p1629907200 | 31 天 | 2 天 |
| metric_data_second | daily | p + 每天起始时间秒数,如 p1629907200 | 8 天 | 2 天 |
| metric_data_minute | daily | p + 每天起始时间秒数,如 p1629907200 | 31 天 | 2 天 |
| metric_data_hour | yearly | p + 年数,如 p2021 | 3 年 | 1 年 |
| metric_hour_data | yearly | p + 年数,如 p2021 | 3 年 | 1 年 |
| metric_data_daily | yearly | p + 年数,如 p2021 | 3 年 | 1 年 |
| metric_daily_data | yearly | p + 年数,如 p2021 | 3 年 | 3 年 |
| metric_data_async | daily | p + 每天起始时间秒数,如 p1629907200 | 3 年 | 1 天 |
| sql_aggregate_data | daily | p + 每天起始时间秒数,如 p1629907200 | 2 天 | 8 天 |
| ob_tenant_mini_compaction_info | daily | p + 每天起始时间秒数,如 p1629907200 | 2 天 | 7 天 |
| ob_hist_partition_stats_compressed | yearly | p + 年数,如 p2021 | 3 年 | 1 年 |
| ob_hist_active_session_stat_0 | daily | P + 日期,如 P20210911 | 8 天 | 8 天 |
| ob_hist_sql_audit_stat_0 | daily | P + 日期,如 P20210911 | 2 天 | 8 天 |
| ob_hist_sql_audit_stat_1 | daily | P + 日期,如 P20210911 | 8 天 | 8 天 |
| ob_hist_sql_audit_stat_2 | daily | P + 日期,如 P20210911 | 15 天 | 8 天 |
| ob_hist_sql_audit_stat | daily | P + 日期,如 P20210911 | 30 天 | 8 天 |
| ocp_perf_sql_diagnosis_task | daily | P + 日期,如 P20210911 | 30 天 | 8 天 |
| ocp_perf_sql_diagnosis | daily | P + 日期,如 P20210911 | 30 天 | 8 天 |
| ob_hist_sqltext | daily | P + 日期,如 P20210911 | 30 天 | 8 天 |
| ob_hist_plan_cache_plan_stat_0 | daily | P + 日期,如 P20210911 | 30 天 | 8 天 |
| ob_hist_plan_cache_plan | daily | P + 日期,如 P20210911 | 30 天 | 8 天 |
| ob_hist_plan_cache_plan_explain | daily | P + 日期,如 P20210911 | 30 天 | 8 天 |
| ob_hist_sql_audit_sample | daily | P + 日期,如 P20210911 | 7 天 | 8 天 |
| ob_hist_sql_plan_monitor | daily | P + 日期,如 P20210911 | 7 天 | 15 天 |
| ob_hist_trans_stat | daily | P + 日期,如 P20210911 | 8 天 | 7 天 |
| ob_hist_snapshot | monthly | P + 日期,如 P202110 | 93 天 | 8 天 |
| ob_hist_cluster | monthly | P + 日期,如 P202110 | 93 天 | 8 天 |
| ob_hist_tenant | monthly | P + 日期,如 P202110 | 93 天 | 8 天 |
| ob_hist_sysstat | monthly | P + 日期,如 P202110 | 93 天 | 8 天 |
| ob_hist_replica | monthly | P + 日期,如 P202110 | 93 天 | 8 天 |
| ob_hist_server | monthly | P + 日期,如 P202110 | 93 天 | 8 天 |
| ob_hist_row_lock | monthly | P + 日期,如 P202110 | 93 天 | 8 天 |
| ob_hist_latch | monthly | P + 日期,如 P202110 | 93 天 | 8 天 |
| ob_hist_rpc | monthly | P + 日期,如 P202110 | 93 天 | 8 天 |
| ob_hist_packet | monthly | P + 日期,如 P202110 | 93 天 | 8 天 |
| ob_hist_location_cache | monthly | P + 日期,如 P202110 | 93 天 | 8 天 |
| ob_hist_clog | monthly | P + 日期,如 P202110 | 93 天 | 8 天 |
| ob_hist_gts | monthly | P + 日期,如 P202110 | 93 天 | 8 天 |
| ob_hist_cache | monthly | P + 日期,如 P202110 | 93 天 | 8 天 |
| ob_hist_parameter | monthly | P + 日期,如 P202110 | 93 天 | 8 天 |
| ob_hist_system_event | monthly | P + 日期,如 P202110 | 93 天 | 8 天 |
| ob_hist_memory | monthly | P + 日期,如 P202110 | 93 天 | 8 天 |
| ob_hist_partition_hit | monthly | P + 日期,如 P202110 | 93 天 | 8 天 |
使用样例
以下以 metric_daily_data 分区为例。
> show create table metric_daily_data\G
*************************** 1. row ***************************
Table: metric_daily_data
Create Table: CREATE TABLE `metric_daily_data` (
`series_id` bigint(20) NOT NULL COMMENT '指标序列ID',
`timestamp` bigint(20) NOT NULL COMMENT '时间戳,单位(秒)',
`value` double NOT NULL COMMENT '值',
PRIMARY KEY (`series_id`, `timestamp`)
) DEFAULT CHARSET = utf8mb4 COMMENT = '监控 daily 指标数据'
partition by range columns(`timestamp`)
(partition DUMMY values less than (0),
partition p2019 values less than (1577836800),
partition p2020 values less than (1609459200),
partition p2021 values less than (1640995200),
partition p2022 values less than (1672531200),
partition p2023 values less than (1704067200));
metric_daily_data 分区命名规则为 p+ 年份,分区保留时间为 3 年,分区提前创建时间为 1 年,分区时间戳为 UTC 时间。在如上示例中:
p2019 表示将 `timestamp` 小于 1577836800 的设为一个分区,并命名为 p2019。
p2019、p2020、p2021 为保留历史数据的分区。
p2022 为当前时间的分区。
p2023 为提前创建的分区。