Skip to content

crimson/osd/pg: only kick off snap trimming when PGs are clean - #56998

Merged
Matan-B merged 2 commits into
ceph:mainfrom
xxhdx1985126:wip-65568
Apr 30, 2024
Merged

Matan-B merged 2 commits into
ceph:mainfrom
xxhdx1985126:wip-65568

Conversation

@xxhdx1985126

@xxhdx1985126 xxhdx1985126 commented Apr 19, 2024 •

Copy link
Copy Markdown
Member

Fixes: https://tracker.ceph.com/issues/65568
Signed-off-by: Xuehan Xu [email protected]

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
  • jenkins retest this please
  • jenkins test classic perf
  • jenkins test crimson perf
  • jenkins test signed
  • jenkins test make check
  • jenkins test make check arm64
  • jenkins test submodules
  • jenkins test dashboard
  • jenkins test dashboard cephadm
  • jenkins test api
  • jenkins test docs
  • jenkins render docs
  • jenkins test ceph-volume all
  • jenkins test ceph-volume tox
  • jenkins test windows
  • jenkins test rook e2e

@xxhdx1985126

Copy link
Copy Markdown
Member Author

The following tests FAILED:
261 - unittest-seastore (Timeout)

@cyx1231st

cyx1231st commented Apr 19, 2024 •

Copy link
Copy Markdown
Member

261 - unittest-seastore (Timeout)

Stopped at

