lderr(cct) << "failed to store period " << period.get_id() << dendl;
return;
}
+ // set as latest epoch
+ http_ret = period.update_latest_epoch(period.get_epoch());
+ if (http_ret == -EEXIST) {
+ // already have this epoch (or a more recent one)
+ ldout(cct, 4) << "already have epoch >= " << period.get_epoch()
+ << " for period " << period.get_id() << dendl;
+ http_ret = 0;
+ return;
+ }
+ if (http_ret < 0) {
+ lderr(cct) << "failed to set latest epoch" << dendl;
+ return;
+ }
// decide whether we can set_current_period() or set_latest_epoch()
if (period.get_id() != current_period.get_id()) {
realm.notify_new_period(period);
return;
}
-
- if (period.get_epoch() <= current_period.get_epoch()) {
- lderr(cct) << "period epoch " << period.get_epoch() << " is not newer "
- "than current epoch " << current_period.get_epoch()
- << ", discarding update" << dendl;
- return;
- }
- // set as latest epoch
- http_ret = period.set_latest_epoch(period.get_epoch());
- if (http_ret < 0) {
- lderr(cct) << "failed to set latest epoch" << dendl;
- return;
- }
// reflect the period into our local objects
- http_ret = period.reflect();
- if (http_ret < 0) {
+ http_ret = period.reflect();
+ if (http_ret < 0) {
lderr(cct) << "failed to update local objects: "
<< cpp_strerror(-http_ret) << dendl;
return;