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(connector): better locating and error reporting for connector library #15342

Merged
merged 4 commits into from
Feb 29, 2024

Conversation

BugenZhao
Copy link
Member

@BugenZhao BugenZhao commented Feb 28, 2024

Signed-off-by: Bugen Zhao [email protected]I hereby agree to the terms of the RisingWave Labs, Inc. Contributor License Agreement.

What's changed and what's your intention?

This acts as a preparation step of risingwavelabs/homebrew-risingwave#28.

  • Canonicalize the path of current_exe before looking for the sibling libs directory. So it's based on the real path of the binary (like /opt/homebrew/Cellar/risingwave/1.6/bin/risingwave), instead of the symbolic link (/opt/homebrew/bin/risingwave). opt/homebrew/bin/libs will make no sense.

  • Use fs_err as the replacement of std::fs to provide better error reporting.

  • Use LazyLock::get_or_try_init instead of storing the Err variant into the static variable once the initialization fails. The main motivation is to resolve the error source issue, but the advised behavior appears to make more sense to me as well.

    // Note: anyhow!(e) doesn't preserve source
    // https://github.com/dtolnay/anyhow/issues/341
    Err(anyhow!(e.to_report_string()).context("jvm not initialized properly"))


Preview of the UI:

I run .risingwave/bin/risingwave/playground, which is a symbolic link of target/debug/risingwave

ERROR:  Failed to run the query

Caused by these errors (recent errors listed first):
  1: gRPC request to meta service failed: Internal error
  2: failed to create source worker
  3: failed to create SplitEnumerator
  4: jvm not initialized properly
- 5: CONNECTOR_LIBS_PATH "/Users/bugenzhao/Developer/S/risingwave-opensource/.risingwave/bin/risingwave/./libs" is not a directory
+ 5: failed to read connector libs
+ 6: failed to read directory `/Users/bugenzhao/Developer/S/risingwave-opensource/target/debug/libs`
+ 7: No such file or directory (os error 2)

Checklist

  • I have written necessary rustdoc comments
  • I have added necessary unit tests and integration tests
  • All checks passed in ./risedev check (or alias, ./risedev c)

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.

@BugenZhao BugenZhao requested a review from a team as a code owner February 28, 2024 09:56
@github-actions github-actions bot added the type/fix Bug fix label Feb 28, 2024
Signed-off-by: Bugen Zhao <[email protected]>
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

@xxchan xxchan added this pull request to the merge queue Feb 29, 2024
Merged via the queue into main with commit 914aabd Feb 29, 2024
27 of 28 checks passed
@xxchan xxchan deleted the bz/better-locate-java-lib branch February 29, 2024 08:26
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.

4 participants