Some old clusters have an empty created timestamp. This is mostly
harmless, but it is confusing/wrong, and it does currently break the
telemetry module with errors like
ValueError: time data '0.000000' does not match format '%Y-%m-%d %H:%M:%S.%f'
from 'ceph telemetry show'.
If we detect an empty created stamp, look at old monmap and use the oldest
modified stamp we can find.
Fixes: http://tracker.ceph.com/issues/39085
Signed-off-by: Sage Weil <sage@redhat.com>
(cherry picked from commit
3046d17f61d1fa11fe2f35f7cfe9428312a78593)
}
}
}
+
+void MonmapMonitor::tick()
+{
+ if (!is_active() ||
+ !mon->is_leader()) {
+ return;
+ }
+
+ if (mon->monmap->created.is_zero()) {
+ dout(10) << __func__ << " detected empty created stamp" << dendl;
+ utime_t ctime;
+ for (version_t v = 1; v <= get_last_committed(); v++) {
+ bufferlist bl;
+ int r = get_version(v, bl);
+ if (r < 0) {
+ continue;
+ }
+ MonMap m;
+ auto p = bl.cbegin();
+ decode(m, p);
+ if (!m.last_changed.is_zero()) {
+ dout(10) << __func__ << " first monmap with last_changed is "
+ << v << " with " << m.last_changed << dendl;
+ ctime = m.last_changed;
+ break;
+ }
+ }
+ if (ctime.is_zero()) {
+ ctime = ceph_clock_now();
+ }
+ dout(10) << __func__ << " updating created stamp to " << ctime << dendl;
+ pending_map.created = ctime;
+ propose_pending();
+ }
+}
void check_sub(Subscription *sub);
+ void tick() override;
+
private:
void check_subs();
bufferlist monmap_bl;