Skip to content

os/bluestore: Fast WAL for RocksDB - #62224

Merged
aclamk merged 18 commits into
ceph:mainfrom
aclamk:wip-aclamk-pere-wal-fsync
Apr 9, 2025
Merged

aclamk merged 18 commits into
ceph:mainfrom
aclamk:wip-aclamk-pere-wal-fsync

Conversation

@aclamk

@aclamk aclamk commented Mar 11, 2025 •

Copy link
Copy Markdown
Contributor

The work here is based on #56927.
It implements the design principles showed there, but with a bit different implementation details.

Contribution Guidelines

  • To sign and title your commits, please refer to Submitting Patches to Ceph.

  • If you are submitting a fix for a stable branch (e.g. "quincy"), please refer to Submitting Patches to Ceph - Backports for the proper workflow.

  • When filling out the below checklist, you may click boxes directly in the GitHub web UI. When entering or editing the entire PR message in the GitHub web UI editor, you may also select a checklist item by adding an x between the brackets: [x]. Spaces and capitalization matter when checking off items this way.

Checklist

  • Tracker (select at least one)
    • References tracker ticket
    • Very recent bug; references commit where it was introduced
    • New feature (ticket optional)
    • Doc update (no ticket needed)
    • Code cleanup (no ticket needed)
  • Component impact
    • Affects Dashboard, opened tracker ticket
    • Affects Orchestrator, opened tracker ticket
    • No impact that needs to be tracked
  • Documentation (select at least one)
    • Updates relevant documentation
    • No doc update is appropriate
  • Tests (select at least one)
Show available Jenkins commands

@github-actions

Copy link
Copy Markdown

This pull request can no longer be automatically merged: a rebase is needed and changes have to be manually resolved

@aclamk
aclamk force-pushed the wip-aclamk-pere-wal-fsync branch from 31e4731 to c114aea Compare March 11, 2025 17:59
@aclamk aclamk added aclamk-testing-phoebe bluestore testing and removed aclamk-testing-phoebe bluestore testing labels Mar 11, 2025
@aclamk
aclamk force-pushed the wip-aclamk-pere-wal-fsync branch from c114aea to ab34d64 Compare March 11, 2025 18:42
@aclamk

aclamk commented Mar 11, 2025

Copy link
Copy Markdown
Contributor Author

jenkins test make check

1 similar comment
@aclamk

aclamk commented Mar 12, 2025

Copy link
Copy Markdown
Contributor Author

jenkins test make check

@aclamk aclamk added the aclamk-testing-phoebe bluestore testing label Mar 12, 2025
@aclamk
aclamk force-pushed the wip-aclamk-pere-wal-fsync branch from ab34d64 to 41e8d24 Compare March 17, 2025 17:16
@aclamk

aclamk commented Mar 18, 2025

Copy link
Copy Markdown
Contributor Author

jenkins test api

@aclamk
aclamk force-pushed the wip-aclamk-pere-wal-fsync branch from 6780770 to 10842c6 Compare March 18, 2025 10:42
@aclamk
aclamk marked this pull request as ready for review March 18, 2025 12:38
@aclamk
aclamk requested a review from a team as a code owner March 18, 2025 12:38
Comment thread src/common/options/global.yaml.in Outdated

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.

fdatasync double backticks

Comment thread src/common/options/global.yaml.in Outdated

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.

to migrate WAL entries to the previous format.

Comment thread src/include/encoding.h Outdated

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.

To be removed, not used any more

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

removed.

Comment thread src/include/encoding.h Outdated

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.

To be removed, not used any more

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Removed.

Comment thread src/common/options/global.yaml.in Resolved
Comment thread src/os/bluestore/BlueFS.h Resolved
Comment thread src/os/bluestore/BlueFS.cc Resolved
Comment thread src/os/bluestore/BlueFS.cc Outdated

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.

Wouldn't it be better to use head_size()/tail_size() helpers instead of sizeof?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Replaced all sizeofs with header_size() / tail_size() calls.

