virtual replay_ret replay(
delta_handler_t &&delta_handler) = 0;
+ virtual seastar::future<> finish_commit(
+ transaction_type_t type) = 0;
+
virtual ~Journal() {}
virtual journal_type_t get_type() = 0;
bl.length());
return device_write_bl(CBJOURNAL_START_ADDRESS, bl);
}
+seastar::future<> CircularBoundedJournal::finish_commit(transaction_type_t type) {
+ if (is_trim_transaction(type)) {
+ return update_journal_tail(
+ trimmer.get_dirty_tail(),
+ trimmer.get_alloc_tail());
+ }
+ return seastar::now();
+}
+
}
return get_total_size() - get_used_size();
}
- write_ertr::future<> update_journal_tail(
+ seastar::future<> update_journal_tail(
journal_seq_t dirty,
journal_seq_t alloc) {
header.dirty_tail = dirty;
header.alloc_tail = alloc;
- return write_header();
+ return write_header(
+ ).handle_error(
+ crimson::ct_error::assert_all{
+ "encountered invalid error in update_journal_tail"
+ });
}
journal_seq_t get_dirty_tail() const {
return header.dirty_tail;
rbm_abs_addr get_journal_end() const {
return get_start_addr() + header.size + get_block_size(); // journal size + header length
}
-
+ seastar::future<> finish_commit(transaction_type_t type) final;
private:
cbj_header_t header;
JournalTrimmer &trimmer;
journal_type_t get_type() final {
return journal_type_t::SEGMENT_JOURNAL;
}
+ seastar::future<> finish_commit(transaction_type_t type) {
+ return seastar::now();
+ }
private:
submit_record_ret do_submit_record(
type < transaction_type_t::MAX);
}
+constexpr bool is_trim_transaction(transaction_type_t type) {
+ return (type == transaction_type_t::CLEANER_TRIM_DIRTY ||
+ type == transaction_type_t::CLEANER_TRIM_ALLOC);
+}
+
struct record_size_t {
extent_len_t plain_mdlength = 0; // mdlength without the record header
extent_len_t dlength = 0;
journal->get_trimmer().update_journal_tails(
cache->get_oldest_dirty_from().value_or(start_seq),
cache->get_oldest_backref_dirty_from().value_or(start_seq));
- return tref.get_handle().complete();
+ return journal->finish_commit(tref.get_src()
+ ).then([&tref] {
+ return tref.get_handle().complete();
+ });
}).handle_error(
submit_transaction_iertr::pass_further{},
crimson::ct_error::all_same_way([](auto e) {
cbj->update_journal_tail(
seq,
seq
- ).unsafe_get0();
+ ).get0();
}
void set_written_to(journal_seq_t seq) {
cbj->set_written_to(seq);