It will be needed in crimson as well.
Signed-off-by: Radoslaw Zarzynski <rzarzyns@redhat.com>
${PROJECT_SOURCE_DIR}/src/osd/PGStateUtils.cc
${PROJECT_SOURCE_DIR}/src/osd/MissingLoc.cc
${PROJECT_SOURCE_DIR}/src/osd/PGLog.cc
+ ${PROJECT_SOURCE_DIR}/src/osd/recovery_types.cc
${PROJECT_SOURCE_DIR}/src/osd/osd_perf_counters.cc
watch.cc
)
scheduler/mClockScheduler.cc
PeeringState.cc
PGStateUtils.cc
+ recovery_types.cc
MissingLoc.cc
osd_perf_counters.cc
${CMAKE_SOURCE_DIR}/src/common/TrackedOp.cc
return 0;
}
-ostream& operator<<(ostream& out, const PG::BackfillInterval& bi)
-{
- out << "BackfillInfo(" << bi.begin << "-" << bi.end
- << " " << bi.objects.size() << " objects";
- if (!bi.objects.empty())
- out << " " << bi.objects;
- out << ")";
- return out;
-}
-
void PG::dump_pgstate_history(Formatter *f)
{
std::scoped_lock l{*this};
#include "PGBackend.h"
#include "PGPeeringEvent.h"
#include "PeeringState.h"
+#include "recovery_types.h"
#include "MissingLoc.h"
#include "mgr/OSDPerfMetricTypes.h"
std::set<int> heartbeat_peers;
std::set<int> probe_targets;
-public:
- /**
- * BackfillInterval
- *
- * Represents the objects in a range [begin, end)
- *
- * Possible states:
- * 1) begin == end == hobject_t() indicates the the interval is unpopulated
- * 2) Else, objects contains all objects in [begin, end)
- */
- struct BackfillInterval {
- // info about a backfill interval on a peer
- eversion_t version; /// version at which the scan occurred
- std::map<hobject_t,eversion_t> objects;
- hobject_t begin;
- hobject_t end;
-
- /// clear content
- void clear() {
- *this = BackfillInterval();
- }
-
- /// clear objects std::list only
- void clear_objects() {
- objects.clear();
- }
-
- /// reinstantiate with a new start+end position and sort order
- void reset(hobject_t start) {
- clear();
- begin = end = start;
- }
-
- /// true if there are no objects in this interval
- bool empty() const {
- return objects.empty();
- }
-
- /// true if interval extends to the end of the range
- bool extends_to_end() const {
- return end.is_max();
- }
-
- /// removes items <= soid and adjusts begin to the first object
- void trim_to(const hobject_t &soid) {
- trim();
- while (!objects.empty() &&
- objects.begin()->first <= soid) {
- pop_front();
- }
- }
-
- /// Adjusts begin to the first object
- void trim() {
- if (!objects.empty())
- begin = objects.begin()->first;
- else
- begin = end;
- }
-
- /// drop first entry, and adjust @begin accordingly
- void pop_front() {
- ceph_assert(!objects.empty());
- objects.erase(objects.begin());
- trim();
- }
-
- /// dump
- void dump(ceph::Formatter *f) const {
- f->dump_stream("begin") << begin;
- f->dump_stream("end") << end;
- f->open_array_section("objects");
- for (std::map<hobject_t, eversion_t>::const_iterator i =
- objects.begin();
- i != objects.end();
- ++i) {
- f->open_object_section("object");
- f->dump_stream("object") << i->first;
- f->dump_stream("version") << i->second;
- f->close_section();
- }
- f->close_section();
- }
- };
-
protected:
BackfillInterval backfill_info;
std::map<pg_shard_t, BackfillInterval> peer_backfill_info;
const pg_info_t &info;
};
-
-ostream& operator<<(ostream& out, const PG::BackfillInterval& bi);
-
#endif
}
};
- /* Encapsulates PG recovery process */
+/* Encapsulates PG recovery process */
class PeeringState : public MissingLoc::MappingInfo {
public:
struct PeeringListener : public EpochSource {
--- /dev/null
+// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
+// vim: ts=8 sw=2 smarttab
+
+#include "recovery_types.h"
+
+ostream& operator<<(ostream& out, const BackfillInterval& bi)
+{
+ out << "BackfillInfo(" << bi.begin << "-" << bi.end
+ << " " << bi.objects.size() << " objects";
+ if (!bi.objects.empty())
+ out << " " << bi.objects;
+ out << ")";
+ return out;
+}
+
+
--- /dev/null
+// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
+// vim: ts=8 sw=2 smarttab
+
+#pragma once
+
+#include <map>
+
+#include "osd_types.h"
+
+/**
+ * BackfillInterval
+ *
+ * Represents the objects in a range [begin, end)
+ *
+ * Possible states:
+ * 1) begin == end == hobject_t() indicates the the interval is unpopulated
+ * 2) Else, objects contains all objects in [begin, end)
+ */
+struct BackfillInterval {
+ // info about a backfill interval on a peer
+ eversion_t version; /// version at which the scan occurred
+ std::map<hobject_t,eversion_t> objects;
+ hobject_t begin;
+ hobject_t end;
+
+ /// clear content
+ void clear() {
+ *this = BackfillInterval();
+ }
+
+ /// clear objects std::list only
+ void clear_objects() {
+ objects.clear();
+ }
+
+ /// reinstantiate with a new start+end position and sort order
+ void reset(hobject_t start) {
+ clear();
+ begin = end = start;
+ }
+
+ /// true if there are no objects in this interval
+ bool empty() const {
+ return objects.empty();
+ }
+
+ /// true if interval extends to the end of the range
+ bool extends_to_end() const {
+ return end.is_max();
+ }
+
+ /// removes items <= soid and adjusts begin to the first object
+ void trim_to(const hobject_t &soid) {
+ trim();
+ while (!objects.empty() &&
+ objects.begin()->first <= soid) {
+ pop_front();
+ }
+ }
+
+ /// Adjusts begin to the first object
+ void trim() {
+ if (!objects.empty())
+ begin = objects.begin()->first;
+ else
+ begin = end;
+ }
+
+ /// drop first entry, and adjust @begin accordingly
+ void pop_front() {
+ ceph_assert(!objects.empty());
+ objects.erase(objects.begin());
+ trim();
+ }
+
+ /// dump
+ void dump(ceph::Formatter *f) const {
+ f->dump_stream("begin") << begin;
+ f->dump_stream("end") << end;
+ f->open_array_section("objects");
+ for (std::map<hobject_t, eversion_t>::const_iterator i =
+ objects.begin();
+ i != objects.end();
+ ++i) {
+ f->open_object_section("object");
+ f->dump_stream("object") << i->first;
+ f->dump_stream("version") << i->second;
+ f->close_section();
+ }
+ f->close_section();
+ }
+};
+
+std::ostream &operator<<(std::ostream &out, const BackfillInterval &bi);
+