Skip to content

Commit 5113599

Browse files
committed
sql: fix rare flake in TestDistSQLFlowsVirtualTables
This commit fixes a rare flake in `TestDistSQLFlowsVirtualTables`. The test previously asserted that only the target query was present in `*_distsql_flows` virtual tables, but we just saw a case where an internal query showed up in there (related to table stats cache). This assertion was too strict and unnecessary - the test really cares whether the target query is present or not, so this commit removes the assertion. Release note: None
1 parent 32b2be3 commit 5113599

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

pkg/sql/crdb_internal_test.go

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -636,15 +636,11 @@ func TestDistSQLFlowsVirtualTables(t *testing.T) {
636636
const clusterScope = "cluster"
637637
const nodeScope = "node"
638638
getNum := func(db *sqlutils.SQLRunner, scope string) int {
639-
querySuffix := fmt.Sprintf("FROM crdb_internal.%s_distsql_flows", scope)
640-
// Check that all remote flows (if any) correspond to the expected
641-
// statement.
642-
stmts := db.QueryStr(t, "SELECT stmt "+querySuffix)
643-
for _, stmt := range stmts {
644-
require.Equal(t, query, stmt[0])
645-
}
639+
// Count the number of flows matching our target query. Note that there
640+
// could be other flows in the table for the internal operations.
641+
countQuery := fmt.Sprintf("SELECT count(*) FROM crdb_internal.%s_distsql_flows WHERE stmt = '%s'", scope, query)
646642
var num int
647-
db.QueryRow(t, "SELECT count(*) "+querySuffix).Scan(&num)
643+
db.QueryRow(t, countQuery).Scan(&num)
648644
return num
649645
}
650646
for nodeID := 0; nodeID < numNodes; nodeID++ {

0 commit comments

Comments
 (0)