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

增加replica的failover功能的注释 #103

Open
wants to merge 1 commit into
base: 7.0-cn-annotated
Choose a base branch
from

Conversation

artikell
Copy link

No description provided.

Copy link
Member

@ncghost1 ncghost1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

先做了点格式上的修改,也顺便看了一下有点懵,机翻得太多了。

@@ -3610,6 +3610,11 @@ void bgsaveCommand(client *c) {
* pointer if the instance has a valid master client, otherwise NULL
* is returned, and the RDB saving will not persist any replication related
* information. */
/* 填充 rdbSaveInfo 结构,该结构用于将复制信息保存在 RDB 文件中。
* 当前,该结构仅显式地包含来自主流的当前选定DB,但是,如果 rdbSave*() 系列函数接收到 NULL 的 rsi 结构,则不会保存复制 ID/偏移量。
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* 当前该结构仅显式地包含来自主流的当前选定DB但是如果 rdbSave*() 系列函数接收到 NULL rsi 结构则不会保存复制 ID/偏移量
* 当前该结构仅显式地包含来自主流的当前选定 DB但是如果 rdbSave*() 系列函数接收到 NULL rsi 结构则不会保存复制 ID/偏移量

@@ -3610,6 +3610,11 @@ void bgsaveCommand(client *c) {
* pointer if the instance has a valid master client, otherwise NULL
* is returned, and the RDB saving will not persist any replication related
* information. */
/* 填充 rdbSaveInfo 结构,该结构用于将复制信息保存在 RDB 文件中。
* 当前,该结构仅显式地包含来自主流的当前选定DB,但是,如果 rdbSave*() 系列函数接收到 NULL 的 rsi 结构,则不会保存复制 ID/偏移量。
* 该函数填充通常在调用程序中堆栈分配的 “rsi” ,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* 该函数填充通常在调用程序中堆栈分配的 rsi
* 该函数填充通常在调用程序中堆栈分配的 "rsi"

/* 填充 rdbSaveInfo 结构,该结构用于将复制信息保存在 RDB 文件中。
* 当前,该结构仅显式地包含来自主流的当前选定DB,但是,如果 rdbSave*() 系列函数接收到 NULL 的 rsi 结构,则不会保存复制 ID/偏移量。
* 该函数填充通常在调用程序中堆栈分配的 “rsi” ,
* 如果实例具有有效的主客户端,则返回填充的指针,否则返回 NULL ,并且 RDB 保存不会保留任何与复制相关的信息*/
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* 如果实例具有有效的主客户端则返回填充的指针否则返回 NULL并且 RDB 保存不会保留任何与复制相关的信息*/
* 如果实例具有有效的主客户端则返回填充的指针否则返回 NULL并且 RDB 保存不会保留任何与复制相关的信息

* 当前,该结构仅显式地包含来自主流的当前选定DB,但是,如果 rdbSave*() 系列函数接收到 NULL 的 rsi 结构,则不会保存复制 ID/偏移量。
* 该函数填充通常在调用程序中堆栈分配的 “rsi” ,
* 如果实例具有有效的主客户端,则返回填充的指针,否则返回 NULL ,并且 RDB 保存不会保留任何与复制相关的信息*/
/* 当前方法主要会写入当前的 dbid ,分别来自于 slaveseld、master->db、cache_master->db */
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
/* 当前方法主要会写入当前的 dbid ,分别来自于 slaveseld、master->db、cache_master->db */
* 当前方法主要会写入当前的 dbid分别来自于 slaveseldmaster->dbcache_master->db */

@@ -1022,18 +1037,23 @@ int startBgsaveForReplication(int mincapa, int req) {
* that we don't set the flag to 1 if the feature is disabled, otherwise
* it would never be cleared: the file is not deleted. This way if
* the user enables it later with CONFIG SET, we are fine. */
/* 如果我们成功地启动了一个带有磁盘目标的 BGSAVE ,让我们记住这个事实,以便稍后在需要时删除该文件。
* 请注意,如果功能被禁用,我们不会将标志设置为1,否则它将永远不会被清除:文件不会被删除。
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* 请注意如果功能被禁用我们不会将标志设置为1否则它将永远不会被清除文件不会被删除
* 请注意如果功能被禁用我们不会将标志设置为 1否则它将永远不会被清除文件不会被删除

void removeRDBUsedToSyncReplicas(void) {
/* If the feature is disabled, return ASAP but also clear the
* RDBGeneratedByReplication flag in case it was set. Otherwise if the
* feature was enabled, but gets disabled later with CONFIG SET, the
* flag may remain set to one: then next time the feature is re-enabled
* via CONFIG SET we have it set even if no RDB was generated
* because of replication recently. */
/* 如果该功能被禁用,请尽快返回,但如果设置了 RDBGeneratedByReplication 标志,请清除该标志。否则,如果该功能已启用,
* 但稍后使用 CONFIG SET 被禁用,则该标志可能会保持为1
* 那么下次通过 CONFIG NET 重新启用该功能时,即使最近由于复制而没有生成 RDB,我们也会将其设置为1 */
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* 那么下次通过 CONFIG NET 重新启用该功能时即使最近由于复制而没有生成 RDB我们也会将其设置为1 */
* 那么下次通过 CONFIG SET 重新启用该功能时即使最近由于复制而没有生成 RDB我们也会将其设置为 1 */

@@ -3932,6 +4001,7 @@ void waitCommand(client *c) {

/* Make sure that the server will send an ACK request to all the slaves
* before returning to the event loop. */
/* 在返回事件循环之前,确保服务器将向所有从节点发送ACK请求 */
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
/* 在返回事件循环之前,确保服务器将向所有从节点发送ACK请求 */
/* 在返回事件循环之前,确保服务器将向所有从节点发送 ACK 请求 */

* 此命令将协调主节点和从节点之间的故障转移
* 包含以下步骤:
* 1. 主节点将启动客户端暂停写入,以停止复制。
* 2. 主节点将定期检查其任何副本是否具有通过ack消耗了整个复制流。
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* 2. 主节点将定期检查其任何副本是否具有通过ack消耗了整个复制流
* 2. 主节点将定期检查其任何副本是否具有通过 ACK 消耗了整个复制流

FAILOVER_WAIT_FOR_SYNC, /* Waiting for target replica to catch up */
/* 正在等待目标副本接受PSYNC FAILOVER请求 */
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
/* 正在等待目标副本接受PSYNC FAILOVER请求 */
/* 正在等待目标副本接受 PSYNC FAILOVER 请求 */

PAUSE_DURING_SHUTDOWN,
/* Failover的暂停 */
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
/* Failover的暂停 */
/* Failover 的暂停 */

@artikell
Copy link
Author

先做了点格式上的修改,也顺便看了一下有点懵,机翻得太多了。

好的。我近期处理一下

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants