Skip to content

Commit

Permalink
Merge branch 'tair-opensource:v3' into v3
Browse files Browse the repository at this point in the history
  • Loading branch information
ElvisWai authored Aug 3, 2023
2 parents 8cdb600 + 5b2303c commit d99102b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ on:

jobs:
build:
permissions: write-all
runs-on: ubuntu-latest
steps:
- name: Checkout
Expand Down
8 changes: 8 additions & 0 deletions internal/writer/redis.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"github.com/alibaba/RedisShake/internal/log"
"github.com/alibaba/RedisShake/internal/statistics"
"strconv"
"strings"
"sync"
"sync/atomic"
"time"
Expand Down Expand Up @@ -57,6 +58,10 @@ func (w *redisWriter) Write(e *entry.Entry) {
func (w *redisWriter) switchDbTo(newDbId int) {
w.client.Send("select", strconv.Itoa(newDbId))
w.DbId = newDbId
w.chWaitReply <- &entry.Entry{
Argv: []string{"select", strconv.Itoa(newDbId)},
CmdName: "select",
}
}

func (w *redisWriter) flushInterval() {
Expand All @@ -75,6 +80,9 @@ func (w *redisWriter) flushInterval() {
log.Panicf("redisWriter received error. error=[%v], argv=%v, slots=%v, reply=[%v]", err, e.Argv, e.Slots, reply)
}
}
if strings.EqualFold(e.CmdName, "select") { // skip select command
continue
}
atomic.AddUint64(&w.UpdateUnansweredBytesCount, ^(e.EncodedSize - 1))
statistics.UpdateAOFAppliedOffset(uint64(e.Offset))
statistics.UpdateUnansweredBytesCount(atomic.LoadUint64(&w.UpdateUnansweredBytesCount))
Expand Down

0 comments on commit d99102b

Please sign in to comment.