[ RUN      ] seastore_test/seastore_test_t.object_data_omap_remove/1
...
INFO  2024-04-19 04:33:12,382 [shard 0:main] seastore_tm - TransactionManager::close: completed
INFO  2024-04-19 04:33:12,528 [shard 0:main] seastore_cache - Cache::Cache: created, lru_size=67108864
INFO  2024-04-19 04:33:12,827 [shard 0:main] seastore_journal - RecordSubmitter:  io_depth_limit=5, batch_capacity=16, batch_flush_size=16777216, preferred_fullness=0.95
INFO  2024-04-19 04:33:12,827 [shard 0:main] seastore_tm - TransactionManager::mount: enter
INFO  2024-04-19 04:33:12,828 [shard 0:main] seastore_cache - Cache::init: init root -- CachedExtent(addr=0x61b000026180, type=ROOT, version=0, dirty_from_or_retired_at=JOURNAL_SEQ_NULL, modify_time=tp(NULL), paddr=paddr<Dev(ROOT),0>, prior_paddr=nullopt, length=0, state=CLEAN, last_committed_crc=0, refcount=1, user_hint=Hint(NULL), fully_loaded=1, rewrite_gen=GEN_NULL, root_block(lba_root_node=0, backref_root_node=0))
INFO  2024-04-19 04:33:12,830 [shard 0:main] seastore_journal - Journal::scan_valid_record_delta: starting at jseq(sseq(0), paddr<Dev(128),8192>) 
INFO  2024-04-19 04:33:12,835 [shard 0:main] seastore_journal - RecordScanner::scan_valid_records: complete at cursor(last_valid_header_found=1, seq=jseq(sseq(0), paddr<Dev(128),28672>), last_committed=jseq(sseq(0), paddr<Dev(128),24576>), pending_record_groups=0, num_consumed_records=5), invalid record group metadata
INFO  2024-04-19 04:33:12,838 [shard 0:main] seastore_journal - RecordScanner::scan_valid_records: complete at cursor(last_valid_header_found=1, seq=jseq(sseq(1), paddr<Dev(128),8192>), last_committed=jseq(sseq(0), paddr<Dev(128),24576>), pending_record_groups=0, num_consumed_records=5), invalid record group metadata
INFO  2024-04-19 04:33:12,839 [shard 0:main] seastore_journal - Journal::scan_valid_record_delta: starting at jseq(sseq(0), paddr<Dev(128),8192>) 
INFO  2024-04-19 04:33:12,845 [shard 0:main] seastore_journal - RecordScanner::scan_valid_records: complete at cursor(last_valid_header_found=1, seq=jseq(sseq(0), paddr<Dev(128),28672>), last_committed=jseq(sseq(0), paddr<Dev(128),24576>), pending_record_groups=0, num_consumed_records=5), invalid record group metadata
INFO  2024-04-19 04:33:12,845 [shard 0:main] seastore_journal - RecordScanner::scan_valid_records: complete at cursor(last_valid_header_found=1, seq=jseq(sseq(1), paddr<Dev(128),8192>), last_committed=jseq(sseq(0), paddr<Dev(128),24576>), pending_record_groups=0, num_consumed_records=5), invalid record group metadata
INFO  2024-04-19 04:33:12,845 [shard 0:main] seastore_cleaner - JournalTrimmerImpl::update_journal_tails: journal_dirty_tail JOURNAL_SEQ_NULL => jseq(sseq(0), paddr<Dev(128),8192>), JournalTrimmer(not-ready)
INFO  2024-04-19 04:33:12,845 [shard 0:main] seastore_cleaner - JournalTrimmerImpl::update_journal_tails: journal_alloc_tail JOURNAL_SEQ_NULL => jseq(sseq(0), paddr<Dev(128),8192>), JournalTrimmer(not-ready)
INFO  2024-04-19 04:33:12,847 [shard 0:main] seastore_cleaner - JournalTrimmerImpl::set_journal_head: journal_head JOURNAL_SEQ_NULL => jseq(sseq(0), paddr<Dev(128),28672>), JournalTrimmer(not-ready)
INFO  2024-04-19 04:33:12,849 [shard 0:main] seastore_cache - 0x6170000da200 trans.1 Cache::init_cached_extents: start with 2(4096B) extents, 2 dirty, dirty_from=jseq(sseq(0), paddr<Dev(128),12288>), alloc_from=jseq(sseq(0), paddr<Dev(128),8192>)
INFO  2024-04-19 04:33:12,851 [shard 0:main] seastore_cache - 0x6170000da200 trans.1 Cache::init_cached_extents: finish with 2(4096B) extents, 2 dirty, dirty_from=jseq(sseq(0), paddr<Dev(128),12288>), alloc_from=jseq(sseq(0), paddr<Dev(128),8192>)
INFO  2024-04-19 04:33:12,852 [shard 0:main] seastore_epm - ExtentPlacementManager::open_for_write: started with 1 devices
INFO  2024-04-19 04:33:12,852 [shard 0:main] seastore_epm - BackgroundProcess::start_background: JournalTrimmer(not-ready, journal_head=jseq(sseq(0), paddr<Dev(128),28672>), alloc_tail=jseq(sseq(0), paddr<Dev(128),8192>), dirty_tail=jseq(sseq(0), paddr<Dev(128),8192>)), 
INFO  2024-04-19 04:33:12,853 [shard 0:main] seastore_tm - TransactionManager::mount: completed
INFO  2024-04-19 04:33:12,853 [shard 0:main] test - EphemeralTestState::restart_fut: finish
INFO  2024-04-19 04:33:12,853 [shard 0:main] test - EphemeralTestState::tm_setup: finish

@xxhdx1985126

Copy link
Copy Markdown
Member Author

261 - unittest-seastore (Timeout)

Stopped at

