return p->raw_hash_to_pg(p->hash_key(key, ns));
}
-int Objecter::calc_target(op_target_t *t, bool any_change)
+int Objecter::calc_target(op_target_t *t, epoch_t *last_force_resend, bool any_change)
{
bool is_read = t->flags & CEPH_OSD_FLAG_READ;
bool is_write = t->flags & CEPH_OSD_FLAG_WRITE;
const pg_pool_t *pi = osdmap->get_pg_pool(t->base_oloc.pool);
bool force_resend = false;
bool need_check_tiering = false;
+
if (pi && osdmap->get_epoch() == pi->last_force_op_resend) {
- force_resend = true;
+ if (last_force_resend && *last_force_resend < pi->last_force_op_resend) {
+ *last_force_resend = pi->last_force_op_resend;
+ force_resend = true;
+ } else if (last_force_resend == 0)
+ force_resend = true;
}
+
if (t->target_oid.name.empty() || force_resend) {
t->target_oid = t->base_oid;
need_check_tiering = true;
int Objecter::recalc_op_target(Op *op)
{
- int r = calc_target(&op->target);
+ int r = calc_target(&op->target, &op->last_force_resend);
if (r == RECALC_OP_TARGET_NEED_RESEND) {
OSDSession *s = NULL;
if (op->target.osd >= 0)
bool Objecter::recalc_linger_op_target(LingerOp *linger_op)
{
- int r = calc_target(&linger_op->target, true);
+ int r = calc_target(&linger_op->target, &linger_op->last_force_resend, true);
if (r == RECALC_OP_TARGET_NEED_RESEND) {
ldout(cct, 10) << "recalc_linger_op_target tid " << linger_op->linger_id
<< " pgid " << linger_op->target.pgid
/// true if we should resend this message on failure
bool should_resend;
+ epoch_t last_force_resend;
+
Op(const object_t& o, const object_locator_t& ol, vector<OSDOp>& op,
int f, Context *ac, Context *co, version_t *ov) :
session(NULL), session_item(this), incarnation(0),
objver(ov), reply_epoch(NULL),
map_dne_bound(0),
budgeted(false),
- should_resend(true) {
+ should_resend(true),
+ last_force_resend(0) {
ops.swap(op);
/* initialize out_* to match op vector */
ceph_tid_t register_tid;
epoch_t map_dne_bound;
+ epoch_t last_force_resend;
LingerOp() : linger_id(0),
target(object_t(), object_locator_t(), 0),
on_reg_ack(NULL), on_reg_commit(NULL),
session(NULL), session_item(this),
register_tid(0),
- map_dne_bound(0) {}
+ map_dne_bound(0),
+ last_force_resend(0) {}
// no copy!
const LingerOp &operator=(const LingerOp& r);
bool osdmap_full_flag() const;
bool target_should_be_paused(op_target_t *op);
- int calc_target(op_target_t *t, bool any_change=false);
+ int calc_target(op_target_t *t, epoch_t *last_force_resend=0, bool any_change=false);
int recalc_op_target(Op *op);
bool recalc_linger_op_target(LingerOp *op);