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(stream): arrangement backfill should use dist key instead of pk to derive vnode #16815

Merged
merged 2 commits into from
May 20, 2024

Conversation

kwannoel
Copy link
Contributor

@kwannoel kwannoel commented May 19, 2024

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

What's changed and what's your intention?

The error seen will be (See the failing test here: https://buildkite.com/risingwavelabs/pull-request/builds/49863#018f9186-a50d-4f80-91d9-4ba0a30ca007):


failed to run `e2e_test/backfill/sink/different_pk_and_dist_key.slt`

Caused by:
    statement failed: db error: ERROR: Failed to run the query
    
    Caused by these errors (recent errors listed first):
      1: gRPC request to meta service failed: Internal error
      2: get error from control stream: worker node 1, gRPC request to stream service failed: Internal error: failed to collect barrier for epoch [6481195908136960, 6481195916460032, 6481195982061568]: Actor 38 exited unexpectedly: Executor error: Backfill progress for vnode VirtualNode(
        196,
    ) not found, backfill_state not initialized properly;
    

The fix is to just use dist_key instead of pk to derive the vnode when handling chunks coming from upstream. This is done with the state table's compute_vnode_by_pk interface. Under the hood, it will use the dist_key_indices_in_pk to extract the dist key from pk, and construct the vnode.

This will impact newly created MVs, when their dist_keys do not match their PKs.
The workaround is to set streaming_use_arrangement_backfill=false.

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.

@kwannoel kwannoel added the need-cherry-pick-release-1.9 Open a cherry-pick PR to branch release-1.8 after the current PR is merged label May 19, 2024
@kwannoel kwannoel requested a review from chenzl25 May 19, 2024 15:13
@github-actions github-actions bot added the type/fix Bug fix label May 19, 2024
@kwannoel kwannoel requested a review from KeXiangWang May 19, 2024 15:13
Copy link
Contributor

@KeXiangWang KeXiangWang left a comment

Choose a reason for hiding this comment

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

LGTM. Thanks for the timely fix!

src/stream/src/executor/backfill/utils.rs Show resolved Hide resolved
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, thanks

@chenzl25 chenzl25 added this pull request to the merge queue May 20, 2024
Merged via the queue into main with commit 837df64 May 20, 2024
27 of 28 checks passed
@chenzl25 chenzl25 deleted the kwannoel/fix-backfill-pk branch May 20, 2024 02:51
github-actions bot pushed a commit that referenced this pull request May 20, 2024
github-merge-queue bot pushed a commit that referenced this pull request May 20, 2024
…o derive vnode (#16815) (#16818)

Co-authored-by: Noel Kwan <47273164+kwannoel@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
need-cherry-pick-release-1.9 Open a cherry-pick PR to branch release-1.8 after the current PR is merged type/fix Bug fix
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants