Skip to content

Patched object_store 0.13.2: LocalFileSystem fsync backport - #4

Merged
reidkaufmann merged 12 commits into
base-object-store-0132from
upgrade-object-store-ver0132-a
Oct 26, 2026
Merged

reidkaufmann merged 12 commits into
base-object-store-0132from
upgrade-object-store-ver0132-a

Conversation

@reidkaufmann

Copy link
Copy Markdown
Collaborator

Tracking issue: influxdata/influxdb_pro#6262

Patched object_store 0.13.2 for influxdb_pro, which moved to 0.13.2 with DataFusion 53.1.0. Same content as #2 and #3 on 0.12.5: upstream's opt-in LocalFileSystem::with_fsync (shipped upstream in 0.14) plus our fixes. influxdata/influxdb_pro#6818 will pin this branch.

base-object-store-0132 is upstream tag v0.13.2 (7a65b75).

What is ported

Cherry-picked from upstream main with -x. All three applied without conflicts: 0.13.2 already has copy_opts/rename_opts and the optional tokio feature these commits were written against, so the hand-ported copy/rename/rename_if_not_exists variants from #2 are not needed here.

Commit Upstream
aabf95c close with error checking apache#676
f629d0e with_fsync apache#643
0e971ca fsync the source delete in create-mode rename apache#758

Our own commits, replayed from base-object-store-0125 without conflicts:

Cherry-picked from upstream to fix CI failures already present on v0.13.2, as #2 did for 0.12.5:

Not ported from base-object-store-0125:

  • MSRV bumps to 1.71/1.79: 0.13.2 already declares 1.85.
  • The two MSRV-job changes. The resolver step is a no-op here (edition 2024 uses resolver 3, whose default is already incompatible-rust-versions = fallback), and cargo check --all-features cannot pass on 1.85: upstream 0.13.2's cloud code uses let-chains (src/client/token.rs, Switch TokenCache to RWLock apache/arrow-rs-object-store#648), which need Rust 1.88. The job stays as upstream has it, checking default features, which cover fs and the ported code.

Testing

Locally on 1.97.0:

  • cargo fmt --all -- --check
  • cargo clippy -- -D warnings for each feature set in ci.yml (default, no-default, fs, aws, gcp, azure, http, integration, all-features, all-features/all-targets)
  • cargo doc --document-private-items --no-deps --all-features
  • cargo test: 94 passed, 1 ignored (lib); 29 passed, 1 ignored (doc). cargo test --all-features: 195 passed, 4 ignored (lib); 49 passed, 1 ignored (doc).
  • MSRV: cargo +1.85.0 check with default features on a lockfile generated by 1.85.0.
  • cargo audit (0.22.2): no vulnerabilities; on bare v0.13.2 it reports the two quick-xml advisories.

Against influxdb_pro main (c44dbb39) with [patch.crates-io] object_store = { path = ... }: cargo check -p influxdb3_clap_blocks (OSS) builds. With influxdb_pro#6818 merged in locally, influxdb3_clap_blocks (lib and tests), influxdb3-enterprise -F no_license and its benches build. Lockfile delta in influxdb_pro: quick-xml 0.39.4 -> 0.41.0 and nix 0.31.3 added.

jgiannuzzi and others added 12 commits October 26, 2026 15:21
* feat(local): add opt-in fsync to LocalFileSystem for durability

* Fix docs

---------

Co-authored-by: Andrew Lamb <andrew@nerdnetworks.org>
(cherry picked from commit dd0afcb)
* fix(local): fsync create-mode rename delete

* better

(cherry picked from commit 596e1f6)
The close-error tests from apache#676 closed a file and then rebuilt a File from
the freed descriptor or handle to close it again. That breaks the
from_raw_fd/from_raw_handle contract, and in a parallel test run another
thread can be handed the same descriptor in between, so the test could
close an unrelated file.

Split close_file into close_raw_fd (Unix) and close_raw_handle (Windows)
and test those with a value that can never be open: a descriptor at the
open-file limit, and a null handle. close_file's behavior is unchanged.

Raised in review (Copilot) on #2.