[ RUN      ] seastore_test/seastore_test_t.object_data_omap_remove/1
...
INFO  2024-04-19 04:33:12,382 [shard 0:main] seastore_tm - TransactionManager::close: completed
INFO  2024-04-19 04:33:12,528 [shard 0:main] seastore_cache - Cache::Cache: created, lru_size=67108864
INFO  2024-04-19 04:33:12,827 [shard 0:main] seastore_journal - RecordSubmitter:  io_depth_limit=5, batch_capacity=16, batch_flush_size=16777216, preferred_fullness=0.95
INFO  2024-04-19 04:33:12,827 [shard 0:main] seastore_tm - TransactionManager::mount: enter
INFO  2024-04-19 04:33:12,828 [shard 0:main] seastore_cache - Cache::init: init root -- CachedExtent(addr=0x61b000026180, type=ROOT, version=0, dirty_from_or_retired_at=JOURNAL_SEQ_NULL, modify_time=tp(NULL), paddr=paddr<Dev(ROOT),0>, prior_paddr=nullopt, length=0, state=CLEAN, last_committed_crc=0, refcount=1, user_hint=Hint(NULL), fully_loaded=1, rewrite_gen=GEN_NULL, root_block(lba_root_node=0, backref_root_node=0))
INFO  2024-04-19 04:33:12,830 [shard 0:main] seastore_journal - Journal::scan_valid_record_delta: starting at jseq(sseq(0), paddr<Dev(128),8192>) 
INFO  2024-04-19 04:33:12,835 [shard 0:main] seastore_journal - RecordScanner::scan_valid_records: complete at cursor(last_valid_header_found=1, seq=jseq(sseq(0), paddr<Dev(128),28672>), last_committed=jseq(sseq(0), paddr<Dev(128),24576>), pending_record_groups=0, num_consumed_records=5), invalid record group metadata
INFO  2024-04-19 04:33:12,838 [shard 0:main] seastore_journal - RecordScanner::scan_valid_records: complete at cursor(last_valid_header_found=1, seq=jseq(sseq(1), paddr<Dev(128),8192>), last_committed=jseq(sseq(0), paddr<Dev(128),24576>), pending_record_groups=0, num_consumed_records=5), invalid record group metadata
INFO  2024-04-19 04:33:12,839 [shard 0:main] seastore_journal - Journal::scan_valid_record_delta: starting at jseq(sseq(0), paddr<Dev(128),8192>) 
INFO  2024-04-19 04:33:12,845 [shard 0:main] seastore_journal - RecordScanner::scan_valid_records: complete at cursor(last_valid_header_found=1, seq=jseq(sseq(0), paddr<Dev(128),28672>), last_committed=jseq(sseq(0), paddr<Dev(128),24576>), pending_record_groups=0, num_consumed_records=5), invalid record group metadata
INFO  2024-04-19 04:33:12,845 [shard 0:main] seastore_journal - RecordScanner::scan_valid_records: complete at cursor(last_valid_header_found=1, seq=jseq(sseq(1), paddr<Dev(128),8192>), last_committed=jseq(sseq(0), paddr<Dev(128),24576>), pending_record_groups=0, num_consumed_records=5), invalid record group metadata
INFO  2024-04-19 04:33:12,845 [shard 0:main] seastore_cleaner - JournalTrimmerImpl::update_journal_tails: journal_dirty_tail JOURNAL_SEQ_NULL => jseq(sseq(0), paddr<Dev(128),8192>), JournalTrimmer(not-ready)
INFO  2024-04-19 04:33:12,845 [shard 0:main] seastore_cleaner - JournalTrimmerImpl::update_journal_tails: journal_alloc_tail JOURNAL_SEQ_NULL => jseq(sseq(0), paddr<Dev(128),8192>), JournalTrimmer(not-ready)
INFO  2024-04-19 04:33:12,847 [shard 0:main] seastore_cleaner - JournalTrimmerImpl::set_journal_head: journal_head JOURNAL_SEQ_NULL => jseq(sseq(0), paddr<Dev(128),28672>), JournalTrimmer(not-ready)
INFO  2024-04-19 04:33:12,849 [shard 0:main] seastore_cache - 0x6170000da200 trans.1 Cache::init_cached_extents: start with 2(4096B) extents, 2 dirty, dirty_from=jseq(sseq(0), paddr<Dev(128),12288>), alloc_from=jseq(sseq(0), paddr<Dev(128),8192>)
INFO  2024-04-19 04:33:12,851 [shard 0:main] seastore_cache - 0x6170000da200 trans.1 Cache::init_cached_extents: finish with 2(4096B) extents, 2 dirty, dirty_from=jseq(sseq(0), paddr<Dev(128),12288>), alloc_from=jseq(sseq(0), paddr<Dev(128),8192>)
INFO  2024-04-19 04:33:12,852 [shard 0:main] seastore_epm - ExtentPlacementManager::open_for_write: started with 1 devices
INFO  2024-04-19 04:33:12,852 [shard 0:main] seastore_epm - BackgroundProcess::start_background: JournalTrimmer(not-ready, journal_head=jseq(sseq(0), paddr<Dev(128),28672>), alloc_tail=jseq(sseq(0), paddr<Dev(128),8192>), dirty_tail=jseq(sseq(0), paddr<Dev(128),8192>)), 
INFO  2024-04-19 04:33:12,853 [shard 0:main] seastore_tm - TransactionManager::mount: completed
INFO  2024-04-19 04:33:12,853 [shard 0:main] test - EphemeralTestState::restart_fut: finish
INFO  2024-04-19 04:33:12,853 [shard 0:main] test - EphemeralTestState::tm_setup: finish

