Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

info replication 中的 db_repl_state 输出信息组织方式不够友好,建议优化 #2514

Open
chengyu-l opened this issue Mar 14, 2024 · 1 comment
Assignees
Labels
☢️ Bug Something isn't working

Comments

@chengyu-l
Copy link
Collaborator

Is this a regression?

Yes

Description

单个 DB info replication 输出信息如下:
=======
# Replication(SLAVE)
role:slave
ReplicationID:8e90a1b15a1e384699975fcfa195c68a2206e747e69004c0b1
master_host:10.224.129.104
master_port:9971
master_link_status:down
slave_priority:100
slave_read_only:1
db_repl_state:(db0:WaitDBSync)
db0:binlog_offset=0 0,safety_purge=none

多个 DB (这里以2个为例)info replication 输出信息如下:
=======
# Replication(SLAVE)
role:slave
ReplicationID:8e90a1b15a1e384699975fcfa195c68a2206e747e69004c0b1
master_host:10.224.129.104
master_port:9971
master_link_status:down
slave_priority:100
slave_read_only:1
db_repl_state:(db0:WaitDBSync)(db1:NoConnect)
db0:binlog_offset=0 0,safety_purge=none
db1:binlog_offset=0 0,safety_purge=none

info replication 中的 db_repl_state 输出信息组织方式个人感觉不够友好,尤其是程序解析。这里建议优化一下,将这个状态放置在 db0 或 db1 那行信息中,因为本身这两部分信息都是 db 维度。

仍以2个DB为例,优化后的 info replication 输出信息如下:
=======
# Replication(SLAVE)
role:slave
ReplicationID:8e90a1b15a1e384699975fcfa195c68a2206e747e69004c0b1
master_host:10.224.129.104
master_port:9971
master_link_status:down
slave_priority:100
slave_read_only:1
db0:binlog_offset=0 0,safety_purge=none,db_repl_state=WaitDBSync
db1:binlog_offset=0 0,safety_purge=none,db_repl_state=NoConnect

Please provide a link to a minimal reproduction of the bug

No response

Screenshots or videos

No response

Please provide the version you discovered this bug in (check about page for version information)

No response

Anything else?

No response

@chengyu-l chengyu-l added the ☢️ Bug Something isn't working label Mar 14, 2024
@chengyu-l chengyu-l self-assigned this Mar 14, 2024
@chengyu-l
Copy link
Collaborator Author

chengyu-l commented Mar 18, 2024

redis 1个 DB 和 2 个 DB 在做全量同步过程中,以及全量同步完成的 info replication 相同。下面分别给出了 info replication 的输出信息。

redis slave 全量同步过程中,info replication 的信息如下

127.0.0.1:6379> info replication
# Replication
role:slave
master_host:10.224.129.104
master_port:6379
master_link_status:down
master_last_io_seconds_ago:-1
master_sync_in_progress:1
slave_read_repl_offset:0
slave_repl_offset:0
master_sync_total_bytes:3488676895
master_sync_read_bytes:1392640000
master_sync_left_bytes:2096036895
master_sync_perc:39.92
master_sync_last_io_seconds_ago:0
master_link_down_since_seconds:-1
slave_priority:100
slave_read_only:1
replica_announced:1
connected_slaves:0
master_failover_state:no-failover
master_replid:04d92237fda2b776752066129c0a83da45a679d6
master_replid2:0000000000000000000000000000000000000000
master_repl_offset:0
second_repl_offset:-1
repl_backlog_active:0
repl_backlog_size:1048576
repl_backlog_first_byte_offset:0
repl_backlog_histlen:0

redis slave 全量同步完成后,info replication 的信息如下

127.0.0.1:6379> info replication
# Replication
role:slave
master_host:10.224.129.104
master_port:6379
master_link_status:up
master_last_io_seconds_ago:2
master_sync_in_progress:0
slave_read_repl_offset:8176
slave_repl_offset:8176
slave_priority:100
slave_read_only:1
replica_announced:1
connected_slaves:0
master_failover_state:no-failover
master_replid:1b8e0352ad498a230fb06d320b62d698b6128817
master_replid2:0000000000000000000000000000000000000000
master_repl_offset:8176
second_repl_offset:-1
repl_backlog_active:1
repl_backlog_size:1048576
repl_backlog_first_byte_offset:8093
repl_backlog_histlen:84
127.0.0.1:6379>

从上述信息中可以看出,slave 节点 redis 的 info replication 中没有对不同 db 的信息进行区分(类似 pika 中 db0/db1),也没有db_repl_state 信息

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
☢️ Bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant