refactor: remove unused tailnet connIO stats fields (#24911)

Drop start, lastWrite, and overwrites fields on connIO along with the
Stats() and Overwrites() methods. They have had no readers since
52901e121 which rewrote the PG coordinator's debug page to query the
database directly.
This commit is contained in:
Zach
2026-05-05 08:46:53 -06:00
committed by GitHub
parent 9b4666020b
commit f4197d676c
2 changed files with 1 additions and 21 deletions
+1 -18
View File
@@ -5,8 +5,6 @@ import (
"fmt"
"slices"
"sync"
"sync/atomic"
"time"
"github.com/google/uuid"
"golang.org/x/xerrors"
@@ -39,10 +37,7 @@ type connIO struct {
// latest is the most recent, unfiltered snapshot of the mappings we know about
latest []mapping
name string
start int64
lastWrite int64
overwrites int64
name string
}
func newConnIO(coordContext context.Context,
@@ -58,7 +53,6 @@ func newConnIO(coordContext context.Context,
auth agpl.CoordinateeAuth,
) *connIO {
peerCtx, cancel := context.WithCancel(peerCtx)
now := time.Now().Unix()
c := &connIO{
id: id,
coordCtx: coordContext,
@@ -72,8 +66,6 @@ func newConnIO(coordContext context.Context,
rfhs: rfhs,
auth: auth,
name: name,
start: now,
lastWrite: now,
}
go c.recvLoop()
c.logger.Info(coordContext, "serving connection")
@@ -254,7 +246,6 @@ func (c *connIO) UniqueID() uuid.UUID {
}
func (c *connIO) Enqueue(resp *proto.CoordinateResponse) error {
atomic.StoreInt64(&c.lastWrite, time.Now().Unix())
c.mu.Lock()
defer c.mu.Unlock()
if c.closed {
@@ -275,14 +266,6 @@ func (c *connIO) Name() string {
return c.name
}
func (c *connIO) Stats() (start int64, lastWrite int64) {
return c.start, atomic.LoadInt64(&c.lastWrite)
}
func (c *connIO) Overwrites() int64 {
return atomic.LoadInt64(&c.overwrites)
}
// CoordinatorClose is used by the coordinator when closing a Queue. It
// should skip removing itself from the coordinator.
func (c *connIO) CoordinatorClose() error {
-3
View File
@@ -7,7 +7,6 @@ import (
"slices"
"strings"
"sync"
"sync/atomic"
"time"
"github.com/cenkalti/backoff/v4"
@@ -961,8 +960,6 @@ func (q *querier) newConn(c *connIO) {
dup, ok := q.mappers[mk]
if ok {
q.logger.Debug(q.ctx, "duplicate mapper found; closing old connection", slog.F("peer_id", dup.c.UniqueID()))
// overwrite and close the old one
atomic.StoreInt64(&c.overwrites, dup.c.Overwrites()+1)
err := dup.c.CoordinatorClose()
if err != nil {
q.logger.Error(q.ctx, "failed to close duplicate mapper", slog.F("peer_id", dup.c.UniqueID()), slog.Error(err))