services:
- cephfs-mirror
min: 1
+- name: cephfs_mirror_tick_interval
+ type: secs
+ level: advanced
+ desc: interval for the per-peer mirroring tick thread
+ long_desc: interval in seconds for the per-peer tick thread that runs periodic
+ mirroring work. The value is re-read each iteration so configuration changes
+ take effect without restarting the daemon.
+ default: 5
+ services:
+ - cephfs-mirror
+ min: 1
- name: cephfs_mirror_max_consecutive_failures_per_directory
type: uint
level: advanced
data_replayer->create(name.c_str());
m_data_replayers.push_back(std::move(data_replayer));
}
+
+ m_tick_thread.reset(new TickThread(this));
+ m_tick_thread->create("tick");
+
+ set_changed_mirroring_configurations();
+
return 0;
}
}
m_replayers.clear();
+ if (m_tick_thread) {
+ m_tick_thread->join();
+ m_tick_thread.reset();
+ }
+
ceph_unmount(m_remote_mount);
ceph_release(m_remote_mount);
m_remote_mount = nullptr;
return r;
}
+void PeerReplayer::run_tick() {
+ dout(10) << ": started" << dendl;
+
+ std::unique_lock locker(m_lock);
+ while (true) {
+ auto interval = g_ceph_context->_conf.get_val<std::chrono::seconds>(
+ "cephfs_mirror_tick_interval");
+ m_cond.wait_for(locker, interval, [this]{return is_stopping();});
+ if (is_stopping()) {
+ dout(5) << ": shutting down exiting" << dendl;
+ break;
+ }
+ }
+}
+
void PeerReplayer::run(SnapshotReplayerThread *replayer) {
dout(10) << ": snapshot replayer=" << replayer << dendl;
PeerReplayer *m_peer_replayer;
};
+ class TickThread : public Thread {
+ public:
+ explicit TickThread(PeerReplayer *peer_replayer)
+ : m_peer_replayer(peer_replayer) {
+ }
+
+ void *entry() override {
+ m_peer_replayer->run_tick();
+ return 0;
+ }
+
+ private:
+ PeerReplayer *m_peer_replayer;
+ };
+
struct DirRegistry {
int fd;
bool canceled = false;
SnapshotReplayers m_replayers;
SnapshotDataReplayers m_data_replayers;
+ std::unique_ptr<TickThread> m_tick_thread;
std::atomic<int> m_active_datasync_threads{0};
ceph::mutex smq_lock;
void run(SnapshotReplayerThread *replayer);
void run_datasync(SnapshotDataSyncThread *data_replayer);
+ void run_tick();
void remove_syncm(const std::shared_ptr<SyncMechanism>& syncm_obj);
bool is_syncm_active(const std::shared_ptr<SyncMechanism>& syncm_obj);
std::shared_ptr<SyncMechanism> pick_next_syncm_and_mark();