Skip to content

Commit 1e114f8

Browse files
committed
stmtdiagnostics: add 25.4 version gate to txn diagnostics polling
Adds a version gate to the TxnRegistry.pollTxnRequests to return early if v25.4 is not active. This will ensure that the `system.transaction_diagnostics_requests` table exists before try to query it. Epic: None Release note: None
1 parent b772338 commit 1e114f8

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

pkg/sql/stmtdiagnostics/BUILD.bazel

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ go_library(
99
importpath = "github.com/cockroachdb/cockroach/pkg/sql/stmtdiagnostics",
1010
visibility = ["//visibility:public"],
1111
deps = [
12+
"//pkg/clusterversion",
1213
"//pkg/multitenant",
1314
"//pkg/settings",
1415
"//pkg/settings/cluster",

pkg/sql/stmtdiagnostics/txn_diagnostics.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import (
1212
"strings"
1313
"time"
1414

15+
"github.com/cockroachdb/cockroach/pkg/clusterversion"
1516
"github.com/cockroachdb/cockroach/pkg/settings/cluster"
1617
"github.com/cockroachdb/cockroach/pkg/sql/appstatspb"
1718
"github.com/cockroachdb/cockroach/pkg/sql/isql"
@@ -541,6 +542,10 @@ func (r *TxnRegistry) findTxnRequestLocked(requestID RequestID) bool {
541542
// pollTxnRequests reads the pending rows from system.transaction_diagnostics_requests and
542543
// updates r.mu.requests accordingly.
543544
func (r *TxnRegistry) pollTxnRequests(ctx context.Context) error {
545+
if !r.st.Version.IsActive(ctx, clusterversion.V25_4) {
546+
return nil
547+
}
548+
544549
var rows []tree.Datums
545550

546551
// Loop until we run the query without straddling an epoch increment.

0 commit comments

Comments
 (0)