Skip to content

Commit

Permalink
Optimize Replication send buffer queue
Browse files Browse the repository at this point in the history
  • Loading branch information
snower committed Apr 12, 2024
1 parent 1fe1b2f commit a263e4f
Show file tree
Hide file tree
Showing 3 changed files with 235 additions and 371 deletions.
6 changes: 3 additions & 3 deletions server/admin.go
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ func (self *Admin) commandHandleInfoCommand(serverProtocol *TextServerProtocol,
infos = append(infos, "role:leader")
infos = append(infos, fmt.Sprintf("connected_followers:%d", len(self.slock.replicationManager.serverChannels)))
infos = append(infos, fmt.Sprintf("current_aof_id:%x", self.slock.replicationManager.currentRequestId))
infos = append(infos, fmt.Sprintf("current_offset:%d", self.slock.replicationManager.bufferQueue.currentIndex))
infos = append(infos, fmt.Sprintf("current_offset:%d", self.slock.replicationManager.bufferQueue.seq))
for i, serverChannel := range self.slock.replicationManager.serverChannels {
if serverChannel.protocol == nil {
continue
Expand All @@ -239,8 +239,8 @@ func (self *Admin) commandHandleInfoCommand(serverProtocol *TextServerProtocol,
status = "pending"
}
infos = append(infos, fmt.Sprintf("follower%d:host=%s,aof_id=%x,behind_offset=%d,status=%s", i+1,
serverChannel.protocol.RemoteAddr().String(), serverChannel.currentRequestId,
self.slock.replicationManager.bufferQueue.currentIndex-serverChannel.bufferIndex, status))
serverChannel.protocol.RemoteAddr().String(), serverChannel.bufferCursor.currentRequestId,
self.slock.replicationManager.bufferQueue.seq-serverChannel.bufferCursor.seq, status))
}
} else {
infos = append(infos, "role:follower")
Expand Down
Loading

0 comments on commit a263e4f

Please sign in to comment.