* @note receiving a transaction in this function gives a fair amount of * freedom to the service implementation if it does need it. It shouldn't. */
| 1546 | * freedom to the service implementation if it does need it. It shouldn't. |
| 1547 | */ |
| 1548 | void OSDMonitor::encode_pending(MonitorDBStore::TransactionRef t) |
| 1549 | { |
| 1550 | dout(10) << "encode_pending e " << pending_inc.epoch |
| 1551 | << dendl; |
| 1552 | |
| 1553 | if (do_prune(t)) { |
| 1554 | dout(1) << __func__ << " osdmap full prune encoded e" |
| 1555 | << pending_inc.epoch << dendl; |
| 1556 | } |
| 1557 | |
| 1558 | // finalize up pending_inc |
| 1559 | pending_inc.modified = ceph_clock_now(); |
| 1560 | |
| 1561 | int r = pending_inc.propagate_base_properties_to_tiers(cct, osdmap); |
| 1562 | ceph_assert(r == 0); |
| 1563 | |
| 1564 | if (mapping_job) { |
| 1565 | if (!mapping_job->is_done()) { |
| 1566 | dout(1) << __func__ << " skipping prime_pg_temp; mapping job " |
| 1567 | << mapping_job.get() << " did not complete, " |
| 1568 | << mapping_job->shards << " left" << dendl; |
| 1569 | mapping_job->abort(); |
| 1570 | } else if (mapping.get_epoch() < osdmap.get_epoch()) { |
| 1571 | dout(1) << __func__ << " skipping prime_pg_temp; mapping job " |
| 1572 | << mapping_job.get() << " is prior epoch " |
| 1573 | << mapping.get_epoch() << dendl; |
| 1574 | } else { |
| 1575 | if (g_conf()->mon_osd_prime_pg_temp) { |
| 1576 | maybe_prime_pg_temp(); |
| 1577 | } |
| 1578 | } |
| 1579 | } else if (g_conf()->mon_osd_prime_pg_temp) { |
| 1580 | dout(1) << __func__ << " skipping prime_pg_temp; mapping job did not start" |
| 1581 | << dendl; |
| 1582 | } |
| 1583 | mapping_job.reset(); |
| 1584 | |
| 1585 | // ensure we don't have blank new_state updates. these are interrpeted as |
| 1586 | // CEPH_OSD_UP (and almost certainly not what we want!). |
| 1587 | auto p = pending_inc.new_state.begin(); |
| 1588 | while (p != pending_inc.new_state.end()) { |
| 1589 | if (p->second == 0) { |
| 1590 | dout(10) << "new_state for osd." << p->first << " is 0, removing" << dendl; |
| 1591 | p = pending_inc.new_state.erase(p); |
| 1592 | } else { |
| 1593 | if (p->second & CEPH_OSD_UP) { |
| 1594 | pending_inc.new_last_up_change = pending_inc.modified; |
| 1595 | } |
| 1596 | ++p; |
| 1597 | } |
| 1598 | } |
| 1599 | if (!pending_inc.new_up_client.empty()) { |
| 1600 | pending_inc.new_last_up_change = pending_inc.modified; |
| 1601 | } |
| 1602 | for (auto& i : pending_inc.new_weight) { |
| 1603 | if (i.first >= osdmap.max_osd) { |
| 1604 | if (i.second) { |
| 1605 | // new osd is already marked in |
nothing calls this directly
no test coverage detected