]> git.proxmox.com Git - ceph.git/blob - ceph/src/osd/PrimaryLogScrub.h
import ceph 16.2.6
[ceph.git] / ceph / src / osd / PrimaryLogScrub.h
1 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
2 // vim: ts=8 sw=2 smarttab
3 #pragma once
4
5 // the './' includes are marked this way to affect clang-format
6 #include "./pg_scrubber.h"
7
8 #include <iostream>
9 #include <sstream>
10 #include <vector>
11
12 #include "debug.h"
13
14 #include "common/errno.h"
15 #include "common/scrub_types.h"
16 #include "messages/MOSDOp.h"
17 #include "messages/MOSDRepScrub.h"
18 #include "messages/MOSDRepScrubMap.h"
19 #include "messages/MOSDScrub.h"
20 #include "messages/MOSDScrubReserve.h"
21
22 #include "OSD.h"
23 #include "scrub_machine.h"
24
25 class PrimaryLogPG;
26
27 /**
28 * The derivative of PgScrubber that is used by PrimaryLogPG.
29 */
30 class PrimaryLogScrub : public PgScrubber {
31 public:
32 explicit PrimaryLogScrub(PrimaryLogPG* pg);
33
34 void _scrub_finish() final;
35
36 bool get_store_errors(const scrub_ls_arg_t& arg,
37 scrub_ls_result_t& res_inout) const final;
38
39 /**
40 * should we requeue blocked ops?
41 * Yes - if our 'subset_last_applied' is less up-to-date than the
42 * new recovery_state.get_last_update_applied().
43 * (used by PrimaryLogPG::op_applied())
44 */
45 [[nodiscard]] bool should_requeue_blocked_ops(
46 eversion_t last_recovery_applied) const final;
47
48 void stats_of_handled_objects(const object_stat_sum_t& delta_stats,
49 const hobject_t& soid) final;
50
51 private:
52 // we know our PG is actually a PrimaryLogPG. Let's alias the pointer to that object:
53 PrimaryLogPG* const m_pl_pg;
54
55 /**
56 * Validate consistency of the object info and snap sets.
57 */
58 void scrub_snapshot_metadata(ScrubMap& map, const missing_map_t& missing_digest) final;
59
60 void log_missing(int missing,
61 const std::optional<hobject_t>& head,
62 LogChannelRef clog,
63 const spg_t& pgid,
64 const char* func,
65 bool allow_incomplete_clones);
66
67 int process_clones_to(const std::optional<hobject_t>& head,
68 const std::optional<SnapSet>& snapset,
69 LogChannelRef clog,
70 const spg_t& pgid,
71 bool allow_incomplete_clones,
72 std::optional<snapid_t> target,
73 std::vector<snapid_t>::reverse_iterator* curclone,
74 inconsistent_snapset_wrapper& snap_error);
75
76
77 // handle our part in stats collection
78 object_stat_collection_t m_scrub_cstat;
79 void _scrub_clear_state() final; // which just clears the stats
80 };