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

feat(suscription): Improving usability of subscription #18217

Merged
merged 4 commits into from
Aug 26, 2024
Merged

Conversation

xxhZs
Copy link
Contributor

@xxhZs xxhZs commented Aug 23, 2024

I hereby agree to the terms of the RisingWave Labs, Inc. Contributor License Agreement.

What's changed and what's your intention?

#18208

  1. Change the default behavior of DECLARE cursor_name SUBSCRIPTION CURSOR FOR subscription_name to SINCE now() without backfilling historical data.
  2. Change op column type from int16 to varchar to make it more understandable: 1 -> insert, 2 -> update_insert, 3 -> delete, 4 -> update_delete
  3. support show cursors and show subscription cursors:
    show cursors will return all query cursor in this seesion
    show subscription cursors will return all subscription cursor and subscription name in this seesion

Checklist

  • I have written necessary rustdoc comments
  • I have added necessary unit tests and integration tests
  • I have added test labels as necessary. See details.
  • I have added fuzzing tests or opened an issue to track them. (Optional, recommended for new SQL features Sqlsmith: Sql feature generation #7934).
  • My PR contains breaking changes. (If it deprecates some features, please create a tracking issue to remove them in the future).
  • All checks passed in ./risedev check (or alias, ./risedev c)
  • My PR changes performance-critical code. (Please run macro/micro-benchmarks and show the results.)
  • My PR contains critical fixes that are necessary to be merged into the latest release. (Please check out the details)

Documentation

  • My PR needs documentation updates. (Please use the Release note section below to summarize the impact on users)

Release note

after this pr

  1. BREAKING CHANGE: DECLARE cursor_name SUBSCRIPTION CURSOR = DECLARE cursor_name SUBSCRIPTION CURSOR since now(), will be consumed from the current time. DECLARE cursor_name SUBSCRIPTION CURSOR FULL, Will start consuming data from stock
  2. BREAKING CHANGE: The type of op has changed to varchar,It's one of Insert Delete UpdateInset UpdateDelete.
  3. show cursors will return all query cursor in this seesion
    show subscription cursors will return all subscription cursor and subscription name in this seesion

@graphite-app graphite-app bot requested a review from a team August 23, 2024 08:11
Copy link
Collaborator

@hzxa21 hzxa21 left a comment

Choose a reason for hiding this comment

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

Do we need to modify the cursor test as well?

Rest LGTM!

src/frontend/src/handler/show.rs Outdated Show resolved Hide resolved
src/frontend/src/handler/show.rs Outdated Show resolved Hide resolved
Comment on lines +800 to +808
PgFieldDescriptor::new(
"Name".to_string(),
DataType::Varchar.to_oid(),
DataType::Varchar.type_len(),
),
PgFieldDescriptor::new(
"SubscriptionName".to_string(),
DataType::Varchar.to_oid(),
DataType::Varchar.type_len(),
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think it is more useful to include the following information as well:

  • seek_pos: the rw_timestamp or the the seek mode (FULL/BEGIN/NOW/...) when the cursor is declare
  • num_rows_fetched: number of rows fetched internally by subscription cursor
  • num_rows_returned: number of rows returned to user

Copy link
Collaborator

Choose a reason for hiding this comment

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

We can do this in a separate PR as well to speed up merging this PR with breaking changes to 2.0.

@graphite-app graphite-app bot requested a review from a team August 26, 2024 04:48
@xxhZs xxhZs added this pull request to the merge queue Aug 26, 2024
Merged via the queue into main with commit ec61f32 Aug 26, 2024
30 of 31 checks passed
@xxhZs xxhZs deleted the xxh/add-show-cursor branch August 26, 2024 06:12
github-merge-queue bot pushed a commit that referenced this pull request Aug 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants