-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
59220: sql,gcjob: set RunningStatus when GC job performs r=postamar a=postamar Previously, the RunningStatus of a GC job was always set to "waiting for GC TTL". This patch sets it to a more meaningful value when the GC job is actually performing garbage collection. Release note (sql change): SHOW JOBS now displays a meaningful value in the running_status column for GC jobs which are actually performing garbage collection, as opposed to waiting on a timer. 60484: execstats: include local streams in the physical plan r=RaduBerinde a=asubiotto Fixes #60463 Look at commits for individual details. Ignored errors caused this bug to go unnoticed, so the first commit adds a panic when the crdb test flag is specified. This would've caught the issue easily. Release note: None 60511: sql: Added telemetry for pg_catalog and information_schema tables access r=solongordon a=mnovelodou Previously, when querying a not implemented table it was tracket by telemetry This was inadequate because when adding these tables as empty tables we no longer capture the access of these tables that are empty and unsupported To address this, this patch adds telemetry to track queries at pg_catalog and information_schema existing tables Release note (sql change): Added telemetry to track usage of pg_catalog and information_schema tables Fixes #58732 Co-authored-by: Marius Posta <marius@cockroachlabs.com> Co-authored-by: Alfonso Subiotto Marques <alfonso@cockroachlabs.com> Co-authored-by: MiguelNovelo <miguel.novelo@digitalonus.com>
- Loading branch information
Showing
12 changed files
with
193 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
// Copyright 2020 The Cockroach Authors. | ||
// | ||
// Use of this software is governed by the Business Source License | ||
// included in the file licenses/BSL.txt. | ||
// | ||
// As of the Change Date specified in that file, in accordance with | ||
// the Business Source License, use of this software will be governed | ||
// by the Apache License, Version 2.0, included in the file | ||
// licenses/APL.txt. | ||
|
||
package sqltelemetry | ||
|
||
import ( | ||
"fmt" | ||
|
||
"github.com/cockroachdb/cockroach/pkg/server/telemetry" | ||
) | ||
|
||
const getVirtualSchemaEntry = "sql.schema.get_virtual_table.%s.%s" | ||
|
||
// trackedSchemas have the schemas that we track by telemetry. | ||
var trackedSchemas = map[string]struct{}{ | ||
"pg_catalog": {}, | ||
"information_schema": {}, | ||
} | ||
|
||
// IncrementGetVirtualTableEntry is used to increment telemetry counter for any | ||
// use of tracked schemas tables. | ||
func IncrementGetVirtualTableEntry(schema, tableName string) { | ||
if _, ok := trackedSchemas[schema]; ok { | ||
telemetry.Inc(telemetry.GetCounter(fmt.Sprintf(getVirtualSchemaEntry, schema, tableName))) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
feature-allowlist | ||
sql.schema.get_virtual_table.* | ||
---- | ||
|
||
feature-usage | ||
SELECT * FROM pg_catalog.pg_cast | ||
---- | ||
sql.schema.get_virtual_table.pg_catalog.pg_cast | ||
|
||
feature-usage | ||
SELECT * FROM information_schema.schema_privileges LIMIT 1 | ||
---- | ||
sql.schema.get_virtual_table.information_schema.schema_privileges | ||
|
||
feature-usage | ||
SELECT * FROM crdb_internal.databases LIMIT 1 | ||
---- | ||
|
||
feature-usage | ||
SELECT * FROM pg_catalog.pg_xxx | ||
---- | ||
error: pq: relation "pg_catalog.pg_xxx" does not exist |
Oops, something went wrong.