Skip to content

Commit

Permalink
Improve vtgate logging for buffering (#17654)
Browse files Browse the repository at this point in the history
Signed-off-by: deepthi <[email protected]>
  • Loading branch information
deepthi authored Jan 30, 2025
1 parent 9c6c380 commit 53396cd
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
3 changes: 2 additions & 1 deletion go/vt/discovery/keyspace_events.go
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,7 @@ func (kss *keyspaceState) ensureConsistentLocked() {
// watcher. this means the ongoing availability event has been resolved, so we can broadcast
// a resolution event to all listeners
kss.consistent = true
log.Infof("keyspace %s is now consistent", kss.keyspace)

kss.moveTablesState = nil

Expand All @@ -328,7 +329,7 @@ func (kss *keyspaceState) ensureConsistentLocked() {
Serving: sstate.serving,
})

log.Infof("keyspace event resolved: %s is now consistent (serving: %t)",
log.V(2).Infof("keyspace event resolved: %s is now consistent (serving: %t)",
topoproto.KeyspaceShardString(sstate.target.Keyspace, sstate.target.Shard),
sstate.serving,
)
Expand Down
6 changes: 3 additions & 3 deletions go/vt/vtgate/buffer/shard_buffer.go
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ func (sb *shardBuffer) startBufferingLocked(ctx context.Context, kev *discovery.
msg = "Dry-run: Would have started buffering"
}
starts.Add(sb.statsKey, 1)
log.V(2).Infof("%v for shard: %s (window: %v, size: %v, max failover duration: %v) (A failover was detected by this seen error: %v.)",
log.Infof("%v for shard: %s (window: %v, size: %v, max failover duration: %v) (A failover was detected by this seen error: %v.)",
msg,
topoproto.KeyspaceShardString(sb.keyspace, sb.shard),
sb.buf.config.Window,
Expand Down Expand Up @@ -562,7 +562,7 @@ func (sb *shardBuffer) stopBufferingLocked(reason stopReason, details string) {
if sb.mode == bufferModeDryRun {
msg = "Dry-run: Would have stopped buffering"
}
log.V(2).Infof("%v for shard: %s after: %.1f seconds due to: %v. Draining %d buffered requests now.",
log.Infof("%v for shard: %s after: %.1f seconds due to: %v. Draining %d buffered requests now.",
msg, topoproto.KeyspaceShardString(sb.keyspace, sb.shard), d.Seconds(), details, len(q))

var clientEntryError error
Expand Down Expand Up @@ -622,7 +622,7 @@ func (sb *shardBuffer) drain(q []*entry, err error) {
wg.Wait()

d := sb.timeNow().Sub(start)
log.V(2).Infof("Draining finished for shard: %s Took: %v for: %d requests.", topoproto.KeyspaceShardString(sb.keyspace, sb.shard), d, len(q))
log.Infof("Draining finished for shard: %s Took: %v for: %d requests.", topoproto.KeyspaceShardString(sb.keyspace, sb.shard), d, len(q))
requestsDrained.Add(sb.statsKey, int64(len(q)))

// Draining is done. Change state from "draining" to "idle".
Expand Down

0 comments on commit 53396cd

Please sign in to comment.