Yeah, not sure why it didn't continue...

@xxhdx1985126

Copy link
Copy Markdown
Member Author

jenkins test make check

@cyx1231st

Copy link
Copy Markdown
Member

https://tracker.ceph.com/issues/65585

@xxhdx1985126 Let's track there to see how frequent it is, and whether it is RBM specific.

@Matan-B Matan-B 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.

lgtm, one nit.

SnapTrimEvent::start() also skips the do_recover_missing stage. However, it should be expected there as we are not yet aware of any objects that should be trimmed.
Can you please add that as a comment?
Alternatively, we can also cleanup the recover_missing stage from SnapTrimEvent::start() to avoid future confusion. What do you think?

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.

return recover_missings(pg, coid, {coid.snap});

@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

@xxhdx1985126

Copy link
Copy Markdown
Member Author

This PR can't handle the following case:

  1. OSD A is down and PG P is undersized + degraded;
  2. Clone C in P is removed;
  3. A comes up and can't find the clone C in the head's snapset.

For this reason, I think we'd better model the classic OSD to only kick off snap trimmings when PGs are clean.

@Matan-B

Matan-B commented Apr 22, 2024

Copy link
Copy Markdown
Contributor

For this reason, I think we'd better model the classic OSD to only kick off snap trimmings when PGs are clean.

Sounds right

@xxhdx1985126 xxhdx1985126 changed the title crimson/osd/osd_operations/snaptim_event: recover related clone/head objects before trimming snaps crimson/osd/pg: only kick off snap trimming when PGs are clean Apr 23, 2024
@xxhdx1985126

Copy link
Copy Markdown
Member Author

@athanatos @Matan-B I've modified the code, please take a look again, thanks:-)

@xxhdx1985126 xxhdx1985126 removed the DNM label Apr 23, 2024
@xxhdx1985126
xxhdx1985126 marked this pull request as draft April 24, 2024 03:13
@xxhdx1985126
xxhdx1985126 marked this pull request as ready for review April 24, 2024 03:13
Comment thread src/crimson/osd/pg.cc Outdated
Comment on lines 518 to 521

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.

Is this bit still relevant? the only eagain return case was removed.

Comment thread src/crimson/osd/pg.cc Resolved
Comment thread src/crimson/osd/pg.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.

The commit message doesn't explain the actual code change.

crimson/osd/pg: SnapTrimEvent to support interrupts

SnapTrimEvent operations are scheduled from `PG::on_active_actmap()` using a `seastar::do_until` loop.
This commit replaces the loop type into an `interruptor::repeat` and SnapTrimEvent are now scheduled by `start_operation_may_interrupt`.

Previously, `SnapTrimEvent::start` handled interruptions by returning a `crimson::ct_error::eagain::make();`.
Now, the errorator is directly returned via the `snap_trim_event_ret_t` and interrupts the loop described above.

As a result, interruptions originated by interval changes are now supported by SnapTrimEvent.

