Skip to content

fix: preserve ABFS container in object store registry keys - #23935

Open
847850277 wants to merge 3 commits into
apache:mainfrom
847850277:issues_23926
Open

fix: preserve ABFS container in object store registry keys#23935
847850277 wants to merge 3 commits into
apache:mainfrom
847850277:issues_23926

Conversation

@847850277

Copy link
Copy Markdown
Contributor

Which issue does this PR close?

Rationale for this change

ABFS and ABFSS URLs encode the container namespace in URL userinfo:

abfss://<container>@<account>.dfs.core.windows.net/

The object store registry currently removes userinfo when deriving its key. As a result, different containers under the same Azure account produce the same key, allowing one registered store to overwrite another

What changes are included in this PR?

  • Preserve URL userinfo when deriving registry keys for abfs and abfss.
  • Keep the existing credential-removal behavior for all other schemes.
  • Add regression tests for multiple containers under the same Azure account.
  • Cover both abfs and abfss.

Are these changes tested?

yes

Are there any user-facing changes?

@peterxcli
I have submitted a pr. could you please help review it when you have time? Thanks!

Copilot AI review requested due to automatic review settings July 28, 2026 07:06
@github-actions github-actions Bot added the execution Related to the execution crate label Jul 28, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes a key-collision bug in DefaultObjectStoreRegistry for Azure ABFS/ABFSS URLs by ensuring the registry key derivation preserves the container namespace encoded in URL userinfo (e.g. abfss://<container>@<account>...). This prevents one registered ABFS container store from overwriting another when they share the same Azure account host.

Changes:

  • Make get_url_key scheme-aware: preserve userinfo for abfs/abfss, continue stripping it for other schemes.
  • Update documentation comments for get_url_key to reflect the new behavior.
  • Add regression tests covering both abfs and abfss, including separate registration of multiple containers under one account.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +271 to +277
let key_authority = match url.scheme() {
// ABFS encodes the container namespace in URL userinfo.
"abfs" | "abfss" => &url[url::Position::BeforeUsername..url::Position::AfterPort],
_ => &url[url::Position::BeforeHost..url::Position::AfterPort],
};

format!("{}://{key_authority}", url.scheme())

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

this suggestion looks good

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

nvm

@codecov-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 80.68%. Comparing base (bb75d92) to head (fec42b4).

Additional details and impacted files
@@           Coverage Diff           @@
##             main   #23935   +/-   ##
=======================================
  Coverage   80.68%   80.68%           
=======================================
  Files        1095     1095           
  Lines      372534   372568   +34     
  Branches   372534   372568   +34     
=======================================
+ Hits       300579   300607   +28     
- Misses      54015    54020    +5     
- Partials    17940    17941    +1     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Comment on lines +271 to +277
let key_authority = match url.scheme() {
// ABFS encodes the container namespace in URL userinfo.
"abfs" | "abfss" => &url[url::Position::BeforeUsername..url::Position::AfterPort],
_ => &url[url::Position::BeforeHost..url::Position::AfterPort],
};

format!("{}://{key_authority}", url.scheme())

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

this suggestion looks good

Comment on lines +271 to +281
let key_authority = match url.scheme() {
// ABFS encodes the container namespace in URL userinfo.
"abfs" | "abfss" if !url.username().is_empty() => format!(
"{}@{}",
&url[url::Position::BeforeUsername..url::Position::AfterUsername],
&url[url::Position::BeforeHost..url::Position::AfterPort],
),
_ => url[url::Position::BeforeHost..url::Position::AfterPort].to_string(),
};

format!("{}://{key_authority}", url.scheme())

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
let key_authority = match url.scheme() {
// ABFS encodes the container namespace in URL userinfo.
"abfs" | "abfss" if !url.username().is_empty() => format!(
"{}@{}",
&url[url::Position::BeforeUsername..url::Position::AfterUsername],
&url[url::Position::BeforeHost..url::Position::AfterPort],
),
_ => url[url::Position::BeforeHost..url::Position::AfterPort].to_string(),
};
format!("{}://{key_authority}", url.scheme())
let authority_start = match url.scheme() {
"abfs" | "abfss" if !url.username().is_empty() => url::Position::BeforeUsername,
_ => url::Position::BeforeHost,
};
format!(
"{}://{}",
url.scheme(),
&url[authority_start..url::Position::AfterPort],
)

Comment on lines +271 to +277
let key_authority = match url.scheme() {
// ABFS encodes the container namespace in URL userinfo.
"abfs" | "abfss" => &url[url::Position::BeforeUsername..url::Position::AfterPort],
_ => &url[url::Position::BeforeHost..url::Position::AfterPort],
};

format!("{}://{key_authority}", url.scheme())

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

nvm

@peterxcli

Copy link
Copy Markdown
Member

also cc @andygrove — related to apache/datafusion-comet#5053

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

execution Related to the execution crate

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ObjectStoreRegistry key strips URL userinfo, causing ABFS containers on the same account to collide

4 participants