return 0;
}
-bool Objecter::is_pg_changed(vector<int>& o, vector<int>& n, bool any_change)
-{
- if (o.empty() && n.empty())
+bool Objecter::is_pg_changed(
+ int oldprimary,
+ vector<int>& oldacting,
+ int newprimary,
+ vector<int>& newacting,
+ bool any_change)
+{
+ if (oldacting.empty() && newacting.empty())
return false; // both still empty
- if (o.empty() ^ n.empty())
+ if (oldacting.empty() ^ newacting.empty())
return true; // was empty, now not, or vice versa
- if (o[0] != n[0])
+ if (oldprimary != newprimary)
return true; // primary changed
- if (any_change && o != n)
+ if (any_change && oldacting != newacting)
return true;
return false; // same primary (tho replicas may have changed)
}
need_resend = true;
}
- if (op->pgid != pgid || is_pg_changed(op->acting, acting, op->used_replica)) {
+ if (op->pgid != pgid ||
+ is_pg_changed(
+ op->primary, op->acting, primary, acting, op->used_replica)) {
op->pgid = pgid;
op->acting = acting;
+ op->primary = primary;
ldout(cct, 10) << "recalc_op_target tid " << op->tid
<< " pgid " << pgid << " acting " << acting << dendl;
}
osdmap->pg_to_acting_osds(pgid, &acting, &primary);
- if (pgid != linger_op->pgid || is_pg_changed(linger_op->acting, acting, true)) {
+ if (pgid != linger_op->pgid ||
+ is_pg_changed(
+ linger_op->primary, linger_op->acting, primary, acting, true)) {
linger_op->pgid = pgid;
linger_op->acting = acting;
+ linger_op->primary = primary;
ldout(cct, 10) << "recalc_linger_op_target tid " << linger_op->linger_id
<< " pgid " << pgid << " acting " << acting << dendl;
pg_t pgid; ///< last pg we mapped to
vector<int> acting; ///< acting for last pg we mapped to
+ int primary; ///< primary for last pg we mapped to
bool used_replica;
ConnectionRef con; // for rx buffer only
session(NULL), session_item(this), incarnation(0),
base_oid(o), base_oloc(ol),
precalc_pgid(false),
+ primary(-1),
used_replica(false), con(NULL),
snapid(CEPH_NOSNAP),
outbl(NULL),
pg_t pgid;
vector<int> acting;
+ int primary;
snapid_t snap;
SnapContext snapc;
tid_t register_tid;
epoch_t map_dne_bound;
- LingerOp() : linger_id(0), snap(CEPH_NOSNAP), flags(0),
+ LingerOp() : linger_id(0), primary(-1),
+ snap(CEPH_NOSNAP), flags(0),
poutbl(NULL), pobjver(NULL),
registered(false),
on_reg_ack(NULL), on_reg_commit(NULL),
void send_op(Op *op);
void cancel_linger_op(Op *op);
void finish_op(Op *op);
- bool is_pg_changed(vector<int>& a, vector<int>& b, bool any_change=false);
+ bool is_pg_changed(
+ int oldprimary,
+ vector<int>& oldacting,
+ int newprimary,
+ vector<int>& newacting,
+ bool any_change=false);
enum recalc_op_target_result {
RECALC_OP_TARGET_NO_ACTION = 0,
RECALC_OP_TARGET_NEED_RESEND,