| 677 | } |
| 678 | |
| 679 | int open(std::ostream &out) { |
| 680 | std::string kv_type; |
| 681 | int r = read_meta("kv_backend", &kv_type); |
| 682 | if (r < 0 || kv_type.empty()) { |
| 683 | // assume old monitors that did not mark the type were RocksDB. |
| 684 | kv_type = "rocksdb"; |
| 685 | r = write_meta("kv_backend", kv_type); |
| 686 | if (r < 0) |
| 687 | return r; |
| 688 | } |
| 689 | _open(kv_type); |
| 690 | r = db->open(out); |
| 691 | if (r < 0) |
| 692 | return r; |
| 693 | |
| 694 | // Monitors are few in number, so the resource cost of exposing |
| 695 | // very detailed stats is low: ramp up the priority of all the |
| 696 | // KV store's perf counters. Do this after open, because backend may |
| 697 | // not have constructed PerfCounters earlier. |
| 698 | if (db->get_perf_counters()) { |
| 699 | db->get_perf_counters()->set_prio_adjust( |
| 700 | PerfCountersBuilder::PRIO_USEFUL - PerfCountersBuilder::PRIO_DEBUGONLY); |
| 701 | } |
| 702 | |
| 703 | io_work.start(); |
| 704 | is_open = true; |
| 705 | return 0; |
| 706 | } |
| 707 | |
| 708 | int create_and_open(std::ostream &out) { |
| 709 | int r = write_meta("ceph_version_when_created", pretty_version_to_str()); |
no test coverage detected