(cherry picked from commit 6b7c9a0)
(cherry picked from commit 0c380a1)
…ting (apache#799)

Adds a rust-toolchain.toml (mirroring apache/arrow-rs) pinning the
toolchain to 1.97.0 so CI uses a stable, reproducible Rust version and
is not surprised by new lints in future releases.

Rust 1.97.0's clippy added the useless_borrows_in_formatting lint, which
flags redundant references in format! arguments. Fixes the resulting
failures in the azure module.

Closes apache#798

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
(cherry picked from commit e64e8e3)
(cherry picked from commit 98cf6e8)
…ent directories

With fsync enabled, create_parent_dirs fsyncs only the directories the same
call created. A concurrent write into a directory another write had just
created found it existing, fsynced its parent and returned, possibly before
the creator had fsynced the ancestor holding that directory's entry; a power
loss could then remove the directory and the acknowledged file.

create_parent_dirs now registers the directories it is about to create until
their fsyncs are done, and every durable write waits while one of its
ancestors is registered. Writes into other directories do not wait.

(cherry picked from commit 808359a)
A creation's directory fsyncs can fail after it has created the directories,
and writes into them then returned success with the new directory entries not
known to be durable: writes waiting on the creation were released, and later
writes found nothing registered. A failed creation now records its
directories as unsynced; the next write under one fsyncs it and its parent
before returning, and clears the record.

Also document that coordination is per process and by path.

(cherry picked from commit 90dc948)
On Windows, canonicalize returns a \\?\ path, which never matched the paths
the store syncs.

(cherry picked from commit bf82b95)
…he#727)

Updates the requirements on [quick-xml](https://github.com/tafia/quick-xml) to permit the latest version.
- [Release notes](https://github.com/tafia/quick-xml/releases)
- [Changelog](https://github.com/tafia/quick-xml/blob/master/Changelog.md)
- [Commits](tafia/quick-xml@v0.39.0...v0.40.1)

---
updated-dependencies:
- dependency-name: quick-xml
  dependency-version: 0.40.1
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
(cherry picked from commit b058903)
(cherry picked from commit 80678e3)
…he#785)

Updates the requirements on [quick-xml](https://github.com/tafia/quick-xml) to permit the latest version.
- [Release notes](https://github.com/tafia/quick-xml/releases)
- [Changelog](https://github.com/tafia/quick-xml/blob/master/Changelog.md)
- [Commits](tafia/quick-xml@v0.40.1...v0.41.0)

---
updated-dependencies:
- dependency-name: quick-xml
  dependency-version: 0.41.0
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
(cherry picked from commit fd44ebb)
(cherry picked from commit 5f09c21)
Copilot AI balanced review requested due to automatic review settings October 26, 2026 15:37

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Changes recommended

Unresolved directory-coordination gaps can undermine acknowledged-write durability, and failure paths can retain registry entries and staging files.

4 open issues
What changed in this PR

Backports opt-in LocalFileSystem durability support to object_store 0.13.2 for influxdb_pro, alongside dependency and CI maintenance.

Changes:

  • Adds checked file closing and file/directory syncing for writes, copies, renames, and multipart completion.
  • Coordinates concurrent directory creation and adds durability regression tests.
  • Updates quick-xml, adds platform-specific dependencies, and applies toolchain and lint fixes.
File Description
src/​local.rs Implements durability helpers, directory coordination, and tests.
src/​client/​list.rs Removes redundant iterator conversions.
src/​azure/​credential.rs Removes redundant formatting borrows and adjusts alignment.
src/​azure/​builder.rs Removes redundant borrows in endpoint formatting.
rust-toolchain.toml Pins Rust 1.97.0 with rustfmt and clippy.
Cargo.toml Updates XML parsing and adds platform-specific close dependencies.

Review effort: Balanced

Comment thread src/local.rs
// afterwards we know exactly which directories are new and need to be fsynced. Registering
// them makes concurrent writes into them wait for those fsyncs.
let mut creating = None;
let first_existing = fsync.then(|| {

@reidkaufmann reidkaufmann Oct 26, 2026 •

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Pre-existing (upstream apache#643, same in base-object-store-0125). Not reachable from influxdb3, which uses one fsync setting per process. No change in this port.

Comment thread src/local.rs
Comment on lines +929 to +930
if dir == first_existing {
break;

@reidkaufmann reidkaufmann Oct 26, 2026 •

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Confirmed; pre-existing (upstream apache#643). Fix in a follow-up fork PR and upstream; no change in this port.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Fixed in #5 (9c71a13).

Comment thread src/local.rs
Comment on lines +1078 to +1080
if !self.synced {
registry.unsynced.insert(dir.clone());
}

@reidkaufmann reidkaufmann Oct 26, 2026 •

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Confirmed for failed mkdir (EACCES/ENOSPC); a file in the way fails earlier. Fork-only (PR #3). Fix in a follow-up fork PR; no change in this port.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Fixed in #5 (9c71a13).

Comment thread src/local.rs
// Durably publish the freshly-written staging file: flush its contents, close it, then
// rename it into place and fsync the destination's parent directory (the fsync calls
// are bundled into the helper and only run when fsync is enabled).
finish_staged_rename(file, &src, &s.dest, fsync)?;

@reidkaufmann reidkaufmann Oct 26, 2026 •

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Confirmed; pre-existing upstream (src.take() before the fallible steps). Fix upstream; no change in this port.

@reidkaufmann
reidkaufmann merged commit abc45ac into base-object-store-0132 Oct 26, 2026
11 checks passed
@reidkaufmann
reidkaufmann deleted the upgrade-object-store-ver0132-a branch October 26, 2026 16:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants