r = admin_socket->register_command(
"scrubdebug " \
"name=pgid,type=CephPgid " \
- "name=cmd,type=CephChoices,strings=block|unblock " \
+ "name=cmd,type=CephChoices,strings=block|unblock|set|unset " \
"name=value,type=CephString,req=false",
asok_hook,
"debug the scrubber");
m_start = m_pg->info.pgid.pgid.get_hobj_start();
m_active = true;
+ ++m_sessions_counter;
m_pg->publish_stats_to_osd();
}
void PgScrubber::on_replica_init()
{
m_active = true;
+ ++m_sessions_counter;
}
void PgScrubber::_scan_snaps(ScrubMap& smap)
f->dump_string("schedule", sched_state);
}
+ if (m_publish_sessions) {
+ f->dump_int("test_sequence",
+ m_sessions_counter); // an ever-increasing number used by tests
+ }
+
f->close_section();
}
m_active = false;
clear_queued_or_active();
+ ++m_sessions_counter;
}
// note that only applicable to the Replica:
if (cmd == "block") {
// set a flag that will cause the next 'select_range' to report a blocked object
m_debug_blockrange = 1;
+
} else if (cmd == "unblock") {
// send an 'unblock' event, as if a blocked range was freed
m_debug_blockrange = 0;
m_fsm->process_event(Unblocked{});
+
+ } else if ((cmd == "set") || (cmd == "unset")) {
+
+ if (param == "sessions") {
+ // set/reset the inclusion of the scrub sessions counter in 'query' output
+ m_publish_sessions = (cmd == "set");
+
+ } else if (param == "block") {
+ if (cmd == "set") {
+ // set a flag that will cause the next 'select_range' to report a blocked object
+ m_debug_blockrange = 1;
+ } else {
+ // send an 'unblock' event, as if a blocked range was freed
+ m_debug_blockrange = 0;
+ m_fsm->process_event(Unblocked{});
+ }
+ }
}
+
return 0;
}
// ///////////////////// preemption_data_t //////////////////////////////////
bool m_holding_local_reservation{false};
public:
- LocalReservation(OSDService* osds);
+ explicit LocalReservation(OSDService* osds);
~LocalReservation();
bool is_reserved() const { return m_holding_local_reservation; }
};
*/
Scrub::act_token_t m_current_token{1};
+ /**
+ * (primary/replica) a test aid. A counter that is incremented whenever a scrub starts,
+ * and again when it terminates. Exposed as part of the 'pg query' command, to be used
+ * by test scripts.
+ *
+ * @ATTN: not guaranteed to be accurate. To be only used for tests. This is why it
+ * is initialized to a meaningless number;
+ */
+ int32_t m_sessions_counter{(int32_t)((int64_t)(this) & 0x0000'0000'00ff'fff0)};
+ bool m_publish_sessions{false}; //< will the counter be part of 'query' output?
+
scrub_flags_t m_flags;
bool m_active{false};