Repository navigation
os/bluestore: expand BlueFS log if available space is insufficient - #50216
Conversation
|
@aclamk hey can you review this. I want add meaningful tests but I wanted to have a quick review whether this code is correct or missing a point. |
|
Currently this is failing on _replay when compaction wasn't previously done. It reads less bytes than the block size in |
aclamk
left a comment
There was a problem hiding this comment.
The concept is sound, but still some problems.
The attached test is insufficient to prove that solution works.
There was a problem hiding this comment.
Move this block below checking if we already started compaction.
It does not have to be here, and return will leave log.lock still locked.
There was a problem hiding this comment.
I prefer unlocking on return so we don't have to add a flag to maybe_extend_log. Extending the log will block if log_forbidden_to_expand is true which would always be the case after a successful atomic_exchange.
There was a problem hiding this comment.
Honestly I don't understand the above point. Personally I'd prefer setting log_is_compacting prior to log.lock acquisition and maybe_extent_log() call too.
@pereman2 - could you please elaborate?
There was a problem hiding this comment.
The idea of extending the log before starting compaction is because extending the log will wait until compaction is finished, but since you could set log_is_compacting to true before the _maybe_extend_log call, that would run an infinite loop.
There was a problem hiding this comment.
hmm... not that answering this question is important but mostly out of curiosity...
I'm talking about reordering the current code in the following way:
// only one compaction allowed at one time
bool old_is_comp = std::atomic_exchange(&log_is_compacting, true);
if (old_is_comp) {
dout(10) << __func__ << " ongoing" <<dendl;
log.lock.unlock();
return;
}
// lock log's run-time structures for a while
log.lock.lock();
// Extend log in case of having a big transaction waiting before starting compaction.
_maybe_extend_log();
IIUC _maybe_extent_log() doesn't access log_is_compacting flag in any way. I can see waiting on log_forbidden_to_expand but not on log_is_compacting. So how this rearrangement would cause any infinite loop?
By setting the flag a bit earlier we just indicate to others that compaction is running (or will happen after maybe_extend_log). So they don't need to run it at that moment. Suggested reordering just extends that gap when other compactions are forbidden.
|
This pull request can no longer be automatically merged: a rebase is needed and changes have to be manually resolved |
pereman2
left a comment
There was a problem hiding this comment.
ooops I left some comments behind from the last time I checked. My bad.
There was a problem hiding this comment.
I prefer unlocking on return so we don't have to add a flag to maybe_extend_log. Extending the log will block if log_forbidden_to_expand is true which would always be the case after a successful atomic_exchange.
pereman2
left a comment
There was a problem hiding this comment.
ooops I left some comments behind from the last time I checked. My bad.
pereman2
left a comment
There was a problem hiding this comment.
ooops I left some comments behind from the last time I checked. My bad.
|
jenkins test make check |
1 similar comment
|
jenkins test make check |
There was a problem hiding this comment.
We tend to name such functions bound_encode through the Ceph code base. And its implementation actually attempts to follow the one of encode method.
See bluestore_blob_t::bound_encode as a sample.
Suggest to follow the same approach.
There was a problem hiding this comment.
Sorry, perhaps I haven't shared my point clear enough. Apart from renaming I'd prefer to see the implementation of this method via denc methods to match encode/decode rather than using questionable sizeof(var) constructs.
There was a problem hiding this comment.
Honestly I don't understand the above point. Personally I'd prefer setting log_is_compacting prior to log.lock acquisition and maybe_extent_log() call too.
@pereman2 - could you please elaborate?
Signed-off-by: Pere Diaz Bou <[email protected]>
There was a problem hiding this comment.
Sorry, perhaps I haven't shared my point clear enough. Apart from renaming I'd prefer to see the implementation of this method via denc methods to match encode/decode rather than using questionable sizeof(var) constructs.
With these changes, every call to log compaction will try to expand its runway in case of insufficient log space. async compaction will ignore the `log_forbidden_to_expand` atomic since we know it should't be harmful. In any other case, expansion of log will wait until compaction is completed. in order to ensure op_file_update_inc fits on disk we increase the size of logs as previously used in _maybe_extend_log. This means we too bring back _maybe_extend_log with a different usage. _maybe_extend_log increases the size of the log if the runway is less than the min runway and if the current transaction is too big to fit. Fixes: https://tracker.ceph.com/issues/58759 Signed-off-by: Pere Diaz Bou <[email protected]>
This fixes failures found in test_concurrent_dir_link_and_compact_log_56210 where the underlying machinery would attempt to write into a too-small ondisk segment. We just backport the entire patch from `main`. Upstream-ref: ceph/ceph@9396138 References: https://github.com/ceph/ceph/blob/main/src/test/objectstore/test_bluefs.cc#L1359 References: ceph/ceph#50216 References: https://tracker.ceph.com/issues/58759
This fixes failures found in test_concurrent_dir_link_and_compact_log_56210 where the underlying machinery would attempt to write into a too-small ondisk segment. We just backport the entire patch from `main`. Upstream-ref: ceph/ceph@9396138 References: https://github.com/ceph/ceph/blob/main/src/test/objectstore/test_bluefs.cc#L1359 References: ceph/ceph#50216 References: https://tracker.ceph.com/issues/58759
This fixes failures found in test_concurrent_dir_link_and_compact_log_56210 where the underlying machinery would attempt to write into a too-small ondisk segment. We just backport the entire patch from `main`. Upstream-ref: ceph/ceph@9396138 References: https://github.com/ceph/ceph/blob/main/src/test/objectstore/test_bluefs.cc#L1359 References: ceph/ceph#50216 References: https://tracker.ceph.com/issues/58759
This fixes failures found in test_concurrent_dir_link_and_compact_log_56210 where the underlying machinery would attempt to write into a too-small ondisk segment. We just backport the entire patch from `main`. Upstream-ref: ceph/ceph@9396138 References: https://github.com/ceph/ceph/blob/main/src/test/objectstore/test_bluefs.cc#L1359 References: ceph/ceph#50216 References: https://tracker.ceph.com/issues/58759
This fixes failures found in test_concurrent_dir_link_and_compact_log_56210 where the underlying machinery would attempt to write into a too-small ondisk segment. We just backport the entire patch from `main`. Upstream-ref: ceph/ceph@9396138 References: https://github.com/ceph/ceph/blob/main/src/test/objectstore/test_bluefs.cc#L1359 References: ceph/ceph#50216 References: https://tracker.ceph.com/issues/58759
This fixes failures found in test_concurrent_dir_link_and_compact_log_56210 where the underlying machinery would attempt to write into a too-small ondisk segment. We just backport the entire patch from `main`. Upstream-ref: ceph/ceph@9396138 References: https://github.com/ceph/ceph/blob/main/src/test/objectstore/test_bluefs.cc#L1359 References: ceph/ceph#50216 References: https://tracker.ceph.com/issues/58759
This fixes failures found in test_concurrent_dir_link_and_compact_log_56210 where the underlying machinery would attempt to write into a too-small ondisk segment. We just backport the entire patch from `main`. Upstream-ref: ceph/ceph@9396138 References: https://github.com/ceph/ceph/blob/main/src/test/objectstore/test_bluefs.cc#L1359 References: ceph/ceph#50216 References: https://tracker.ceph.com/issues/58759
fixed upstream Upstream-ref: ceph/ceph#50216
fixed upstream Upstream-ref: ceph/ceph#50216
fixed upstream Upstream-ref: ceph/ceph#50216
With these changes, every call to log compaction will try to expand its runway in case of insufficient log space. async compaction will ignore the
log_forbidden_to_expandatomic since we know it should't be harmful. In any other case, expansion of log will wait until compaction is completed.Fixes: https://tracker.ceph.com/issues/58759
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. "pacific"), please refer to Submitting Patches to Ceph - Backports for the proper workflow.
Checklist
Show available Jenkins commands
jenkins retest this pleasejenkins test classic perfjenkins test crimson perfjenkins test signedjenkins test make checkjenkins test make check arm64jenkins test submodulesjenkins test dashboardjenkins test dashboard cephadmjenkins test apijenkins test docsjenkins render docsjenkins test ceph-volume alljenkins test ceph-volume toxjenkins test windows