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: deprecate current epoch in pinned snapshot #18230

Merged
merged 6 commits into from
Aug 29, 2024

Conversation

wenym1
Copy link
Contributor

@wenym1 wenym1 commented Aug 26, 2024

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

What's changed and what's your intention?

Motivation is described in #18214.

As we are deprecating MVCC support on a single hummock version, barrier read with consistency will greatly increase the overall complexity. As barrier read is not with high priority, we may give up the consistency in barrier read. Implementation-wise, instead of using a consistent uncommitted epoch for queries in all tables, we will change to use u64::MAX as the epoch to query data from all tables, which means we will read the latest data in all tables. In this way, while deprecating MVCC support on a single hummock version, we can still preserve the functionality of barrier read for query with higher freshness.

After deprecating the consistent barrier read, we can further deprecate the current epoch in pinned snapshot, and then we can deprecate the usage of HummockReadEpoch::Current(epoch), and the validate_read_epoch and seal_epoch of StateStore trait can be further deprecated.

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

Previously, when the session variable visibility_mode is set to all, while we are able to query uncommitted data, we still ensure consistency between the tables involved in the query. After this PR, when visibility_mode is set to all, we will change to query the latest uncommitted data, and there is no consistency between the involved tables, even if a read only transaction is begun.

@wenym1 wenym1 added the user-facing-changes Contains changes that are visible to users label Aug 26, 2024
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.

Generally LGTM.

@zwang28 @xxhZs PTAL as well.

Copy link
Contributor

@chenzl25 chenzl25 left a comment

Choose a reason for hiding this comment

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

LGTM

statement ok
SET VISIBILITY_MODE TO checkpoint;

connection txn
Copy link
Member

Choose a reason for hiding this comment

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

Why do we need this? 👀

Copy link
Contributor Author

Choose a reason for hiding this comment

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

After this PR, we won't provide consistency support for barrier read, and the CI with visibility_mode set to all will fail in this PR.

Copy link
Member

Choose a reason for hiding this comment

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

Do you mean that read-only transaction does not guarantee any isolation when visibility_mode is all? If so, shall we ban user from doing this to avoid confusion?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

For simplicity, I change to send a notice to user when the user explicitly start read only transaction with visibility_mode is set to all.

src/frontend/src/scheduler/snapshot.rs Outdated Show resolved Hide resolved
@wenym1 wenym1 added this pull request to the merge queue Aug 29, 2024
Merged via the queue into main with commit a137e30 Aug 29, 2024
35 of 36 checks passed
@wenym1 wenym1 deleted the yiming/deprecate-current-epoch branch August 29, 2024 05:33
@yezizp2012
Copy link
Member

yezizp2012 commented Aug 29, 2024

🥵 After this PR, the e2e e2e_test/batch/transaction/read_only_multi_conn.slt and e2e_test/batch/transaction/now.slt will become flaky when testing it use ci-3cn-3fe-in-memory:

e2e_test/batch/transaction/read_only_multi_conn.slt          .. [FAILED]

failed to run `e2e_test/batch/transaction/read_only_multi_conn.slt`

Caused by:
    query result mismatch:
    [SQL] select count(*) from t;
    [Diff] (-expected|+actual)
    -   2
    +   1
    at e2e_test/batch/transaction/read_only_multi_conn.slt:19

e2e_test/batch/transaction/now.slt                           .. [FAILED]
--
  |  
  | failed to run `e2e_test/batch/transaction/now.slt`
  |  
  | Caused by:
  | query result mismatch:
  | [SQL] select * from v
  | except
  | select * from mv;
  | [Diff] (-expected\|+actual)
  | +   2024-08-29 06:29:20.948
  | +   2024-08-29 06:29:20.848
  | +   2024-08-29 06:29:20.748
  | +   2024-08-29 06:29:20.898
  | +   2024-08-29 06:29:20.698
  | +   2024-08-29 06:29:20.798
  | at e2e_test/batch/transaction/now.slt:30

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.

5 participants