Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
127583: sql: include MaxTimestampAge info for TableReader in DistSQL diagrams r=yuzefovich a=yuzefovich

This commit includes `MaxTimestampAge` field of the `TableReaderSpec` into the DistSQL diagram. This feature is used by the table stats collection to utilize the inconsistent scan, and it'll be easier to confirm that it's actually used under the hood.

Informs: #72719.
Epic: None

Release note: None

127672: logictest: retry relocate stmt in a couple of places r=yuzefovich a=yuzefovich

The capabilities are propagated asynchronously, so previously we could try to relocate ranges in the secondary tenant before the necessary capability was picked up. This was recently changed in 5f2a4f8.

Fixes: #127659.

Release note: None

Co-authored-by: Yahor Yuzefovich <[email protected]>
  • Loading branch information
craig[bot] and yuzefovich committed Jul 26, 2024
3 parents b97a858 + 2b55199 + a81beba commit 59bb8eb
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 14 deletions.
7 changes: 7 additions & 0 deletions pkg/sql/execinfrapb/flow_diagram.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import (
"sort"
"strconv"
"strings"
"time"

"github.com/cockroachdb/cockroach/pkg/base"
"github.com/cockroachdb/cockroach/pkg/sql/catalog/catalogkeys"
Expand Down Expand Up @@ -179,6 +180,12 @@ func (tr *TableReaderSpec) summary() (string, []string) {
details = append(details, spanStr.String())
}

if tr.MaxTimestampAgeNanos != 0 {
details = append(details, fmt.Sprintf(
"Inconsistent scan (max ts age %s)", time.Duration(tr.MaxTimestampAgeNanos),
))
}

return "TableReader", details
}

Expand Down
5 changes: 3 additions & 2 deletions pkg/sql/logictest/testdata/logic_test/distsql_tenant_locality
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@ statement ok
CREATE TABLE t (k INT PRIMARY KEY, v INT, FAMILY (k, v));
INSERT INTO t SELECT i, i FROM generate_series(1, 6) AS g(i)

# Upreplicate the table's range.
statement ok
# Upreplicate the table's range. We need a retry to guarantee that the
# capability has been picked up.
statement ok retry
ALTER TABLE t EXPERIMENTAL_RELOCATE VALUES (ARRAY[1, 2, 3], 0)

# Split the ranges in the table.
Expand Down
Loading

0 comments on commit 59bb8eb

Please sign in to comment.