Comment thread src/os/bluestore/BlueFS.cc Resolved
Comment thread src/os/bluestore/BlueFS.h Outdated

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.

8 to be replaced with sizeof(wal_marker) or something

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I'm not sure with "8", but I added comment to explain the code.

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.

AFAIU 8 comes from marker's length. Shouldn't it be sizeof(marker) then?

Comment thread src/os/bluestore/BlueFS.h Resolved
Comment thread src/os/bluestore/BlueFS.cc Outdated

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.

Apaprently no need to declare outside 'if' statement

@aclamk
aclamk force-pushed the wip-aclamk-pere-wal-fsync branch 2 times, most recently from 1032eea to c2fdd21 Compare March 21, 2025 21:49
Comment thread src/common/options/global.yaml.in Outdated

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.

'wal-to-v1' is kinda weird now...

aclamk added 5 commits March 28, 2025 16:08
Changed logic for selecting bluefs_super_t wal_version field.
Now it is more a result of the data that is in bluefs log and
less directly controlled.

Signed-off-by: Adam Kupczyk <[email protected]>
The check involves timing check.
Jenkins is too unpredictable with performance.

Signed-off-by: Adam Kupczyk <[email protected]>
This refactor turns WAL_v2 into globally available ENVELOPE_MODE.
The RocksDB WAL files are now just using existing feature.
Now adding new file encoding schemes will be easier.

Signed-off-by: Adam Kupczyk <[email protected]>
…pe_mode

No logic change, just conf name and constants adaptation.

Signed-off-by: Adam Kupczyk <[email protected]>
This is the variant of DENC_START that manually controls encoding version.
As being incompatible with static compile-time checking of
StructVChecker, new (legacy) mode had to be introduced.

Also,
Removed struct_v and struct_compat from denc_finish.

Signed-off-by: Adam Kupczyk <[email protected]>
@aclamk aclamk removed the needs-qa label Mar 28, 2025
@aclamk

aclamk commented Mar 28, 2025

Copy link
Copy Markdown
Contributor Author

@markhpc I removed your "need-qa" label. This thing passed preliminary teuthology, and this version is not final.

Note: critical bluestore PRs we are weekly testing / reviewing with aclamk-testing-* labels.

@aclamk
aclamk force-pushed the wip-aclamk-pere-wal-fsync branch from 13ed631 to 11f9a67 Compare March 28, 2025 16:28
+ relocated config bluefs_wal_envelope_mode close to other bluefs
  configs

Signed-off-by: Adam Kupczyk <[email protected]>
@aclamk

aclamk commented Mar 29, 2025

Copy link
Copy Markdown
Contributor Author

jenkins test make check arm64

@aclamk aclamk added aclamk-testing-ganymede bluestore testing and removed aclamk-testing-phoebe bluestore testing labels Apr 2, 2025
@aclamk

aclamk commented Apr 7, 2025

Copy link
Copy Markdown
Contributor Author

@aclamk
aclamk merged commit 09e8bd4 into ceph:main Apr 9, 2025
viliam-durina added a commit to viliam-durina/ceph that referenced this pull request Sep 1, 2026
`rocksdb::WritableFile` assumes that whatever was allocated using `Allocate()`, and was not actually written to, is released when the file is closed (cf. `PosixWritableFile::Close()`). This used to work up to PR ceph#62224 (released in 20.1.0, a tentacle RC), which removed the truncation from `close` and it assumed that `truncate` is called.

This PR adds the truncation back to `BlueRocksWritableFile::Close()`. We cannot bring back the exact pre-62224 code, as it relies on `h->pos`. Instead we flush the file and use `fnode.size`, which contains the on-disk size, including the envelope.

This should fix https://tracker.ceph.com/issues/76256.

I'm not sure why this issue excessively affected clusters with no sharding. From the logs attached to the issue, in the non-sharded case there are many files with only a few kB payload in a 70MB file; in the sharded case the unreleased file tails still exist, but are much smaller.