Comment thread src/crimson/osd/pg.cc Outdated
Comment on lines +493 to +528
[this] {
peering_state.state_set(PG_STATE_SNAPTRIM);
publish_stats_to_osd();
const auto to_trim = snap_trimq.range_start();
snap_trimq.erase(to_trim);
const auto needs_pause = !snap_trimq.empty();
return seastar::repeat([to_trim, needs_pause, this] {
logger().debug("{}: going to start SnapTrimEvent, to_trim={}",
*this, to_trim);
return shard_services.start_operation<SnapTrimEvent>(
this,
snap_mapper,
to_trim,
needs_pause
).second.handle_error(
crimson::ct_error::enoent::handle([this] {
logger().error("{}: ENOENT saw, trimming stopped", *this);
peering_state.state_set(PG_STATE_SNAPTRIM_ERROR);
publish_stats_to_osd();
return seastar::make_ready_future<seastar::stop_iteration>(
seastar::stop_iteration::yes);
}), crimson::ct_error::eagain::handle([this] {
logger().info("{}: EAGAIN saw, trimming restarted", *this);
return seastar::make_ready_future<seastar::stop_iteration>(
seastar::stop_iteration::no);
})
);
}).then([this, trimmed=to_trim] {
logger().debug("{}: trimmed snap={}", *this, trimmed);
});
}
).finally([this, pg_ref=std::move(pg_ref)] {
logger().debug("{}: PG::on_active_actmap() finished trimming",
*this);
peering_state.state_clear(PG_STATE_SNAPTRIM);
peering_state.state_clear(PG_STATE_SNAPTRIM_ERROR);

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.

nit: This may be a good opportunity to separate the snap trim scheduling logic into a new method (out of PG::on_active_actmap()), or at least some of it.

@Matan-B
Matan-B requested a review from athanatos April 25, 2024 11:09
Comment thread src/crimson/osd/pg.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.

Previously, on interruptions - we would keep trying again (eagain) until success. This would ensure that an erased to_trim is actually trimmed. It seems that by removing the eagain case we may erase from snap_trimq without completing the trimming (on interruptions).
We should probably either erase only on success or re-adding the uncompleted to_trim on interruption.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Yeah, will change it.

@xxhdx1985126

Copy link
Copy Markdown
Member Author

@Matan-B All done, please take a look again, thanks:-)

@Matan-B Matan-B 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.

lgtm, few comments

Comment thread src/crimson/osd/pg.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.

👍

Comment thread src/crimson/osd/pg.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.

Why not re-use PG_STATE_SNAPTRIM? e.g peering_state.state_test(PG_STATE_SNAPTRIM)

@xxhdx1985126 xxhdx1985126 Apr 28, 2024 •

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Um, it seems that we need to prevent PG from creating extra SnapTrimEvents when there's already one; on the other hand, PG_STATE_SNAPTRIM is set after reservations are done, which means there's a time interval between the creation of SnapTrimEvent and the set of PG_STATE_SNAPTRIM. Nay, I didn't see that PG_STATE_SNAPTRIM is set in PG::on_active_actmap(). Will reuse it.

Comment thread src/crimson/osd/pg.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.

See previous comment

Comment thread src/crimson/osd/pg.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.

ack

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.

Is snap_trim_ertr needed? It seems like the last user is removed, if so we can cleanup.

Comment thread src/crimson/osd/pg.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.

nit: "pg is not clean, skipping snap trim"

SnapTrimEvent operations are scheduled from `PG::on_active_actmap()`
using a `seastar::do_until` loop. This commit replaces the loop type
into an `interruptor::repeat` and SnapTrimEvent are now scheduled by
`start_operation_may_interrupt`.

Previously, `SnapTrimEvent::start` handled interruptions by returning
a `crimson::ct_error::eagain::make();`. Now, the errorator is directly
returned via the `snap_trim_event_ret_t` and interrupts the loop
described above.

As a result, interruptions originated by interval changes are now
supported by SnapTrimEvent.

Signed-off-by: Xuehan Xu <[email protected]>
@xxhdx1985126

Copy link
Copy Markdown
Member Author

jenkins test make check

@xxhdx1985126

Copy link
Copy Markdown
Member Author

jenkins test windows

@Matan-B

Matan-B commented Apr 30, 2024

Copy link
Copy Markdown
Contributor

jenkins test windows

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.

4 participants