-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Make backtrace as a cargo feature #7527
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This adds a build config, not a cargo feature. A cargo feature (which I think should be preferred because build configs are an even bigger mess) works like this:
- add feature to
Cargo.toml
- change the cfg guard to
#[cfg(feature = "backtrace")]
Also see https://doc.rust-lang.org/cargo/reference/features.html.
On top of that, I think this needs some docs, at least for get_back_trace
(you probably want to use a single method so you can easily reuse the docstring and either use the cfg-guards within that method or create a new private fn called get_back_trace_impl
).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you @comphead -- I think this is looking very close
.collect::<Vec<&str>>() | ||
.first() | ||
.unwrap_or(&"") | ||
.to_string() | ||
} | ||
|
||
/// To enable optional rust backtrace in DataFusion: | ||
/// - [`Setup Env Variables`]<https://doc.rust-lang.org/std/backtrace/index.html#environment-variables> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
@@ -34,6 +34,7 @@ path = "src/lib.rs" | |||
|
|||
[features] | |||
avro = ["apache-avro"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As written, to be enabled, a user would have to use datafusion_common
directly (they couldn't activate it through datafusion
)
To enable it via datafusion we also need to add it to core/Cargo.toml, like this:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks I was little bit struggling on how it make on the datafusion level
#[cfg(feature = "backtrace")] | ||
#[test] | ||
#[allow(clippy::unnecessary_literal_unwrap)] | ||
fn test_enabled_backtrace() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if we should also add a CI test, perhaps like https://github.com/apache/arrow-datafusion/blob/cde74016e930ffd9c55eed403b84bcd026f38d0f/.github/workflows/rust.yml#L99
2 tests failed because the configuration is different between architectures for
mac,win
Lack of BACKTRACE=1 on mac,win arch expectedly lead the test to fail. @alamb would you mind to help where this set up? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Which issue does this PR close?
Closes #7522.
Rationale for this change
In #7434 the backtrace was introduced, however its expensive to build and should be optional. Introducing a cargo feature for backtrace
What changes are included in this PR?
Are these changes tested?
yes
Are there any user-facing changes?