提交 33f67070 编写于 作者: S SanmuWangZJU 提交者: LINGuanRen

[virtual_table] add column to expose the commit timestamp of eldest clog

上级 acaa03ed
......@@ -149,6 +149,25 @@ int ObAllVirtualServerClogStat::inner_get_next_row(ObNewRow*& row)
cells[cell_idx].set_varchar(ObZoneStatus::get_status_str(locality_info.local_zone_status_));
break;
}
case SVR_MIN_LOG_TIMESTAMP: {
if (OB_ISNULL(clog_mgr)) {
cells[cell_idx].set_int(OB_INVALID_TIMESTAMP);
} else {
// display server_min_log_ts 60s ahead of ts get from clog_mgr
static int64_t DISPLAY_AHEAD_TIME = 60 * 1000 * 1000;
int64_t svr_min_log_ts = OB_INVALID_TIMESTAMP;
if (OB_FAIL(clog_mgr->get_server_min_log_ts(svr_min_log_ts))) {
SERVER_LOG(WARN, "get_svr_min_log_ts failed", KR(ret), K(svr_min_log_ts));
svr_min_log_ts = OB_INVALID_TIMESTAMP;
ret = OB_SUCCESS;
} else {
// svr_min_log_ts is min clog ts on this server, the log may not confirmed
svr_min_log_ts += DISPLAY_AHEAD_TIME;
}
cells[cell_idx].set_int(svr_min_log_ts);
}
break;
}
default: {
ret = OB_ERR_UNEXPECTED;
SERVER_LOG(WARN, "invalid column id", K(ret), K(cell_idx), K(output_column_ids_), K(col_id));
......
......@@ -42,7 +42,8 @@ private:
IDC,
ZONE_TYPE,
MERGE_STATUS,
ZONE_STATUS
ZONE_STATUS,
SVR_MIN_LOG_TIMESTAMP
};
common::ObAddr* addr_;
common::ObString ipstr_;
......
......@@ -6454,6 +6454,21 @@ int ObInnerTableSchema::all_virtual_server_clog_stat_schema(ObTableSchema &table
false, //is_nullable
false); //is_autoincrement
}
if (OB_SUCC(ret)) {
ADD_COLUMN_SCHEMA("svr_min_log_timestamp", //column_name
++column_id, //column_id
0, //rowkey_id
0, //index_id
0, //part_key_pos
ObIntType, //column_type
CS_TYPE_INVALID, //column_collation_type
sizeof(int64_t), //column_length
-1, //column_precision
-1, //column_scale
false, //is_nullable
false); //is_autoincrement
}
if (OB_SUCC(ret)) {
table_schema.get_part_option().set_part_func_type(PARTITION_FUNC_TYPE_HASH);
if (OB_FAIL(table_schema.get_part_option().set_part_expr("hash (addr_to_partition_id(svr_ip, svr_port))"))) {
......
......@@ -7233,6 +7233,7 @@ def_table_schema(
('zone_type', 'varchar:MAX_ZONE_INFO_LENGTH'),
('merge_status', 'varchar:MAX_ZONE_INFO_LENGTH'),
('zone_status', 'varchar:MAX_ZONE_INFO_LENGTH'),
('svr_min_log_timestamp', 'int'),
],
partition_columns = ['svr_ip', 'svr_port'],
)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册