#include <string>
#include <string_view>
#include <tuple>
+#include <optional>
#include <boost/container/small_vector.hpp>
#include <boost/optional/optional_io.hpp>
#include <boost/tuple/tuple.hpp>
inline void encode(const boost::optional<T> &p, bufferlist &bl);
template<typename T>
inline void decode(boost::optional<T> &p, bufferlist::const_iterator &bp);
+template<typename T>
+inline void encode(const std::optional<T> &p, bufferlist &bl);
+template<typename T>
+inline void decode(std::optional<T> &p, bufferlist::const_iterator &bp);
template<class A, class B, class C>
inline void encode(const boost::tuple<A, B, C> &t, bufferlist& bl);
template<class A, class B, class C>
#pragma GCC diagnostic pop
#pragma GCC diagnostic warning "-Wpragmas"
+// std optional
+template<typename T>
+inline void encode(const std::optional<T> &p, bufferlist &bl)
+{
+ __u8 present = static_cast<bool>(p);
+ encode(present, bl);
+ if (p)
+ encode(*p, bl);
+}
+
+#pragma GCC diagnostic ignored "-Wpragmas"
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wuninitialized"
+template<typename T>
+inline void decode(std::optional<T> &p, bufferlist::const_iterator &bp)
+{
+ __u8 present;
+ decode(present, bp);
+ if (present) {
+ p = T{};
+ decode(*p, bp);
+ } else {
+ p = std::nullopt;
+ }
+}
+
// std::tuple
template<typename... Ts>
inline void encode(const std::tuple<Ts...> &t, bufferlist& bl)
#include <boost/container/flat_map.hpp>
#include <map>
#include <vector>
+#include <optional>
#include <iostream>
#include <iomanip>
inline std::ostream& operator<<(std::ostream& out, const std::deque<A,Alloc>& v);
template<typename... Ts>
inline std::ostream& operator<<(std::ostream& out, const std::tuple<Ts...> &t);
+template<typename T>
+inline std::ostream& operator<<(std::ostream& out, const std::optional<T> &t);
template<class A, class Alloc>
inline std::ostream& operator<<(std::ostream& out, const std::list<A,Alloc>& ilist);
template<class A, class Comp, class Alloc>
return out;
}
+// Mimics boost::optional
+template<typename T>
+inline std::ostream& operator<<(std::ostream& out, const std::optional<T> &t) {
+ if (!t)
+ out << "--" ;
+ else
+ out << ' ' << *t ;
+ return out;
+}
+
template<class A, class Alloc>
inline std::ostream& operator<<(std::ostream& out, const std::list<A,Alloc>& ilist) {
for (auto it = ilist.begin();
hobject_t discard_temp_oid; ///< previously used temp object that we can now stop tracking
/// non-empty if this transaction involves a hit_set history update
- boost::optional<pg_hit_set_history_t> updated_hit_set_history;
+ std::optional<pg_hit_set_history_t> updated_hit_set_history;
epoch_t get_map_epoch() const override {
return map_epoch;
lhs << "read_result_t(r=" << rhs.r
<< ", errors=" << rhs.errors;
if (rhs.attrs) {
- lhs << ", attrs=" << rhs.attrs.get();
+ lhs << ", attrs=" << *(rhs.attrs);
} else {
lhs << ", noattrs";
}
void ECBackend::handle_recovery_read_complete(
const hobject_t &hoid,
boost::tuple<uint64_t, uint64_t, map<pg_shard_t, bufferlist> > &to_read,
- boost::optional<map<string, bufferlist> > attrs,
+ std::optional<map<string, bufferlist> > attrs,
RecoveryMessages *m)
{
dout(10) << __func__ << ": returned " << hoid << " "
const eversion_t &trim_to,
const eversion_t &roll_forward_to,
const vector<pg_log_entry_t> &log_entries,
- boost::optional<pg_hit_set_history_t> &hset_history,
+ std::optional<pg_hit_set_history_t> &hset_history,
Context *on_all_commit,
ceph_tid_t tid,
osd_reqid_t reqid,
const eversion_t &trim_to,
const eversion_t &roll_forward_to,
const vector<pg_log_entry_t> &log_entries,
- boost::optional<pg_hit_set_history_t> &hset_history,
+ std::optional<pg_hit_set_history_t> &hset_history,
Context *on_all_commit,
ceph_tid_t tid,
osd_reqid_t reqid,
void handle_recovery_read_complete(
const hobject_t &hoid,
boost::tuple<uint64_t, uint64_t, map<pg_shard_t, bufferlist> > &to_read,
- boost::optional<map<string, bufferlist> > attrs,
+ std::optional<map<string, bufferlist> > attrs,
RecoveryMessages *m);
void handle_recovery_push(
const PushOp &op,
struct read_result_t {
int r;
map<pg_shard_t, int> errors;
- boost::optional<map<string, bufferlist> > attrs;
+ std::optional<map<string, bufferlist> > attrs;
list<
boost::tuple<
uint64_t, uint64_t, map<pg_shard_t, bufferlist> > > returned;
object_stat_sum_t delta_stats;
eversion_t version;
eversion_t trim_to;
- boost::optional<pg_hit_set_history_t> updated_hit_set_history;
+ std::optional<pg_hit_set_history_t> updated_hit_set_history;
vector<pg_log_entry_t> log_entries;
ceph_tid_t tid;
osd_reqid_t reqid;
vector<pg_log_entry_t> log_entries;
std::set<hobject_t> temp_added;
std::set<hobject_t> temp_removed;
- boost::optional<pg_hit_set_history_t> updated_hit_set_history;
+ std::optional<pg_hit_set_history_t> updated_hit_set_history;
bool backfill_or_async_recovery = false;
ECSubWrite() : tid(0) {}
ECSubWrite(
eversion_t trim_to,
eversion_t roll_forward_to,
vector<pg_log_entry_t> log_entries,
- boost::optional<pg_hit_set_history_t> updated_hit_set_history,
+ std::optional<pg_hit_set_history_t> updated_hit_set_history,
const std::set<hobject_t> &temp_added,
const std::set<hobject_t> &temp_removed,
bool backfill_or_async_recovery)
entry->mod_desc.update_snaps(op.updated_snaps->first);
}
- map<string, boost::optional<bufferlist> > xattr_rollback;
+ map<string, std::optional<bufferlist> > xattr_rollback;
ceph_assert(hinfo);
bufferlist old_hinfo;
encode(*hinfo, old_hinfo);
if (op.truncate->first != op.truncate->second) {
op.truncate->first = op.truncate->second;
} else {
- op.truncate = boost::none;
+ op.truncate = std::nullopt;
}
op.delete_first = true;
}
if (op.delete_first) {
- /* We also want to remove the boost::none entries since
+ /* We also want to remove the std::nullopt entries since
* the keys already won't exist */
for (auto j = op.attr_updates.begin();
j != op.attr_updates.end();
xattr_rollback.insert(
make_pair(
j.first,
- boost::optional<bufferlist>(citer->second)));
+ std::optional<bufferlist>(citer->second)));
} else {
// won't overwrite anything we put in earlier
xattr_rollback.insert(
make_pair(
j.first,
- boost::none));
+ std::nullopt));
}
}
if (j.second) {
#include <list>
#include <vector>
#include <utility>
-#include <boost/optional.hpp>
+#include <optional>
#include <boost/intrusive/set.hpp>
#include <boost/intrusive/list.hpp>
#include "include/interval_set.h"
uint64_t offset;
uint64_t length;
- boost::optional<bufferlist> bl;
+ std::optional<bufferlist> bl;
uint64_t get_length() const {
return length;
}
bool is_pending() const {
- return bl == boost::none;
+ return bl == std::nullopt;
}
bool pinned_by_write() const {
UPDATE_PIN
};
type action = NONE;
- boost::optional<bufferlist> bl;
+ std::optional<bufferlist> bl;
};
template <typename F>
void traverse_update(
const map<pg_shard_t, pg_missing_t> &pmissing,
const map<pg_shard_t, pg_info_t> &pinfo) {
recovered(hoid);
- boost::optional<pg_missing_item> item;
+ std::optional<pg_missing_item> item;
auto miter = missing.get_items().find(hoid);
if (miter != missing.get_items().end()) {
item = miter->second;
<< " no pg, shouldn't exist e" << osdmap->get_epoch()
<< ", dropping " << qi << dendl;
// share map with client?
- if (boost::optional<OpRequestRef> _op = qi.maybe_get_op()) {
+ if (std::optional<OpRequestRef> _op = qi.maybe_get_op()) {
osd->service.maybe_share_map((*_op)->get_req()->get_connection().get(),
sdata->shard_osdmap,
(*_op)->sent_epoch);
{
#ifdef WITH_LTTNG
osd_reqid_t reqid;
- if (boost::optional<OpRequestRef> _op = qi.maybe_get_op()) {
+ if (std::optional<OpRequestRef> _op = qi.maybe_get_op()) {
reqid = (*_op)->get_reqid();
}
#endif
{
#ifdef WITH_LTTNG
osd_reqid_t reqid;
- if (boost::optional<OpRequestRef> _op = qi.maybe_get_op()) {
+ if (std::optional<OpRequestRef> _op = qi.maybe_get_op()) {
reqid = (*_op)->get_reqid();
}
#endif
virtual const spg_t& get_ordering_token() const = 0;
virtual OrderLocker::Ref get_order_locker(PGRef pg) = 0;
virtual op_type_t get_op_type() const = 0;
- virtual boost::optional<OpRequestRef> maybe_get_op() const {
- return boost::none;
+ virtual std::optional<OpRequestRef> maybe_get_op() const {
+ return std::nullopt;
}
virtual uint64_t get_reserved_pushes() const {
OpQueueable::op_type_t get_op_type() const {
return qitem->get_op_type();
}
- boost::optional<OpRequestRef> maybe_get_op() const {
+ std::optional<OpRequestRef> maybe_get_op() const {
return qitem->maybe_get_op();
}
uint64_t get_reserved_pushes() const {
ostream &print(ostream &rhs) const override final {
return rhs << "PGOpItem(op=" << *(op->get_req()) << ")";
}
- boost::optional<OpRequestRef> maybe_get_op() const override final {
+ std::optional<OpRequestRef> maybe_get_op() const override final {
return op;
}
void run(OSD *osd, OSDShard *sdata, PGRef& pg, ThreadPool::TPHandle &handle) override final;
// construct authoritative scrub map for type specific scrubbing
scrubber.cleaned_meta_map.insert(scrubber.primary_scrubmap);
map<hobject_t,
- pair<boost::optional<uint32_t>,
- boost::optional<uint32_t>>> missing_digest;
+ pair<std::optional<uint32_t>,
+ std::optional<uint32_t>>> missing_digest;
map<pg_shard_t, ScrubMap *> maps;
maps[pg_whoami] = &scrubber.primary_scrubmap;
virtual void scrub_snapshot_metadata(
ScrubMap &map,
const std::map<hobject_t,
- pair<boost::optional<uint32_t>,
- boost::optional<uint32_t>>> &missing_digest) { }
+ pair<std::optional<uint32_t>,
+ std::optional<uint32_t>>> &missing_digest) { }
virtual void _scrub_clear_state() { }
virtual void _scrub_finish() { }
void clear_scrub_reserved();
temp.append(t);
temp.swap(t);
}
- void setattrs(map<string, boost::optional<bufferlist> > &attrs) override {
+ void setattrs(map<string, std::optional<bufferlist> > &attrs) override {
ObjectStore::Transaction temp;
pg->rollback_setattrs(hoid, attrs, &temp);
temp.append(t);
void PGBackend::rollback_setattrs(
const hobject_t &hoid,
- map<string, boost::optional<bufferlist> > &old_attrs,
+ map<string, std::optional<bufferlist> > &old_attrs,
ObjectStore::Transaction *t) {
map<string, bufferlist> to_set;
ceph_assert(!hoid.is_temp());
- for (map<string, boost::optional<bufferlist> >::iterator i = old_attrs.begin();
+ for (map<string, std::optional<bufferlist> >::iterator i = old_attrs.begin();
i != old_attrs.end();
++i) {
if (i->second) {
- to_set[i->first] = i->second.get();
+ to_set[i->first] = *(i->second);
} else {
t->rmattr(
coll,
map<hobject_t, set<pg_shard_t>> &missing,
map<hobject_t, set<pg_shard_t>> &inconsistent,
map<hobject_t, list<pg_shard_t>> &authoritative,
- map<hobject_t, pair<boost::optional<uint32_t>,
- boost::optional<uint32_t>>> &missing_digest,
+ map<hobject_t, pair<std::optional<uint32_t>,
+ std::optional<uint32_t>>> &missing_digest,
int &shallow_errors, int &deep_errors,
Scrub::Store *store,
const spg_t& pgid,
}
if (fix_digest) {
- boost::optional<uint32_t> data_digest, omap_digest;
+ std::optional<uint32_t> data_digest, omap_digest;
ceph_assert(auth_object.digest_present);
data_digest = auth_object.digest;
if (auth_object.omap_digest_present) {
utime_t age = now - auth_oi.local_mtime;
if (update == FORCE ||
age > cct->_conf->osd_deep_scrub_update_digest_min_age) {
- boost::optional<uint32_t> data_digest, omap_digest;
+ std::optional<uint32_t> data_digest, omap_digest;
if (auth_object.digest_present) {
data_digest = auth_object.digest;
dout(20) << __func__ << " will update data digest on " << *k << dendl;
virtual void add_local_next_event(const pg_log_entry_t& e) = 0;
virtual const map<pg_shard_t, pg_missing_t> &get_shard_missing()
const = 0;
- virtual boost::optional<const pg_missing_const_i &> maybe_get_shard_missing(
+ virtual const pg_missing_const_i * maybe_get_shard_missing(
pg_shard_t peer) const {
if (peer == primary_shard()) {
- return get_local_missing();
+ return &get_local_missing();
} else {
map<pg_shard_t, pg_missing_t>::const_iterator i =
get_shard_missing().find(peer);
if (i == get_shard_missing().end()) {
- return boost::optional<const pg_missing_const_i &>();
+ return nullptr;
} else {
- return i->second;
+ return &(i->second);
}
}
}
virtual void log_operation(
const vector<pg_log_entry_t> &logv,
- const boost::optional<pg_hit_set_history_t> &hset_history,
+ const std::optional<pg_hit_set_history_t> &hset_history,
const eversion_t &trim_to,
const eversion_t &roll_forward_to,
bool transaction_applied,
const eversion_t &roll_forward_to, ///< [in] trim rollback info to here
const vector<pg_log_entry_t> &log_entries, ///< [in] log entries for t
/// [in] hitset history (if updated with this transaction)
- boost::optional<pg_hit_set_history_t> &hset_history,
+ std::optional<pg_hit_set_history_t> &hset_history,
Context *on_all_commit, ///< [in] called when all commit
ceph_tid_t tid, ///< [in] tid
osd_reqid_t reqid, ///< [in] reqid
/// Reapply old attributes
void rollback_setattrs(
const hobject_t &hoid,
- map<string, boost::optional<bufferlist> > &old_attrs,
+ map<string, std::optional<bufferlist> > &old_attrs,
ObjectStore::Transaction *t);
/// Truncate object to rollback append
map<hobject_t, set<pg_shard_t>> &missing,
map<hobject_t, set<pg_shard_t>> &inconsistent,
map<hobject_t, list<pg_shard_t>> &authoritative,
- map<hobject_t, pair<boost::optional<uint32_t>,
- boost::optional<uint32_t>>> &missing_digest,
+ map<hobject_t, pair<std::optional<uint32_t>,
+ std::optional<uint32_t>>> &missing_digest,
int &shallow_errors, int &deep_errors,
Scrub::Store *store,
const spg_t& pgid,
#include <map>
#include <memory>
-#include <boost/optional.hpp>
+#include <optional>
#include "common/hobject.h"
#include "osd/osd_types.h"
* remember the lowest truncate and the final object size
* (the last truncate). We also adjust the buffers map
* to account for truncates overriding previous writes */
- boost::optional<pair<uint64_t, uint64_t> > truncate = boost::none;
+ std::optional<pair<uint64_t, uint64_t> > truncate = std::nullopt;
- std::map<string, boost::optional<bufferlist> > attr_updates;
+ std::map<string, std::optional<bufferlist> > attr_updates;
enum class OmapUpdateType {Remove, Insert};
std::vector<std::pair<OmapUpdateType, bufferlist> > omap_updates;
- boost::optional<bufferlist> omap_header;
+ std::optional<bufferlist> omap_header;
/// (old, new) -- only valid with no truncate or buffer updates
- boost::optional<pair<set<snapid_t>, set<snapid_t> > > updated_snaps;
+ std::optional<pair<set<snapid_t>, set<snapid_t> > > updated_snaps;
struct alloc_hint_t {
uint64_t expected_object_size;
uint64_t expected_write_size;
uint32_t flags;
};
- boost::optional<alloc_hint_t> alloc_hint;
+ std::optional<alloc_hint_t> alloc_hint;
struct BufferUpdate {
struct Write {
auto &op = get_object_op_for_modify(hoid);
op.clear_omap = true;
op.omap_updates.clear();
- op.omap_header = boost::none;
+ op.omap_header = std::nullopt;
}
void truncate(
const hobject_t &hoid, ///< [in] object
const string &attrname ///< [in] attr to remove
) {
auto &op = get_object_op_for_modify(hoid);
- op.attr_updates[attrname] = boost::none;
+ op.attr_updates[attrname] = std::nullopt;
}
/// set alloc hint
}
}
if (all_dirty) {
- start_flush(OpRequestRef(), obc, true, NULL, boost::none);
+ start_flush(OpRequestRef(), obc, true, NULL, std::nullopt);
}
return cache_result_t::NOOP;
}
}
int PrimaryLogPG::start_manifest_flush(OpRequestRef op, ObjectContextRef obc, bool blocking,
- boost::optional<std::function<void()>> &&on_flush)
+ std::optional<std::function<void()>> &&on_flush)
{
auto p = obc->obs.oi.manifest.chunk_map.begin();
FlushOpRef manifest_fop(std::make_shared<FlushOp>());
submit_log_entries(
entries,
std::move(lock_manager),
- boost::optional<std::function<void(void)> >(
+ std::optional<std::function<void(void)> >(
OnComplete(this, op, orig_reply, r)),
op,
r);
ceph_le64 *r;
int32_t *rval;
bufferlist *outdatap;
- boost::optional<uint32_t> maybe_crc;
+ std::optional<uint32_t> maybe_crc;
uint64_t size;
OSDService *osd;
hobject_t soid;
__le32 flags;
FillInVerifyExtent(ceph_le64 *r, int32_t *rv, bufferlist *blp,
- boost::optional<uint32_t> mc, uint64_t size,
+ std::optional<uint32_t> mc, uint64_t size,
OSDService *osd, hobject_t soid, __le32 flags) :
r(r), rval(rv), outdatap(blp), maybe_crc(mc),
size(size), osd(osd), soid(soid), flags(flags) {}
C_ChecksumRead(PrimaryLogPG *primary_log_pg, OSDOp &osd_op,
Checksummer::CSumType csum_type, bufferlist &&init_value_bl,
- boost::optional<uint32_t> maybe_crc, uint64_t size,
+ std::optional<uint32_t> maybe_crc, uint64_t size,
OSDService *osd, hobject_t soid, __le32 flags)
: primary_log_pg(primary_log_pg), osd_op(osd_op),
csum_type(csum_type), init_value_bl(std::move(init_value_bl)),
if (pool.info.is_erasure() && op.checksum.length > 0) {
// If there is a data digest and it is possible we are reading
// entire object, pass the digest.
- boost::optional<uint32_t> maybe_crc;
+ std::optional<uint32_t> maybe_crc;
if (oi.is_data_digest() && op.checksum.offset == 0 &&
op.checksum.length >= oi.size) {
maybe_crc = oi.data_digest;
Context *fill_extent_ctx;
C_ExtentCmpRead(PrimaryLogPG *primary_log_pg, OSDOp &osd_op,
- boost::optional<uint32_t> maybe_crc, uint64_t size,
+ std::optional<uint32_t> maybe_crc, uint64_t size,
OSDService *osd, hobject_t soid, __le32 flags)
: primary_log_pg(primary_log_pg), osd_op(osd_op),
fill_extent_ctx(new FillInVerifyExtent(&read_length, &osd_op.rval,
} else if (pool.info.is_erasure()) {
// If there is a data digest and it is possible we are reading
// entire object, pass the digest.
- boost::optional<uint32_t> maybe_crc;
+ std::optional<uint32_t> maybe_crc;
if (oi.is_data_digest() && op.checksum.offset == 0 &&
op.checksum.length >= oi.size) {
maybe_crc = oi.data_digest;
} else if (pool.info.is_erasure()) {
// The initialisation below is required to silence a false positive
// -Wmaybe-uninitialized warning
- boost::optional<uint32_t> maybe_crc = boost::make_optional(false, uint32_t());
+ std::optional<uint32_t> maybe_crc;
// If there is a data digest and it is possible we are reading
// entire object, pass the digest. FillInVerifyExtent will
// will check the oi.size again.
break;
}
if (oi.is_dirty()) {
- result = start_flush(ctx->op, ctx->obc, false, NULL, boost::none);
+ result = start_flush(ctx->op, ctx->obc, false, NULL, std::nullopt);
if (result == -EINPROGRESS)
result = -EAGAIN;
} else {
}
hobject_t missing;
if (oi.is_dirty()) {
- result = start_flush(ctx->op, ctx->obc, true, &missing, boost::none);
+ result = start_flush(ctx->op, ctx->obc, true, &missing, std::nullopt);
if (result == -EINPROGRESS)
result = -EAGAIN;
} else {
p != ctx->notify_acks.end();
++p) {
if (p->watch_cookie)
- dout(10) << "notify_ack " << make_pair(p->watch_cookie.get(), p->notify_id) << dendl;
+ dout(10) << "notify_ack " << make_pair(*(p->watch_cookie), p->notify_id) << dendl;
else
dout(10) << "notify_ack " << make_pair("NULL", p->notify_id) << dendl;
for (map<pair<uint64_t, entity_name_t>, WatchRef>::iterator i =
++i) {
if (i->first.second != entity) continue;
if (p->watch_cookie &&
- p->watch_cookie.get() != i->first.first) continue;
+ *(p->watch_cookie) != i->first.first) continue;
dout(10) << "acking notify on watch " << i->first << dendl;
i->second->notify_ack(p->notify_id, p->reply_bl);
}
int PrimaryLogPG::start_flush(
OpRequestRef op, ObjectContextRef obc,
bool blocking, hobject_t *pmissing,
- boost::optional<std::function<void()>> &&on_flush)
+ std::optional<std::function<void()>> &&on_flush)
{
const object_info_t& oi = obc->obs.oi;
const hobject_t& soid = oi.soid;
}
if (fop->on_flush) {
(*(fop->on_flush))();
- fop->on_flush = boost::none;
+ fop->on_flush = std::nullopt;
}
flush_ops.erase(oid);
return;
}
if (fop->on_flush) {
(*(fop->on_flush))();
- fop->on_flush = boost::none;
+ fop->on_flush = std::nullopt;
}
flush_ops.erase(oid);
if (fop->blocking)
osd->logger->inc(l_osd_tier_clean);
if (fop->on_flush) {
(*(fop->on_flush))();
- fop->on_flush = boost::none;
+ fop->on_flush = std::nullopt;
}
flush_ops.erase(oid);
return 0;
if (fop->on_flush) {
ctx->register_on_finish(*(fop->on_flush));
- fop->on_flush = boost::none;
+ fop->on_flush = std::nullopt;
}
ctx->at_version = get_next_version();
}
if (fop->on_flush) {
(*(fop->on_flush))();
- fop->on_flush = boost::none;
+ fop->on_flush = std::nullopt;
}
flush_ops.erase(fop->obc->obs.oi.soid);
}
int r,
ObcLockManager &&manager,
OpRequestRef &&op,
- boost::optional<std::function<void(void)> > &&on_complete)
+ std::optional<std::function<void(void)> > &&on_complete)
{
RepGather *repop = new RepGather(
std::move(manager),
void PrimaryLogPG::submit_log_entries(
const mempool::osd_pglog::list<pg_log_entry_t> &entries,
ObcLockManager &&manager,
- boost::optional<std::function<void(void)> > &&_on_complete,
+ std::optional<std::function<void(void)> > &&_on_complete,
OpRequestRef op,
int r)
{
}
boost::intrusive_ptr<RepGather> repop;
- boost::optional<std::function<void(void)> > on_complete;
+ std::optional<std::function<void(void)> > on_complete;
if (get_osdmap()->require_osd_release >= ceph_release_t::jewel) {
repop = new_repop(
version,
op->get_req());
ceph_assert(m->get_type() == MSG_OSD_PG_UPDATE_LOG_MISSING);
ObjectStore::Transaction t;
- boost::optional<eversion_t> op_trim_to, op_roll_forward_to;
+ std::optional<eversion_t> op_trim_to, op_roll_forward_to;
if (m->pg_trim_to != eversion_t())
op_trim_to = m->pg_trim_to;
if (m->pg_roll_forward_to != eversion_t())
op_roll_forward_to = m->pg_roll_forward_to;
- dout(20) << __func__ << " op_trim_to = " << op_trim_to << " op_roll_forward_to = " << op_roll_forward_to << dendl;
+ dout(20) << __func__
+ << " op_trim_to = " << op_trim_to << " op_roll_forward_to = " << op_roll_forward_to << dendl;
recovery_state.append_log_entries_update_missing(
m->entries, t, op_trim_to, op_roll_forward_to);
submit_log_entries(
log_entries,
std::move(manager),
- boost::optional<std::function<void(void)> >(
+ std::optional<std::function<void(void)> >(
[this, oids, con, num_unfound, tid]() {
if (recovery_state.perform_deletes_during_peering()) {
for (auto oid : oids) {
return true;
}
-static bool doing_clones(const boost::optional<SnapSet> &snapset,
+static bool doing_clones(const std::optional<SnapSet> &snapset,
const vector<snapid_t>::reverse_iterator &curclone) {
- return snapset && curclone != snapset.get().clones.rend();
+ return snapset && curclone != snapset->clones.rend();
}
void PrimaryLogPG::log_missing(unsigned missing,
- const boost::optional<hobject_t> &head,
+ const std::optional<hobject_t> &head,
LogChannelRef clog,
const spg_t &pgid,
const char *func,
{
ceph_assert(head);
if (allow_incomplete_clones) {
- dout(20) << func << " " << mode << " " << pgid << " " << head.get()
- << " skipped " << missing << " clone(s) in cache tier" << dendl;
+ dout(20) << func << " " << mode << " " << pgid << " " << *head
+ << " skipped " << missing << " clone(s) in cache tier" << dendl;
} else {
- clog->info() << mode << " " << pgid << " " << head.get()
- << " : " << missing << " missing clone(s)";
+ clog->info() << mode << " " << pgid << " " << *head
+ << " : " << missing << " missing clone(s)";
}
}
-unsigned PrimaryLogPG::process_clones_to(const boost::optional<hobject_t> &head,
- const boost::optional<SnapSet> &snapset,
+unsigned PrimaryLogPG::process_clones_to(const std::optional<hobject_t> &head,
+ const std::optional<SnapSet> &snapset,
LogChannelRef clog,
const spg_t &pgid,
const char *mode,
bool allow_incomplete_clones,
- boost::optional<snapid_t> target,
+ std::optional<snapid_t> target,
vector<snapid_t>::reverse_iterator *curclone,
inconsistent_snapset_wrapper &e)
{
unsigned missing = 0;
// NOTE: clones are in descending order, thus **curclone > target test here
- hobject_t next_clone(head.get());
+ hobject_t next_clone(*head);
while(doing_clones(snapset, *curclone) && (!target || **curclone > *target)) {
++missing;
// it is okay to be missing one or more clones in a cache tier.
// skip higher-numbered clones in the list.
if (!allow_incomplete_clones) {
next_clone.snap = **curclone;
- clog->error() << mode << " " << pgid << " " << head.get()
+ clog->error() << mode << " " << pgid << " " << *head
<< " : expected clone " << next_clone << " " << missing
<< " missing";
++scrubber.shallow_errors;
void PrimaryLogPG::scrub_snapshot_metadata(
ScrubMap &scrubmap,
const map<hobject_t,
- pair<boost::optional<uint32_t>,
- boost::optional<uint32_t>>> &missing_digest)
+ pair<std::optional<uint32_t>,
+ std::optional<uint32_t>>> &missing_digest)
{
dout(10) << __func__ << dendl;
bool repair = state_test(PG_STATE_REPAIR);
bool deep_scrub = state_test(PG_STATE_DEEP_SCRUB);
const char *mode = (repair ? "repair": (deep_scrub ? "deep-scrub" : "scrub"));
- boost::optional<snapid_t> all_clones; // Unspecified snapid_t or boost::none
+ std::optional<snapid_t> all_clones; // Unspecified snapid_t or std::nullopt
// traverse in reverse order.
- boost::optional<hobject_t> head;
- boost::optional<SnapSet> snapset; // If initialized so will head (above)
+ std::optional<hobject_t> head;
+ std::optional<SnapSet> snapset; // If initialized so will head (above)
vector<snapid_t>::reverse_iterator curclone; // Defined only if snapset initialized
unsigned missing = 0;
inconsistent_snapset_wrapper soid_error, head_error;
ceph_assert(!soid.is_snapdir());
soid_error = inconsistent_snapset_wrapper{soid};
object_stat_sum_t stat;
- boost::optional<object_info_t> oi;
+ std::optional<object_info_t> oi;
stat.num_objects++;
// basic checks.
if (p->second.attrs.count(OI_ATTR) == 0) {
- oi = boost::none;
+ oi = std::nullopt;
osd->clog->error() << mode << " " << info.pgid << " " << soid
<< " : no '" << OI_ATTR << "' attr";
++scrubber.shallow_errors;
bv.push_back(p->second.attrs[OI_ATTR]);
try {
oi = object_info_t(); // Initialize optional<> before decode into it
- oi.get().decode(bv);
+ oi->decode(bv);
} catch (buffer::error& e) {
- oi = boost::none;
+ oi = std::nullopt;
osd->clog->error() << mode << " " << info.pgid << " " << soid
<< " : can't decode '" << OI_ATTR << "' attr " << e.what();
++scrubber.shallow_errors;
++scrubber.shallow_errors;
}
- dout(20) << mode << " " << soid << " " << oi.get() << dendl;
+ dout(20) << mode << " " << soid << " " << *oi << dendl;
// A clone num_bytes will be added later when we have snapset
if (!soid.is_snap()) {
// Check for any problems while processing clones
if (doing_clones(snapset, curclone)) {
- boost::optional<snapid_t> target;
+ std::optional<snapid_t> target;
// Expecting an object with snap for current head
if (soid.has_snapset() || soid.get_head() != head->get_head()) {
dout(10) << __func__ << " " << mode << " " << info.pgid << " new object "
- << soid << " while processing " << head.get() << dendl;
+ << soid << " while processing " << *head << dendl;
target = all_clones;
} else {
osd->clog->error() << mode << " " << info.pgid << " " << soid
<< " : no '" << SS_ATTR << "' attr";
++scrubber.shallow_errors;
- snapset = boost::none;
+ snapset = std::nullopt;
head_error.set_snapset_missing();
} else {
bufferlist bl;
auto blp = bl.cbegin();
try {
snapset = SnapSet(); // Initialize optional<> before decoding into it
- decode(snapset.get(), blp);
+ decode(*snapset, blp);
head_error.ss_bl.push_back(p->second.attrs[SS_ATTR]);
} catch (buffer::error& e) {
- snapset = boost::none;
+ snapset = std::nullopt;
osd->clog->error() << mode << " " << info.pgid << " " << soid
<< " : can't decode '" << SS_ATTR << "' attr " << e.what();
++scrubber.shallow_errors;
curclone = snapset->clones.rbegin();
if (!snapset->clones.empty()) {
- dout(20) << " snapset " << snapset.get() << dendl;
+ dout(20) << " snapset " << *snapset << dendl;
if (snapset->seq == 0) {
osd->clog->error() << mode << " " << info.pgid << " " << soid
<< " : snaps.seq not set";
if (doing_clones(snapset, curclone)) {
dout(10) << __func__ << " " << mode << " " << info.pgid
- << " No more objects while processing " << head.get() << dendl;
+ << " No more objects while processing " << *head << dendl;
missing += process_clones_to(head, snapset, osd->clog, info.pgid, mode,
pool.info.allow_incomplete_clones(), all_clones, &curclone,
int rval; ///< copy-from result
bool blocking; ///< whether we are blocking updates
bool removal; ///< we are removing the backend object
- boost::optional<std::function<void()>> on_flush; ///< callback, may be null
+ std::optional<std::function<void()>> on_flush; ///< callback, may be null
// for chunked object
map<uint64_t, int> io_results;
map<uint64_t, ceph_tid_t> io_tids;
void log_operation(
const vector<pg_log_entry_t> &logv,
- const boost::optional<pg_hit_set_history_t> &hset_history,
+ const std::optional<pg_hit_set_history_t> &hset_history,
const eversion_t &trim_to,
const eversion_t &roll_forward_to,
bool transaction_applied,
list<watch_disconnect_t> watch_disconnects; ///< old watch + send_discon
list<notify_info_t> notifies;
struct NotifyAck {
- boost::optional<uint64_t> watch_cookie;
+ std::optional<uint64_t> watch_cookie;
uint64_t notify_id;
bufferlist reply_bl;
explicit NotifyAck(uint64_t notify_id) : notify_id(notify_id) {}
PGTransactionUPtr op_t;
vector<pg_log_entry_t> log;
- boost::optional<pg_hit_set_history_t> updated_hset_history;
+ std::optional<pg_hit_set_history_t> updated_hset_history;
interval_set<uint64_t> modified_ranges;
ObjectContextRef obc;
ObjectContextRef head_obc; // if we also update snapset (see trim_object)
// FIXME: we may want to kill this msgr hint off at some point!
- boost::optional<int> data_off = boost::none;
+ std::optional<int> data_off = std::nullopt;
MOSDOpReply *reply;
RepGather(
ObcLockManager &&manager,
OpRequestRef &&o,
- boost::optional<std::function<void(void)> > &&on_complete,
+ std::optional<std::function<void(void)> > &&on_complete,
ceph_tid_t rt,
eversion_t lc,
int r) :
int r,
ObcLockManager &&manager,
OpRequestRef &&op,
- boost::optional<std::function<void(void)> > &&on_complete);
+ std::optional<std::function<void(void)> > &&on_complete);
void remove_repop(RepGather *repop);
OpContextUPtr simple_opc_create(ObjectContextRef obc);
void submit_log_entries(
const mempool::osd_pglog::list<pg_log_entry_t> &entries,
ObcLockManager &&manager,
- boost::optional<std::function<void(void)> > &&on_complete,
+ std::optional<std::function<void(void)> > &&on_complete,
OpRequestRef op = OpRequestRef(),
int r = 0);
struct LogUpdateCtx {
int start_flush(
OpRequestRef op, ObjectContextRef obc,
bool blocking, hobject_t *pmissing,
- boost::optional<std::function<void()>> &&on_flush);
+ std::optional<std::function<void()>> &&on_flush);
void finish_flush(hobject_t oid, ceph_tid_t tid, int r);
int try_flush_mark_clean(FlushOpRef fop);
void cancel_flush(FlushOpRef fop, bool requeue, vector<ceph_tid_t> *tids);
void scrub_snapshot_metadata(
ScrubMap &map,
const std::map<hobject_t,
- pair<boost::optional<uint32_t>,
- boost::optional<uint32_t>>> &missing_digest) override;
+ pair<std::optional<uint32_t>,
+ std::optional<uint32_t>>> &missing_digest) override;
void _scrub_clear_state() override;
void _scrub_finish() override;
object_stat_collection_t scrub_cstat;
int do_manifest_flush(OpRequestRef op, ObjectContextRef obc, FlushOpRef manifest_fop,
uint64_t start_offset, bool block);
int start_manifest_flush(OpRequestRef op, ObjectContextRef obc, bool blocking,
- boost::optional<std::function<void()>> &&on_flush);
+ std::optional<std::function<void()>> &&on_flush);
void finish_manifest_flush(hobject_t oid, ceph_tid_t tid, int r, ObjectContextRef obc,
uint64_t last_offset);
void handle_manifest_flush(hobject_t oid, ceph_tid_t tid, int r,
return pri > 0 ? pri : cct->_conf->osd_recovery_op_priority;
}
void log_missing(unsigned missing,
- const boost::optional<hobject_t> &head,
+ const std::optional<hobject_t> &head,
LogChannelRef clog,
const spg_t &pgid,
const char *func,
const char *mode,
bool allow_incomplete_clones);
- unsigned process_clones_to(const boost::optional<hobject_t> &head,
- const boost::optional<SnapSet> &snapset,
+ unsigned process_clones_to(const std::optional<hobject_t> &head,
+ const std::optional<SnapSet> &snapset,
LogChannelRef clog,
const spg_t &pgid,
const char *mode,
bool allow_incomplete_clones,
- boost::optional<snapid_t> target,
+ std::optional<snapid_t> target,
vector<snapid_t>::reverse_iterator *curclone,
inconsistent_snapset_wrapper &snap_error);
const eversion_t &trim_to,
const eversion_t &roll_forward_to,
const vector<pg_log_entry_t> &_log_entries,
- boost::optional<pg_hit_set_history_t> &hset_history,
+ std::optional<pg_hit_set_history_t> &hset_history,
Context *on_all_commit,
ceph_tid_t tid,
osd_reqid_t reqid,
hobject_t new_temp_oid,
hobject_t discard_temp_oid,
const bufferlist &log_entries,
- boost::optional<pg_hit_set_history_t> &hset_hist,
+ std::optional<pg_hit_set_history_t> &hset_hist,
ObjectStore::Transaction &op_t,
pg_shard_t peer,
const pg_info_t &pinfo)
hobject_t new_temp_oid,
hobject_t discard_temp_oid,
const vector<pg_log_entry_t> &log_entries,
- boost::optional<pg_hit_set_history_t> &hset_hist,
+ std::optional<pg_hit_set_history_t> &hset_hist,
InProgressOp *op,
ObjectStore::Transaction &op_t)
{
const eversion_t &trim_to,
const eversion_t &roll_forward_to,
const vector<pg_log_entry_t> &log_entries,
- boost::optional<pg_hit_set_history_t> &hset_history,
+ std::optional<pg_hit_set_history_t> &hset_history,
Context *on_all_commit,
ceph_tid_t tid,
osd_reqid_t reqid,
hobject_t new_temp_oid,
hobject_t discard_temp_oid,
const bufferlist &log_entries,
- boost::optional<pg_hit_set_history_t> &hset_history,
+ std::optional<pg_hit_set_history_t> &hset_history,
ObjectStore::Transaction &op_t,
pg_shard_t peer,
const pg_info_t &pinfo);
hobject_t new_temp_oid,
hobject_t discard_temp_oid,
const vector<pg_log_entry_t> &log_entries,
- boost::optional<pg_hit_set_history_t> &hset_history,
+ std::optional<pg_hit_set_history_t> &hset_history,
InProgressOp *op,
ObjectStore::Transaction &op_t);
void op_commit(InProgressOpRef& op);
// get_header returns ceph_msg_header type, ceph_msg_header
// stores type as unsigned little endian, so be sure to
// convert to CPU byte ordering
- boost::optional<OpRequestRef> op_ref_maybe = op.maybe_get_op();
+ std::optional<OpRequestRef> op_ref_maybe = op.maybe_get_op();
ceph_assert(op_ref_maybe);
__le16 mtype_le = (*op_ref_maybe)->get_req()->get_header().type;
__u16 mtype = le16_to_cpu(mtype_le);
return ret;
}
-boost::optional<uint64_t> pg_string_state(const std::string& state)
+std::optional<uint64_t> pg_string_state(const std::string& state)
{
- boost::optional<uint64_t> type;
+ std::optional<uint64_t> type;
if (state == "active")
type = PG_STATE_ACTIVE;
else if (state == "clean")
else if (state == "unknown")
type = 0;
else
- type = boost::none;
+ type = std::nullopt;
return type;
}
break;
}
case SETATTRS: {
- map<string, boost::optional<ceph::buffer::list> > attrs;
+ map<string, std::optional<ceph::buffer::list> > attrs;
decode(attrs, bp);
visitor->setattrs(attrs);
break;
f->dump_unsigned("old_size", old_size);
f->close_section();
}
- void setattrs(map<string, boost::optional<ceph::buffer::list> > &attrs) override {
+ void setattrs(map<string, std::optional<ceph::buffer::list> > &attrs) override {
f->open_object_section("op");
f->dump_string("code", "SETATTRS");
f->open_array_section("attrs");
void ObjectModDesc::generate_test_instances(list<ObjectModDesc*>& o)
{
- map<string, boost::optional<ceph::buffer::list> > attrs;
+ map<string, std::optional<ceph::buffer::list> > attrs;
attrs[OI_ATTR];
attrs[SS_ATTR];
attrs["asdf"];
std::string pg_state_string(uint64_t state);
std::string pg_vector_string(const std::vector<int32_t> &a);
-boost::optional<uint64_t> pg_string_state(const std::string& state);
+std::optional<uint64_t> pg_string_state(const std::string& state);
/*
class Visitor {
public:
virtual void append(uint64_t old_offset) {}
- virtual void setattrs(std::map<std::string, boost::optional<ceph::buffer::list>> &attrs) {}
+ virtual void setattrs(std::map<std::string, std::optional<ceph::buffer::list>> &attrs) {}
virtual void rmobject(version_t old_version) {}
/**
* Used to support the unfound_lost_delete log event: if the stashed
encode(old_size, bl);
ENCODE_FINISH(bl);
}
- void setattrs(std::map<std::string, boost::optional<ceph::buffer::list>> &old_attrs) {
+ void setattrs(std::map<std::string, std::optional<ceph::buffer::list>> &old_attrs) {
if (!can_local_rollback || rollback_info_completed)
return;
ENCODE_START(1, 1, bl);