handle_mds_map(ref_cast<MMDSMap>(m));
break;
+ case MSG_REMOVE_SNAPS:
+ ALLOW_MESSAGES_FROM(CEPH_ENTITY_TYPE_MON);
+ mds_rank->snapserver->handle_remove_snaps(ref_cast<MRemoveSnaps>(m));
+ break;
+
// OSD
case MSG_COMMAND:
handle_command(ref_cast<MCommand>(m));
last_checked_osdmap = version;
}
+void SnapServer::handle_remove_snaps(const cref_t<MRemoveSnaps> &m)
+{
+ dout(10) << __func__ << " " << *m << dendl;
+
+ map<int32_t, vector<snapid_t> > all_purged;
+ int num = 0;
+
+ for (const auto& [id, snaps] : need_to_purge) {
+ auto i = m->snaps.find(id);
+ if (i == m->snaps.end()) {
+ continue;
+ }
+ for (const auto& q : snaps) {
+ if (std::find(i->second.begin(), i->second.end(), q) != i->second.end()) {
+ dout(10) << " mon reports " << q << " is removed" << dendl;
+ all_purged[id].push_back(q);
+ ++num;
+ }
+ }
+ }
+
+ dout(10) << __func__ << " " << num << " now removed" << dendl;
+ if (num) {
+ bufferlist bl;
+ using ceph::encode;
+ encode(all_purged, bl);
+ do_server_update(bl);
+ }
+}
+
void SnapServer::dump(Formatter *f) const
{
#include "MDSTableServer.h"
#include "snap.h"
+#include "messages/MRemoveSnaps.h"
+
class MDSRank;
class MonClient;
bool _notify_prep(version_t tid) override;
void handle_query(const cref_t<MMDSTableRequest> &m) override;
+public:
+ void handle_remove_snaps(const cref_t<MRemoveSnaps> &m);
+
public:
SnapServer(MDSRank *m, MonClient *monc)
: MDSTableServer(m, TABLE_SNAP), mon_client(monc), last_checked_osdmap(0) {}