Skip to content

Commit 5f47969

Browse files
authored
fix(sync): request rdb-only replication when sync_aof is false
* test(sync): add rdb-only focused regression Assisted-by: Codex:gpt-5.5 * fix(sync): request rdb-only replication Assisted-by: Codex:gpt-5.5 * chore(ci): remove rdb-only focused workflow Assisted-by: Codex:gpt-5.5 * fix(sync): simplify rdb-only replconf handling Assisted-by: Codex:gpt-5.5
1 parent 650e49a commit 5f47969

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

internal/reader/sync_standalone_reader.go

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,9 @@ func (r *syncStandaloneReader) sendPSync() {
246246
r.isDiskless = true
247247
}
248248
}
249+
if !r.opts.SyncAof {
250+
r.sendReplconfRDBOnly()
251+
}
249252
r.checkBgsaveInProgress()
250253
// send PSync
251254
argv := []interface{}{"PSYNC", "?", "-1"}
@@ -282,6 +285,19 @@ func (r *syncStandaloneReader) sendPSync() {
282285
r.stat.AofReceivedOffset = int64(masterOffset)
283286
}
284287

288+
func (r *syncStandaloneReader) sendReplconfRDBOnly() {
289+
argv := []interface{}{"REPLCONF", "rdb-only", "1"}
290+
r.client.Send(argv...)
291+
_, err := r.client.Receive()
292+
if err != nil {
293+
var redisErr proto.RedisError
294+
if errors.As(err, &redisErr) {
295+
return
296+
}
297+
log.Panicf("[%s] send replconf rdb-only to redis server failed. error=[%v]", r.stat.Name, err)
298+
}
299+
}
300+
285301
func (r *syncStandaloneReader) sendSync() {
286302
if r.opts.TryDiskless {
287303
argv := []interface{}{"REPLCONF", "CAPA", "EOF"}

0 commit comments

Comments
 (0)