The new test case unit-tests the new `truncate_unused_allocations()` method, overall correctness of BlueFS operation is covered by other tests already.

Fixes: https://tracker.ceph.com/issues/76256
Signed-off-by: Viliam <[email protected]>
viliam-durina added a commit to viliam-durina/ceph that referenced this pull request Sep 1, 2026
`rocksdb::WritableFile` assumes that whatever was allocated using `Allocate()`, and was not actually written to, is released when the file is closed (cf. `PosixWritableFile::Close()`). This used to work up to PR ceph#62224 (released in 20.1.0, a tentacle RC), which removed the truncation from `close` and it assumed that `truncate` is called.

This PR adds the truncation back to `BlueRocksWritableFile::Close()`. We cannot bring back the exact pre-62224 code, as it relies on `h->pos`. Instead we flush the file and use `fnode.size`, which contains the on-disk size, including the envelope.

This should fix https://tracker.ceph.com/issues/76256.

I'm not sure why this issue excessively affected clusters with no sharding. From the logs attached to the issue, in the non-sharded case there are many files with only a few kB payload in a 70MB file; in the sharded case the unreleased file tails still exist, but are much smaller.

The new test case unit-tests the new `truncate_unused_allocations()` method, overall correctness of BlueFS operation is covered by other tests already.

Fixes: https://tracker.ceph.com/issues/76256
Signed-off-by: Viliam <[email protected]>
viliam-durina added a commit to viliam-durina/ceph that referenced this pull request Sep 1, 2026
`rocksdb::WritableFile` assumes that whatever was allocated using `Allocate()`, and was not actually written to, is released when the file is closed (cf. `PosixWritableFile::Close()`). This used to work up to PR ceph#62224 (released in 20.1.0, a tentacle RC), which removed the truncation from `close` and it assumed that `truncate` is called.

This PR adds the truncation back to `BlueRocksWritableFile::Close()`. We cannot bring back the exact pre-62224 code, as it relies on `h->pos`. Instead we flush the file and use `fnode.size`, which contains the on-disk size, including the envelope.

This should fix https://tracker.ceph.com/issues/76256.

I'm not sure why this issue excessively affected clusters with no sharding. From the logs attached to the issue, in the non-sharded case there are many files with only a few kB payload in a 70MB file; in the sharded case the unreleased file tails still exist, but are much smaller.

