Skip to content

Commit

Permalink
Support prefer_replica=true in both Cluster and Standalone mode (#821)
Browse files Browse the repository at this point in the history
* support DEL command in scan_reader

* Support prefer_replica=true in both Cluster and Standalone mode
  • Loading branch information
xhs authored Jun 6, 2024
1 parent 8402d84 commit 0be518f
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions internal/reader/scan_standalone_reader.go
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,12 @@ func (r *scanStandaloneReader) scan() {
func (r *scanStandaloneReader) dump() {
nowDbId := 0
r.dumpClient = client.NewRedisClient(r.ctx, r.opts.Address, r.opts.Username, r.opts.Password, r.opts.Tls)
// Support prefer_replica=true in both Cluster and Standalone mode
if r.opts.PreferReplica {
r.dumpClient.Do("READONLY")
log.Infof("running dump() in read-only mode")
}

for item := range r.needDumpQueue.Ch {
r.stat.NeedUpdateCount = int64(r.needDumpQueue.Len())
dbId := item.(dbKey).db
Expand Down

0 comments on commit 0be518f

Please sign in to comment.