Tightens logic around reporting of when multiple set OIs are called in a single transaction. Also tidies up interfaces for log_stats function and makes log messages more consistent.
Intentionally left unsigned to flag up in GitHub actions if it ends up in main.
Jon
if (!get_parent()->pgb_is_primary())
{
get_parent()->update_stats(op.stats);
- get_parent()->log_stats(op.soid, op.stats.stats.sum, false, op.t);
+ get_parent()->log_stats(op.soid, op.stats.stats.sum, op.t, false);
}
ObjectStore::Transaction localt;
if (!op.temp_added.empty()) {
get_parent()->log_stats(op.hoid,
op.delta_stats,
- true,
- trans[get_parent()->whoami_shard().shard]);
+ trans[get_parent()->whoami_shard().shard],
+ true);
dout(20) << __func__ << ": written: " << written << ", op: " << op << dendl;
const object_stat_sum_t &delta_stats) = 0;
virtual void log_stats(hobject_t soid,
- object_stat_sum_t stats,
- bool delta,
- ObjectStore::Transaction& t) = 0;
+ const object_stat_sum_t& stats,
+ ObjectStore::Transaction& t,
+ bool is_delta) = 0;
// new batch
virtual bool is_missing_object(const hobject_t& oid) const = 0;
const hobject_t &soid,
const object_stat_sum_t &delta_stats) = 0;
virtual void log_stats(hobject_t soid,
- object_stat_sum_t stats,
- bool delta,
- ObjectStore::Transaction& t) = 0;
+ const object_stat_sum_t& stats,
+ ObjectStore::Transaction& t,
+ bool is_delta) = 0;
/**
* Called when a read from a std::set of replicas/primary fails
}
void PrimaryLogPG::log_stats(hobject_t soid,
- object_stat_sum_t stats,
- bool delta,
- ObjectStore::Transaction& t)
+ const object_stat_sum_t& stats,
+ ObjectStore::Transaction& t,
+ bool is_delta)
{
Formatter *f = Formatter::create("json");
std::string operation = "updated to ";
- if (delta)
+ if (is_delta)
{
operation = "delta applied ";
}
f->flush(*_dout);
*_dout << dendl;
- int set_oi_count = 0;
+ std::map<hobject_t, int> soid_oi_set_count_map;
ObjectStore::Transaction::iterator i = t.begin();
case ObjectStore::Transaction::OP_SETATTR:
{
- set_oi_count++;
-
string name = i.decode_string();
if (name == OI_ATTR)
{
oi.dump(f);
f->close_section();
- dout(20) << __func__ << ", soid: " << soid << "."
+ dout(20) << __func__ << ", soid: " << soid
<< " setattr - OI set to ";
f->flush(*_dout);
- *_dout << "bl: " << bl << dendl;
+ *_dout << dendl;
+
+ soid_oi_set_count_map[soid]++;
}
}
break;
<< ". setattrs - OI set to ";
f->flush(*_dout);
*_dout << "bl: " << bl << dendl;
+
+ soid_oi_set_count_map[soid]++;
}
}
}
}
}
- if (set_oi_count > 1)
+ for (const auto&[soid, oi_set_count] : soid_oi_set_count_map)
{
- f->open_object_section("t");
- t.dump(f);
- f->close_section();
- dout(10) << __func__ << ", soid: " << soid
- << ". WARNING: oi set multiple ("
- << set_oi_count << ") times in transaction ";
- f->flush(*_dout);
- *_dout << dendl;
+ if (oi_set_count > 1)
+ {
+ f->open_object_section("t");
+ t.dump(f);
+ f->close_section();
+ dout(10) << __func__ << ", soid: " << soid
+ << ". INFO: oi set multiple ("
+ << oi_set_count << ") times in transaction ";
+ f->flush(*_dout);
+ *_dout << dendl;
+ }
}
}
const hobject_t &soid,
const object_stat_sum_t &delta_stats) override;
void log_stats(hobject_t soid,
- object_stat_sum_t stats,
- bool delta,
- ObjectStore::Transaction& t) override;
+ const object_stat_sum_t& stats,
+ ObjectStore::Transaction& t,
+ bool is_delta) override;
bool primary_error(const hobject_t& soid, eversion_t v);