The new test case unit-tests the new `truncate_unused_allocations()` method, overall correctness of BlueFS operation is covered by other tests already. We also delete `BlueStoreWritableFile::UseDirectIO()`, as it is unused (it doesn't override superclass method).

Fixes: https://tracker.ceph.com/issues/76256
Signed-off-by: Viliam <[email protected]>
viliam-durina added a commit to viliam-durina/ceph that referenced this pull request Sep 2, 2026
`rocksdb::WritableFile` assumes that whatever was allocated using `Allocate()`, and was not actually written to, is released when the file is closed (cf. `PosixWritableFile::Close()`). This used to work up to PR ceph#62224 (released in 20.1.0, a tentacle RC), which removed the truncation from `close` and it assumed that `truncate` is called.

This PR adds the truncation back to `BlueRocksWritableFile::Close()`. We cannot bring back the exact pre-62224 code, as it relies on `h->pos`. Instead we flush the file and use `fnode.size`, which contains the on-disk size, including the envelope.

This should fix https://tracker.ceph.com/issues/76256.

I'm not sure why this issue excessively affected clusters with no sharding. From the logs attached to the issue, in the non-sharded case there are many files with only a few kB payload in a 70MB file; in the sharded case the unreleased file tails still exist, but are much smaller.

The new test case unit-tests the new `truncate_unused_allocations()` method, overall correctness of BlueFS operation is covered by other tests already. We also delete `BlueStoreWritableFile::UseDirectIO()`, as it is unused (it doesn't override superclass method).

Fixes: https://tracker.ceph.com/issues/76256
Signed-off-by: Viliam <[email protected]>
viliam-durina added a commit to viliam-durina/ceph that referenced this pull request Sep 2, 2026
`rocksdb::WritableFile` assumes that whatever was allocated using `Allocate()`, and was not actually written to, is released when the file is closed (cf. `PosixWritableFile::Close()`). This used to work up to PR ceph#62224 (released in 20.1.0, a tentacle RC), which removed the truncation from `close` and it assumed that `truncate` is called.

This PR adds the truncation back to `BlueRocksWritableFile::Close()`. We cannot bring back the exact pre-62224 code, as it relies on `h->pos`. Instead we flush the file and use `fnode.size`, which contains the on-disk size, including the envelope.

This should fix https://tracker.ceph.com/issues/76256.

I'm not sure why this issue excessively affected clusters with no sharding. From the logs attached to the issue, in the non-sharded case there are many files with only a few kB payload in a 70MB file; in the sharded case the unreleased file tails still exist, but are much smaller.

The new test case unit-tests the new `truncate_unused_allocations()` method, overall correctness of BlueFS operation is covered by other tests already. We also delete `BlueStoreWritableFile::UseDirectIO()`, as it is unused (it doesn't override superclass method).

Fixes: https://tracker.ceph.com/issues/76256
Signed-off-by: Viliam <[email protected]>
viliam-durina added a commit to viliam-durina/ceph that referenced this pull request Sep 2, 2026
`rocksdb::WritableFile` assumes that whatever was allocated using `Allocate()`, and was not actually written to, is released when the file is closed (cf. `PosixWritableFile::Close()`). This used to work up to PR ceph#62224 (released in 20.1.0, a tentacle RC), which removed the truncation from `close` and it assumed that `truncate` is called.

This PR adds the truncation back to `BlueRocksWritableFile::Close()`. We cannot bring back the exact pre-62224 code, as it relies on `h->pos`. Instead we flush the file and use `fnode.size`, which contains the on-disk size, including the envelope.

This should fix https://tracker.ceph.com/issues/76256.

I'm not sure why this issue excessively affected clusters with no sharding. From the logs attached to the issue, in the non-sharded case there are many files with only a few kB payload in a 70MB file; in the sharded case the unreleased file tails still exist, but are much smaller.

The new test case unit-tests the new `truncate_unused_allocations()` method, overall correctness of BlueFS operation is covered by other tests already. We also delete `BlueStoreWritableFile::UseDirectIO()`, as it is unused (it doesn't override superclass method).

Fixes: https://tracker.ceph.com/issues/76256
Signed-off-by: Viliam <[email protected]>
viliam-durina added a commit to viliam-durina/ceph that referenced this pull request Sep 2, 2026
`rocksdb::WritableFile` assumes that whatever was allocated using `Allocate()`, and was not actually written to, is released when the file is closed (cf. `PosixWritableFile::Close()`). This used to work up to PR ceph#62224 (released in 20.1.0, a tentacle RC), which removed the truncation from `close` and it assumed that `truncate` is called.

This PR adds the truncation back to `BlueRocksWritableFile::Close()`. We cannot bring back the exact pre-62224 code, as it relies on `h->pos`. Instead we flush the file and use `fnode.size`, which contains the on-disk size, including the envelope.

This should fix https://tracker.ceph.com/issues/76256.

I'm not sure why this issue excessively affected clusters with no sharding. From the logs attached to the issue, in the non-sharded case there are many files with only a few kB payload in a 70MB file; in the sharded case the unreleased file tails still exist, but are much smaller.

The new test case unit-tests the new `truncate_unused_allocations()` method, overall correctness of BlueFS operation is covered by other tests already. We also delete `BlueStoreWritableFile::UseDirectIO()`, as it is unused (it doesn't override superclass method).

Fixes: https://tracker.ceph.com/issues/76256
Signed-off-by: Viliam Durina <[email protected]>
viliam-durina added a commit to viliam-durina/ceph that referenced this pull request Sep 2, 2026
`rocksdb::WritableFile` assumes that whatever was allocated using `Allocate()`, and was not actually written to, is released when the file is closed (cf. `PosixWritableFile::Close()`). This used to work up to PR ceph#62224 (released in 20.1.0, a tentacle RC), which removed the truncation from `close` and it assumed that `truncate` is called.

This PR adds the truncation back to `BlueRocksWritableFile::Close()`. We cannot bring back the exact pre-62224 code, as it relies on `h->pos`. Instead we flush the file and use `fnode.size`, which contains the on-disk size, including the envelope.

This should fix https://tracker.ceph.com/issues/76256.

I'm not sure why this issue excessively affected clusters with no sharding. From the logs attached to the issue, in the non-sharded case there are many files with only a few kB payload in a 70MB file; in the sharded case the unreleased file tails still exist, but are much smaller.

The new test case unit-tests the new `truncate_unused_allocations()` method, overall correctness of BlueFS operation is covered by other tests already. We also delete `BlueStoreWritableFile::UseDirectIO()`, as it is unused (it doesn't override superclass method).

Fixes: https://tracker.ceph.com/issues/76256
Signed-off-by: Viliam Durina <[email protected]>
viliam-durina added a commit to viliam-durina/ceph that referenced this pull request Sep 2, 2026
`rocksdb::WritableFile` assumes that whatever was allocated using `Allocate()`, and was not actually written to, is released when the file is closed (cf. `PosixWritableFile::Close()`). This used to work up to PR ceph#62224 (released in 20.1.0, a tentacle RC), which removed the truncation from `close` and it assumed that `truncate` is called.

This PR adds the truncation back to `BlueRocksWritableFile::Close()`. We cannot bring back the exact pre-62224 code, as it relies on `h->pos`. Instead we flush the file and use `fnode.size`, which contains the on-disk size, including the envelope.

This should fix https://tracker.ceph.com/issues/76256.

I'm not sure why this issue excessively affected clusters with no sharding. From the logs attached to the issue, in the non-sharded case there are many files with only a few kB payload in a 70MB file; in the sharded case the unreleased file tails still exist, but are much smaller.

The new test case unit-tests the new `truncate_unused_allocations()` method, overall correctness of BlueFS operation is covered by other tests already. We also delete `BlueStoreWritableFile::UseDirectIO()`, as it is unused (it doesn't override superclass method).

Fixes: https://tracker.ceph.com/issues/76256
Signed-off-by: Viliam Durina <[email protected]>
yaelazulay-redhat pushed a commit to yaelazulay-redhat/ceph that referenced this pull request Sep 24, 2026
`rocksdb::WritableFile` assumes that whatever was allocated using `Allocate()`, and was not actually written to, is released when the file is closed (cf. `PosixWritableFile::Close()`). This used to work up to PR ceph#62224 (released in 20.1.0, a tentacle RC), which removed the truncation from `close` and it assumed that `truncate` is called.

This PR adds the truncation back to `BlueRocksWritableFile::Close()`. We cannot bring back the exact pre-62224 code, as it relies on `h->pos`. Instead we flush the file and use `fnode.size`, which contains the on-disk size, including the envelope.

This should fix https://tracker.ceph.com/issues/76256.

I'm not sure why this issue excessively affected clusters with no sharding. From the logs attached to the issue, in the non-sharded case there are many files with only a few kB payload in a 70MB file; in the sharded case the unreleased file tails still exist, but are much smaller.

The new test case unit-tests the new `truncate_unused_allocations()` method, overall correctness of BlueFS operation is covered by other tests already. We also delete `BlueStoreWritableFile::UseDirectIO()`, as it is unused (it doesn't override superclass method).

Fixes: https://tracker.ceph.com/issues/76256
Signed-off-by: Viliam Durina <[email protected]>
batrick pushed a commit that referenced this pull request Sep 30, 2026
`rocksdb::WritableFile` assumes that whatever was allocated using `Allocate()`, and was not actually written to, is released when the file is closed (cf. `PosixWritableFile::Close()`). This used to work up to PR #62224 (released in 20.1.0, a tentacle RC), which removed the truncation from `close` and it assumed that `truncate` is called.

This PR adds the truncation back to `BlueRocksWritableFile::Close()`. We cannot bring back the exact pre-62224 code, as it relies on `h->pos`. Instead we flush the file and use `fnode.size`, which contains the on-disk size, including the envelope.

This should fix https://tracker.ceph.com/issues/76256.

I'm not sure why this issue excessively affected clusters with no sharding. From the logs attached to the issue, in the non-sharded case there are many files with only a few kB payload in a 70MB file; in the sharded case the unreleased file tails still exist, but are much smaller.

The new test case unit-tests the new `truncate_unused_allocations()` method, overall correctness of BlueFS operation is covered by other tests already. We also delete `BlueStoreWritableFile::UseDirectIO()`, as it is unused (it doesn't override superclass method).

Fixes: https://tracker.ceph.com/issues/76256
Signed-off-by: Viliam Durina <[email protected]>
(cherry picked from commit 88dca29)
dparmar18 pushed a commit to dparmar18/ceph that referenced this pull request Oct 5, 2026
`rocksdb::WritableFile` assumes that whatever was allocated using `Allocate()`, and was not actually written to, is released when the file is closed (cf. `PosixWritableFile::Close()`). This used to work up to PR ceph#62224 (released in 20.1.0, a tentacle RC), which removed the truncation from `close` and it assumed that `truncate` is called.

This PR adds the truncation back to `BlueRocksWritableFile::Close()`. We cannot bring back the exact pre-62224 code, as it relies on `h->pos`. Instead we flush the file and use `fnode.size`, which contains the on-disk size, including the envelope.

This should fix https://tracker.ceph.com/issues/76256.

I'm not sure why this issue excessively affected clusters with no sharding. From the logs attached to the issue, in the non-sharded case there are many files with only a few kB payload in a 70MB file; in the sharded case the unreleased file tails still exist, but are much smaller.

The new test case unit-tests the new `truncate_unused_allocations()` method, overall correctness of BlueFS operation is covered by other tests already. We also delete `BlueStoreWritableFile::UseDirectIO()`, as it is unused (it doesn't override superclass method).

Fixes: https://tracker.ceph.com/issues/76256
Signed-off-by: Viliam Durina <[email protected]>
batrick pushed a commit that referenced this pull request Oct 28, 2026
`rocksdb::WritableFile` assumes that whatever was allocated using `Allocate()`, and was not actually written to, is released when the file is closed (cf. `PosixWritableFile::Close()`). This used to work up to PR #62224 (released in 20.1.0, a tentacle RC), which removed the truncation from `close` and it assumed that `truncate` is called.

This PR adds the truncation back to `BlueRocksWritableFile::Close()`. We cannot bring back the exact pre-62224 code, as it relies on `h->pos`. Instead we flush the file and use `fnode.size`, which contains the on-disk size, including the envelope.

This should fix https://tracker.ceph.com/issues/76256.

I'm not sure why this issue excessively affected clusters with no sharding. From the logs attached to the issue, in the non-sharded case there are many files with only a few kB payload in a 70MB file; in the sharded case the unreleased file tails still exist, but are much smaller.

The new test case unit-tests the new `truncate_unused_allocations()` method, overall correctness of BlueFS operation is covered by other tests already. We also delete `BlueStoreWritableFile::UseDirectIO()`, as it is unused (it doesn't override superclass method).

Fixes: https://tracker.ceph.com/issues/76256
Signed-off-by: Viliam Durina <[email protected]>
(cherry picked from commit 88dca29)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants