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

[BUG] Once start aof-use-rdb-preamble, redis does not use partial REPLICA after restarted #10686

Closed
kyangcmXF opened this issue May 6, 2022 · 1 comment

Comments

@kyangcmXF
Copy link

kyangcmXF commented May 6, 2022

Describe the bug

I use redis6.0. However I found that redis slave does not always use partial REPLICA after restarted.

To reproduce

  1. start aof-use-rdb-preamble in redis.conf
    aof-use-rdb-preamble yes
    2.restart redis6.0
    then the log is written that:

134:S 06 May 2022 20:05:19.957 * Connecting to MASTER 127.0.0.1:6379
134:S 06 May 2022 20:05:19.959 * MASTER <-> REPLICA sync started
134:S 06 May 2022 20:05:19.962 * Non blocking connect for SYNC fired the event.
134:S 06 May 2022 20:05:19.965 * Master replied to PING, replication can continue...
134:S 06 May 2022 20:05:19.968 * Partial resynchronization not possible (no cached master)
134:S 06 May 2022 20:05:25.224 * Full resync from master: 996dd0912cf1949fcd763d8db34897f6073c66da:191
134:S 06 May 2022 20:05:25.572 * MASTER <-> REPLICA sync: receiving streamed RDB from master with EOF to disk
134:S 06 May 2022 20:05:25.575 * MASTER <-> REPLICA sync: Flushing old data
134:S 06 May 2022 20:05:25.580 * MASTER <-> REPLICA sync: Loading DB in memory
134:S 06 May 2022 20:05:25.584 * Loading RDB produced by version 6.0.16
134:S 06 May 2022 20:05:25.586 * RDB age 0 seconds
134:S 06 May 2022 20:05:25.588 * RDB memory usage when created 1.49 Mb
134:S 06 May 2022 20:05:25.591 * MASTER <-> REPLICA sync: Finished with success

Expected behavior

I hope that slave redis will use partial REPLICA once restarted.

Additional information

I found why the aof file will not use partial replication. Because in aof.c does not save the redis slave info.
see below:
function: rewriteAppendOnlyFile()
the last para in rdbSaveRio is null. So why we pass null into it? Is there any meaningful thought?

`int rewriteAppendOnlyFile(char *filename) {
//do something

if (server.aof_use_rdb_preamble) {
    int error;
    if (rdbSaveRio(&aof,&error,RDBFLAGS_AOF_PREAMBLE,NULL) == C_ERR) {
        errno = error;
        goto werr;
    }
} else {
    if (rewriteAppendOnlyFileRio(&aof) == C_ERR) goto werr;
}

}`

@oranagra
Copy link
Member

oranagra commented May 8, 2022

this topic is tracked in #9796

@oranagra oranagra closed this as completed May 8, 2022
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

No branches or pull requests

2 participants