Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions src/networking.c
Original file line number Diff line number Diff line change
Expand Up @@ -2515,6 +2515,12 @@ int processMultibulkBuffer(client *c) {
* 1. The client is reset unless there are reasons to avoid doing it.
* 2. In the case of master clients, the replication offset is updated.
* 3. Propagate commands we got from our master to replicas down the line. */
/* 执行命令后执行必要的任务:
*
* 1. 重置客户端,除非有理由避免重置客户端。
* 2. 对于主客户端,复制偏移量被更新。
* 3. 将从节点收到的命令传播到下游的副本
* */
void commandProcessed(client *c) {
/* If client is blocked(including paused), just return avoid reset and replicate.
*
Expand All @@ -2539,6 +2545,8 @@ void commandProcessed(client *c) {
* applied to the master state: this quantity, and its corresponding
* part of the replication stream, will be propagated to the
* sub-replicas and to the replication backlog. */
/* 如果客户机是主机,我们需要计算处理缓冲区之前和之后应用的偏移量之间的差异,
* 以了解有多少复制流实际应用于主机状态:此数量及其复制流的相应部分将传播到子副本和复制积压*/
if (c->flags & CLIENT_MASTER) {
long long applied = c->reploff - prev_offset;
if (applied) {
Expand Down
5 changes: 5 additions & 0 deletions src/rdb.c
Original file line number Diff line number Diff line change
Expand Up @@ -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/偏移量

* 该函数填充通常在调用程序中堆栈分配的 “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"

* 如果实例具有有效的主客户端,则返回填充的指针,否则返回 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 保存不会保留任何与复制相关的信息

/* 当前方法主要会写入当前的 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 */

rdbSaveInfo *rdbPopulateSaveInfo(rdbSaveInfo *rsi) {
rdbSaveInfo rsi_init = RDB_SAVE_INFO_INIT;
*rsi = rsi_init;
Expand Down
Loading