Start AOFRW before streaming repl buffer during fullsync#13758
Merged
tezc merged 4 commits intoredis:unstablefrom Feb 4, 2025
Merged
Start AOFRW before streaming repl buffer during fullsync#13758tezc merged 4 commits intoredis:unstablefrom
tezc merged 4 commits intoredis:unstablefrom
Conversation
oranagra
reviewed
Jan 20, 2025
oranagra
approved these changes
Jan 28, 2025
Member
oranagra
left a comment
There was a problem hiding this comment.
LGTM.
please list the interface changes in the PR description.
@YaacovHazan please comment on how do we formally approve them?
Collaborator
|
@oranagra This is an internal mechanism in Redis, and we don't need to get approval for that... we do need to communicate the change, so we are good to merge it |
funny-dog
pushed a commit
to funny-dog/redis
that referenced
this pull request
Sep 17, 2025
During fullsync, before loading RDB on the replica, we stop aof child to prevent copy-on-write disaster. Once rdb is loaded, aof is started again and it will trigger aof rewrite. With redis#13732 , for rdbchannel replication, this behavior was changed. Currently, we start aof after replication buffer is streamed to db. This PR changes it back to start aof just after rdb is loaded (before repl buffer is streamed) Both approaches may have pros and cons. If we start aof before streaming repl buffers, we may still face with copy-on-write issues as repl buffers potentially include large amount of changes. If we wait until replication buffer drained, it means we are delaying starting aof persistence. Additional changes are introduced as part of this PR: - Interface change: Added `mem_replica_full_sync_buffer` field to the `INFO MEMORY` command reply. During full sync, it shows total memory consumed by accumulated replication stream buffer on replica. Added same metric to `MEMORY STATS` command reply as `replica.fullsync.buffer` field. - Fixes: - Count repl stream buffer size of replica as part of 'memory overhead' calculation for fields in "INFO MEMORY" and "MEMORY STATS" outputs. Before this PR, repl buffer was not counted as part of memory overhead calculation, causing misreports for fields like `used_memory_overhead` and `used_memory_dataset` in "INFO STATS" and for `overhead.total` field in "MEMORY STATS" command reply. - Dismiss replication stream buffers memory of replica in the fork to reduce COW impact during a fork. - Fixed a few time sensitive flaky tests, deleted a noop statement, fixed some comments and fail messages in rdbchannel tests.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
During fullsync, before loading RDB on the replica, we stop aof child to prevent copy-on-write disaster.
Once rdb is loaded, aof is started again and it will trigger aof rewrite. With #13732 , for rdbchannel replication, this behavior was changed. Currently, we start aof after replication buffer is streamed to db. This PR changes it back to start aof just after rdb is loaded (before repl buffer is streamed)
Both approaches may have pros and cons. If we start aof before streaming repl buffers, we may still face with copy-on-write issues as repl buffers potentially include large amount of changes. If we wait until replication buffer drained, it means we are delaying starting aof persistence.
Additional changes are introduced as part of this PR:
Interface change:
Added
mem_replica_full_sync_bufferfield to theINFO MEMORYcommand reply. During full sync, it shows total memory consumed by accumulated replication stream buffer on replica. Added same metric toMEMORY STATScommand reply asreplica.fullsync.bufferfield.Fixes:
used_memory_overheadandused_memory_datasetin "INFO STATS" and foroverhead.totalfield in "MEMORY STATS" command reply.