if (!op.temp_added.empty()) {
add_temp_objs(op.temp_added);
}
- if (op.t.empty()) {
+ if (op.backfill) {
for (set<hobject_t, hobject_t::BitwiseComparator>::iterator i = op.temp_removed.begin();
i != op.temp_removed.end();
++i) {
op.updated_hit_set_history,
op.trim_to,
op.roll_forward_to,
- !(op.t.empty()),
+ !op.backfill,
localt);
ReplicatedPG *_rPG = dynamic_cast<ReplicatedPG *>(get_parent());
op->log_entries,
op->updated_hit_set_history,
op->temp_added,
- op->temp_cleared);
+ op->temp_cleared,
+ !should_send);
if (*i == get_parent()->whoami_shard()) {
handle_sub_write(
get_parent()->whoami_shard(),
void ECSubWrite::encode(bufferlist &bl) const
{
- ENCODE_START(3, 1, bl);
+ ENCODE_START(4, 1, bl);
::encode(from, bl);
::encode(tid, bl);
::encode(reqid, bl);
::encode(temp_removed, bl);
::encode(updated_hit_set_history, bl);
::encode(roll_forward_to, bl);
+ ::encode(backfill, bl);
ENCODE_FINISH(bl);
}
void ECSubWrite::decode(bufferlist::iterator &bl)
{
- DECODE_START(3, bl);
+ DECODE_START(4, bl);
::decode(from, bl);
::decode(tid, bl);
::decode(reqid, bl);
} else {
roll_forward_to = trim_to;
}
+ if (struct_v >= 4) {
+ ::decode(backfill, bl);
+ } else {
+ // The old protocol used an empty transaction to indicate backfill
+ backfill = t.empty();
+ }
DECODE_FINISH(bl);
}
<< ", roll_forward_to=" << rhs.roll_forward_to;
if (rhs.updated_hit_set_history)
lhs << ", has_updated_hit_set_history";
+ if (rhs.backfill)
+ lhs << ", backfill";
return lhs << ")";
}
f->dump_stream("roll_forward_to") << roll_forward_to;
f->dump_bool("has_updated_hit_set_history",
static_cast<bool>(updated_hit_set_history));
+ f->dump_bool("backfill", backfill);
}
void ECSubWrite::generate_test_instances(list<ECSubWrite*> &o)
set<hobject_t, hobject_t::BitwiseComparator> temp_added;
set<hobject_t, hobject_t::BitwiseComparator> temp_removed;
boost::optional<pg_hit_set_history_t> updated_hit_set_history;
+ bool backfill = false;
ECSubWrite() : tid(0) {}
ECSubWrite(
pg_shard_t from,
vector<pg_log_entry_t> log_entries,
boost::optional<pg_hit_set_history_t> updated_hit_set_history,
const set<hobject_t, hobject_t::BitwiseComparator> &temp_added,
- const set<hobject_t, hobject_t::BitwiseComparator> &temp_removed)
+ const set<hobject_t, hobject_t::BitwiseComparator> &temp_removed,
+ bool backfill)
: from(from), tid(tid), reqid(reqid),
soid(soid), stats(stats), t(t),
at_version(at_version),
log_entries(log_entries),
temp_added(temp_added),
temp_removed(temp_removed),
- updated_hit_set_history(updated_hit_set_history) {}
+ updated_hit_set_history(updated_hit_set_history),
+ backfill(backfill)
+ {}
void claim(ECSubWrite &other) {
from = other.from;
tid = other.tid;
temp_added.swap(other.temp_added);
temp_removed.swap(other.temp_removed);
updated_hit_set_history = other.updated_hit_set_history;
+ backfill = other.backfill;
}
void encode(bufferlist &bl) const;
void decode(bufferlist::iterator &bl);
}
}
-void PG::add_log_entry(const pg_log_entry_t& e)
+void PG::add_log_entry(const pg_log_entry_t& e, bool applied)
{
// raise last_complete only if we were previously up to date
if (info.last_complete == info.last_update)
info.last_user_version = e.user_version;
// log mutation
- pg_log.add(e);
+ pg_log.add(e, applied);
dout(10) << "add_log_entry " << e << dendl;
}
return at_version;
}
- void add_log_entry(const pg_log_entry_t& e);
+ void add_log_entry(const pg_log_entry_t& e, bool applied);
void append_log(
const vector<pg_log_entry_t>& logv,
eversion_t trim_to,
}
// actors
- void add(const pg_log_entry_t& e) {
+ void add(const pg_log_entry_t& e, bool applied = true) {
+ if (!applied) {
+ assert(get_can_rollback_to() == head);
+ }
+
// add to log
log.push_back(e);
extra_caller_ops.insert(make_pair(j->first, &(log.back())));
}
}
+
+ if (!applied) {
+ skip_can_rollback_to_to_head();
+ }
}
void trim(