You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
metric sinks: SHOW, catalog visibility, and RBAC (SQL-572)
Problem:
A metric sink was invisible, `mz_objects` did not carry it, and there
was no way to read back the SQL that created it. Creating one required
ownership of the `FROM` relation, stricter than any other sink.
Solution:
`SHOW METRIC SINKS [FROM <schema>] [IN CLUSTER <c>] [LIKE ...]` lists
name, `from`, and cluster. `SHOW [REDACTED] CREATE METRIC SINK` replays
`create_sql`. Both require `enable_metric_sink`.
`mz_internal.mz_metric_sinks` exposes what the catalog knows about a
sink, shaped like `mz_catalog.mz_sinks`, and joins into `mz_objects` as
type `metric-sink`. It is a materialized view derived from
`mz_catalog_raw`.
Create now needs `CREATE` on the schema, `CREATE` on the cluster, and
read on the `FROM` relation, the same shape as `CREATE SINK`. You need
read on it, not ownership.
The relation carries only the columns something reads. `create_sql` and
`redacted_create_sql` have no reader, and `SHOW CREATE` is how you get
the SQL back.
Testing:
- `metric_sink.slt` covers discovery and access control: the
`mz_metric_sinks` row resolving to its `FROM` relation, cluster, schema,
and owner, `mz_objects` and `mz_show_all_objects` membership, the three
`SHOW METRIC SINKS` filters, the `SHOW CREATE` round-trip, the audit
rows, and privileges.
- The restart platform check reads `SHOW METRIC SINKS` instead of
probing with a `CREATE` expected to fail.
Copy file name to clipboardExpand all lines: doc/user/content/reference/system-catalog/mz_internal.md
+2Lines changed: 2 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -700,6 +700,8 @@ The view is defined as the transitive closure of [`mz_object_dependencies`](#mz_
700
700
|`object_id`|[`text`]| The ID of the dependent object. Corresponds to [`mz_objects.id`](../mz_catalog/#mz_objects). |
701
701
|`referenced_object_id`|[`text`]| The ID of the (possibly transitively) referenced object. Corresponds to [`mz_objects.id`](../mz_catalog/#mz_objects). |
0 commit comments