fix: include ABFS container in object store cache key - #5053
Conversation
|
Nice targeted fix. I confirmed the analysis by reading A few small things worth considering:
None of these are blockers. |
|
@andygrove thanks for the review, added comment on the abfs branch and new test coverage per your review comment |
|
df PR: apache/datafusion#23935 |
|
Fix looks good and I confirmed it works. Two containers in the same account now resolve to their own stores across tasks, where on One question before I approve. Within a single plan, |
We didn't use the datafusion's |
I think we may be talking past each other here. Comet doesn't call I put together a quick probe on your branch that registers two containers against one shared #[test]
fn test_shared_runtime_env_collides_across_containers() {
let configs = HashMap::from([("fs.azure.account.key".into(), "c2VjcmV0".into())]);
// One plan => one shared RuntimeEnv, as in planner.rs
let runtime_env = Arc::new(RuntimeEnv::default());
let register = |container: &str| {
super::prepare_object_store_with_configs(
Arc::clone(&runtime_env),
format!("abfss://{container}@shared-acct.dfs.core.windows.net/path/file.parquet"),
&configs,
)
.unwrap()
.0
};
let url_a = register("container-a");
let url_b = register("container-b");
let store_a = runtime_env.object_store(&url_a).unwrap();
let store_b = runtime_env.object_store(&url_b).unwrap();
println!("url_a={url_a} url_b={url_b}");
println!("same store: {}", Arc::ptr_eq(&store_a, &store_b));
println!("store_a={store_a:?}");
}Output: Both URLs resolve to the same store, and that store is bound to Would you be up for closing this in the same PR? Comet already builds its Two smaller things while I'm here. The two new tests build a fresh On the module doc at One thing I noticed that works in your favour and isn't mentioned in the description: |
|
@andygrove thanks for further explanation! you're really right on this. I've addressed all of your review/suggestion.
Thanks for catching this! sorry my previous response just refuse to address this because that's my blindspot.
added as
added.
Nice! |
Which issue does this PR close?
Closes #4993.
Rationale for this change
ABFS URLs encode the container in URL userinfo, for example
abfss://container@account.dfs.core.windows.net/path. The process-wide object store cachepreviously keyed stores by scheme, host, and port only, so different containers in the same
storage account shared one cache entry. Since each Azure object store is bound to the container
from its URL, a later read could reuse the first container's store and return data from the wrong
container.
This also prevents containers sharing one Hadoop configuration map from resolving different
fs.azure.sas.<container>.<account>tokens into the same cached store.What changes are included in this PR?
abfsandabfss, while retainingthe existing host-only behavior for other schemes.
configuration and verifies that they resolve to distinct object store instances.
How are these changes tested?
cargo test --manifest-path native/Cargo.toml -p datafusion-comet --lib(
129 passed; 4 ignored)cargo clippy --manifest-path native/Cargo.toml -p datafusion-comet --lib --tests -- -D warningscargo fmt --manifest-path native/Cargo.toml --all -- --checkThe regression constructs the Azure stores locally and does not issue network requests.