Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adapter: add mz_subscriptions system table #17906

Merged
merged 3 commits into from
Mar 6, 2023

Conversation

teskje
Copy link
Contributor

@teskje teskje commented Mar 2, 2023

This PR adds a new mz_subscribes system table that contains information about active subscribes. Subscribes are added there when they are sequenced by the coordinator and removed when the coordinator drops them.

The main intended usage of this table is making sense of subscribe IDs that appear in compute introspection sources. Prior to this commit, there was no place where one could look these IDs up.

I tried to add as much identifying information about subscribes as possible. Subscribes don't have a name, so there is no obvious way for users to map their SQL queries to rows in the table. The started_at time can help here, I hope. I would have liked to include the create_sql as well, like we do for views. But handling renames of objects appearing in subscribe queries seems difficult.

For now mz_subscribes lives in the mz_internal schema. I think we can move it to the catalog at some point, but I didn't want to stabilize it immediately.

Motivation

  • This PR adds a feature that has not yet been specified.

It would be good to have a table that lists active subscribes, so users have something to look up the t* GlobalIds they find in the introspection sources.

Tips for reviewer

The functionality is implemented, but this is still missing:

  • Tests
  • Documentation

Checklist

  • This PR has adequate test coverage / QA involvement has been duly considered.
  • This PR has an associated up-to-date design doc, is a design doc (template), or is sufficiently small to not require a design.
  • This PR evolves an existing $T ⇔ Proto$T mapping (possibly in a backwards-incompatible way) and therefore is tagged with a T-proto label.
  • If this PR will require changes to cloud orchestration, there is a companion cloud PR to account for those changes that is tagged with the release-blocker label (example).
  • This PR includes the following user-facing behavior changes:
    • Add the mz_internal.mz_subscribe system table, which lists in-progress subscribes.

@teskje teskje force-pushed the mz_subscribes branch 2 times, most recently from 720a92e to e41151f Compare March 3, 2023 11:39
@teskje teskje marked this pull request as ready for review March 3, 2023 18:18
@teskje teskje requested a review from a team as a code owner March 3, 2023 18:18
@teskje teskje requested review from a team, jkosh44, morsapaes and philip-stoev and removed request for a team March 3, 2023 18:18
Copy link
Contributor

@jkosh44 jkosh44 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

src/adapter/src/subscribe.rs Show resolved Hide resolved
test/cluster/mzcompose.py Outdated Show resolved Hide resolved
test/cluster/mzcompose.py Outdated Show resolved Hide resolved
doc/user/content/sql/system-catalog/mz_internal.md Outdated Show resolved Hide resolved
doc/user/content/sql/system-catalog/mz_internal.md Outdated Show resolved Hide resolved
src/adapter/src/catalog/builtin.rs Outdated Show resolved Hide resolved
This commit adds a new `mz_subscriptions` system table that contains
information about active subscribes. Subscribes are added there when
they are sequenced by the coordinator and removed when the coordinator
drops them.

The main intended usage of this table is making sense of subscribe IDs
that appear in compute introspection sources. Prior to this commit,
there was no place where one could look these IDs up.

I tried to add as much identifying information about subscribes as
possible. Subscribes don't have a name, so there is no obvious way for
users to map their SQL queries to rows in the table. The `created_at`
and `referenced_object_ids` fields can help here, I hope. I would have
liked to include the `create_sql` as well, like we do for views. But
handling renames of objects appearing in subscribe queries seems
difficult.
@teskje
Copy link
Contributor Author

teskje commented Mar 6, 2023

Thanks for your comments! I've addressed them all, PTAL.

@teskje teskje requested review from jkosh44 and morsapaes March 6, 2023 13:03
Copy link
Contributor

@jkosh44 jkosh44 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@teskje teskje merged commit 4b74e24 into MaterializeInc:main Mar 6, 2023
@teskje teskje deleted the mz_subscribes branch March 6, 2023 16:43
@teskje
Copy link
Contributor Author

teskje commented Mar 6, 2023

TFTRs!

@teskje teskje changed the title adapter: add mz_subscribes system table adapter: add mz_subscriptions system table Mar 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants