PURGE_DIR
};
- utime_t stamp;
- //None PurgeItem serves as NoOp for splicing out journal entries;
- //so there has to be a "pad_size" to specify the size of journal
- //space to be spliced.
- uint32_t pad_size;
- Action action;
- inodeno_t ino;
- uint64_t size;
- file_layout_t layout;
- compact_set<int64_t> old_pools;
- SnapContext snapc;
- fragtree_t fragtree;
-
- PurgeItem()
- : pad_size(0), action(NONE), ino(0), size(0)
- {}
+ PurgeItem() {}
void encode(bufferlist &bl) const;
void decode(bufferlist::const_iterator &p);
}
std::string_view get_type_str() const;
+
+ utime_t stamp;
+ //None PurgeItem serves as NoOp for splicing out journal entries;
+ //so there has to be a "pad_size" to specify the size of journal
+ //space to be spliced.
+ uint32_t pad_size = 0;
+ Action action = NONE;
+ inodeno_t ino = 0;
+ uint64_t size = 0;
+ file_layout_t layout;
+ compact_set<int64_t> old_pools;
+ SnapContext snapc;
+ fragtree_t fragtree;
private:
static const std::map<std::string, PurgeItem::Action> actions;
};
*/
class PurgeQueue
{
-protected:
- CephContext *cct;
- const mds_rank_t rank;
- ceph::mutex lock = ceph::make_mutex("PurgeQueue");
- bool readonly = false;
-
- int64_t metadata_pool;
-
- // Don't use the MDSDaemon's Finisher and Timer, because this class
- // operates outside of MDSDaemon::mds_lock
- Finisher finisher;
- SafeTimer timer;
- Filer filer;
- Objecter *objecter;
- std::unique_ptr<PerfCounters> logger;
-
- Journaler journaler;
-
- Context *on_error;
-
- // Map of Journaler offset to PurgeItem
- std::map<uint64_t, PurgeItem> in_flight;
-
- std::set<uint64_t> pending_expire;
-
- // Throttled allowances
- uint64_t ops_in_flight;
-
- // Dynamic op limit per MDS based on PG count
- uint64_t max_purge_ops;
-
- uint32_t _calculate_ops(const PurgeItem &item) const;
-
- bool _can_consume();
-
- // How many bytes were remaining when drain() was first called,
- // used for indicating progress.
- uint64_t drain_initial;
-
- // Has drain() ever been called on this instance?
- bool draining;
-
- // recover the journal write_pos (drop any partial written entry)
- void _recover();
-
- /**
- * @return true if we were in a position to try and consume something:
- * does not mean we necessarily did.
- */
- bool _consume();
-
- // Do we currently have a flush timer event waiting?
- Context *delayed_flush;
-
- void _execute_item(
- const PurgeItem &item,
- uint64_t expire_to);
- void _execute_item_complete(
- uint64_t expire_to);
-
- bool recovered;
- std::vector<Context*> waiting_for_recovery;
-
- void _go_readonly(int r);
-
- size_t purge_item_journal_size;
-
public:
+ PurgeQueue(
+ CephContext *cct_,
+ mds_rank_t rank_,
+ const int64_t metadata_pool_,
+ Objecter *objecter_,
+ Context *on_error);
+ ~PurgeQueue();
+
void init();
void activate();
void shutdown();
void handle_conf_change(const std::set<std::string>& changed, const MDSMap& mds_map);
- PurgeQueue(
- CephContext *cct_,
- mds_rank_t rank_,
- const int64_t metadata_pool_,
- Objecter *objecter_,
- Context *on_error);
- ~PurgeQueue();
-};
+protected:
+ uint32_t _calculate_ops(const PurgeItem &item) const;
+ bool _can_consume();
-#endif
+ // recover the journal write_pos (drop any partial written entry)
+ void _recover();
+
+ /**
+ * @return true if we were in a position to try and consume something:
+ * does not mean we necessarily did.
+ */
+ bool _consume();
+
+ void _execute_item(const PurgeItem &item, uint64_t expire_to);
+ void _execute_item_complete(uint64_t expire_to);
+
+ void _go_readonly(int r);
+
+ CephContext *cct;
+ const mds_rank_t rank;
+ ceph::mutex lock = ceph::make_mutex("PurgeQueue");
+ bool readonly = false;
+
+ int64_t metadata_pool;
+
+ // Don't use the MDSDaemon's Finisher and Timer, because this class
+ // operates outside of MDSDaemon::mds_lock
+ Finisher finisher;
+ SafeTimer timer;
+ Filer filer;
+ Objecter *objecter;
+ std::unique_ptr<PerfCounters> logger;
+
+ Journaler journaler;
+
+ Context *on_error;
+
+ // Map of Journaler offset to PurgeItem
+ std::map<uint64_t, PurgeItem> in_flight;
+ std::set<uint64_t> pending_expire;
+
+ // Throttled allowances
+ uint64_t ops_in_flight = 0;
+
+ // Dynamic op limit per MDS based on PG count
+ uint64_t max_purge_ops = 0;
+
+ // How many bytes were remaining when drain() was first called,
+ // used for indicating progress.
+ uint64_t drain_initial = 0;
+
+ // Has drain() ever been called on this instance?
+ bool draining = false;
+
+ // Do we currently have a flush timer event waiting?
+ Context *delayed_flush = nullptr;
+
+ bool recovered = false;
+ std::vector<Context*> waiting_for_recovery;
+
+ size_t purge_item_journal_size;
+};
+#endif