<< ", error=" << header.error
<< ", start_offset=" << header.start_offset
<< ", applied_to="<< header.applied_to
- << ", last_committed_record_base="<< header.last_committed_record_base
<< ", written_to=" << header.written_to
<< ", flsg=" << header.flag
<< ", csum_type=" << header.csum_type
"append_record: commit target {} used_size {} written length {}",
target, get_used_size(), length);
- set_last_committed_record_base(target);
set_used_size(get_used_size() + length);
paddr_t paddr = convert_abs_addr_to_paddr(
target + r_size.get_mdlength(),
r_header.committed_to,
(seastore_off_t)bl.length()
};
- set_last_committed_record_base(cursor_addr);
cursor_addr += bl.length();
set_written_to(cursor_addr);
last_seq = r_header.committed_to.segment_seq;
* in CBjournal to RBM---the tail (applied_to) is advanced (TODO).
*
* - Commit time
- * After submit_record is done, last_committed_record_base and written_to are
- * increased (these are in-memory values)---last_committed_record_base indicates
- * the last committed record and written_to represents where the new record
- * will be appended. Note that applied_to is not changed here.
+ * After submit_record is done, written_to is increased(this in-memory value)
+ * ---written_to represents where the new record will be appended. Note that
+ * applied_to is not changed here.
*
* - Replay time
* At replay time, CBJournal begins to replay records in CBjournal by reading
* records from applied_to. Then, CBJournal examines whether the records is valid
- * one by one, at which point last_committed_record_base and written_to are
- * recovered if the valid record is founded. Note that only applied_to is stored
+ * one by one, at which point written_to is recovered
+ * if the valid record is founded. Note that only applied_to is stored
* permanently when the apply work---applying the records in CBJournal to RBM---
* is done by CBJournal (TODO).
*
// start offset of CircularBoundedJournal in the device (start + header length)
rbm_abs_addr start_offset = 0;
- // start address where last committed record is written
- rbm_abs_addr last_committed_record_base = 0;
// start address where the newest record will be written
rbm_abs_addr written_to = 0;
// address to represent where last appllied record is written
denc(v.start_offset, p);
- denc(v.last_committed_record_base, p);
denc(v.written_to, p);
denc(v.applied_to, p);
* Write position for CircularBoundedJournal
*
* | written to rbm | written length to CircularBoundedJournal | new write |
- * ----------------->----------------------------------->------------>
- * ^ ^ ^
- * applied_to last_committed_record_base written_to
+ * ----------------->------------------------------------------------>
+ * ^ ^
+ * applied_to written_to
*
*/
void update_applied_to(rbm_abs_addr addr, uint32_t len) {
rbm_abs_addr new_applied_to = addr;
set_used_size(
- get_last_committed_record_base() >= new_applied_to ?
+ get_written_to() >= new_applied_to ?
get_written_to() - (new_applied_to + len) :
get_written_to() + get_total_size() - (new_applied_to + len));
set_applied_to(new_applied_to + len);
void set_written_to(rbm_abs_addr addr) {
header.written_to = addr;
}
- rbm_abs_addr get_last_committed_record_base() const {
- return header.last_committed_record_base;
- }
- void set_last_committed_record_base(rbm_abs_addr addr) {
- header.last_committed_record_base = addr;
- }
rbm_abs_addr get_applied_to() const {
return header.applied_to;
}
auto get_written_to() {
return cbj->get_written_to();
}
- auto get_last_committed_record_base() {
- return cbj->get_last_committed_record_base();
- }
auto get_applied_to() {
return cbj->get_applied_to();
}
void update_applied_to(rbm_abs_addr addr, uint32_t len) {
cbj->update_applied_to(addr, len);
}
- void set_last_committed_record_base(rbm_abs_addr addr) {
- cbj->set_last_committed_record_base(addr);
- }
void set_written_to(rbm_abs_addr addr) {
cbj->set_written_to(addr);
}
ASSERT_EQ(header.size, update_header.size);
ASSERT_EQ(header.used_size, update_header.used_size);
ASSERT_EQ(header.written_to + record_total_size, update_header.written_to);
- ASSERT_EQ(header.last_committed_record_base + block_size,
- update_header.last_committed_record_base);
});
}
});
}
auto old_written_to = get_written_to();
- auto old_last_committed_record_base = get_last_committed_record_base();
auto old_used_size = get_used_size();
set_written_to(4096);
- set_last_committed_record_base(4096);
set_used_size(0);
replay();
ASSERT_EQ(old_written_to, get_written_to());
- ASSERT_EQ(old_last_committed_record_base,
- get_last_committed_record_base());
ASSERT_EQ(old_used_size,
get_used_size());
});