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

fix(subscription): fix drop subscription not clear cursor #17232

Merged
merged 3 commits into from
Jul 5, 2024

Conversation

xxhZs
Copy link
Contributor

@xxhZs xxhZs commented Jun 13, 2024

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

What's changed and what's your intention?

The current behavior is that after deleting the sub, the cursor will still consume cached data, but the next pull will report an error
invalid cursors will be deleted when creating a new cursor

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

If this PR includes changes that directly affect users or other significant modifications relevant to the community, kindly draft a release note to provide a concise summary of these changes. Please prioritize highlighting the impact these changes will have on users.

@xxhZs xxhZs changed the title fix(subscription) fix(subscription): fix drop subscription will not clear cursor Jun 13, 2024
@xxhZs xxhZs requested a review from hzxa21 June 13, 2024 05:53
@xxhZs xxhZs force-pushed the xxh/fix-cursor-drop-subscription branch from b25d898 to 0c98e65 Compare June 13, 2024 07:41
@xxhZs xxhZs changed the title fix(subscription): fix drop subscription will not clear cursor fix(subscription): fix drop subscription not clear cursor Jun 13, 2024
.catalog_writer()?
.list_change_log_epochs(table_id, seek_timestamp, 2)
.list_change_log_epochs(table_id.table_id(), seek_timestamp, 2)
Copy link
Collaborator

Choose a reason for hiding this comment

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

I have several questions related to list_change_log_epochs:

  1. Why do we put list_change_log_epochs in catalog_writer? It is a read-only operation.
  2. Why do we have list_change_log_epochs in SessionImpl but unused?
  3. What will list_change_log_epochs return if the requested table_id is dropped? Should change list_change_log_epochs to make it return an error when the table_id is not found to handle the case when subscription is dropped instead of adding a new method to check existence of a subscription?

if let Cursor::Subscription(cursor) = v {
!matches!(cursor.state, State::Invalid)
} else {
true
Copy link
Collaborator

Choose a reason for hiding this comment

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

I wonder whether we have similar issue for query cursor. I suspect that query cursor also suffer from the same issue of being valid after the table is dropped.

@xxhZs xxhZs requested a review from hzxa21 July 4, 2024 07:27
@xxhZs xxhZs added this pull request to the merge queue Jul 5, 2024
Merged via the queue into main with commit 096889f Jul 5, 2024
30 of 31 checks passed
@xxhZs xxhZs deleted the xxh/fix-cursor-drop-subscription branch July 5, 2024 08:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/fix Bug fix
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants