Skip to content

Commit

Permalink
NVMeofGwMon: implement get_trim_to()
Browse files Browse the repository at this point in the history
Signed-off-by: Alexander Indenbaum <[email protected]>
  • Loading branch information
Alexander Indenbaum committed Jul 12, 2024
1 parent 13db198 commit 9ea3798
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/common/options/global.yaml.in
Original file line number Diff line number Diff line change
Expand Up @@ -1755,6 +1755,13 @@ options:
default: 500
services:
- mon
- name: mon_max_nvmeof_epochs
type: int
level: advanced
desc: max number of nvmeof gateway maps to store
default: 500
services:
- mon
- name: mon_max_osd
type: int
level: advanced
Expand Down
10 changes: 10 additions & 0 deletions src/mon/NVMeofGwMon.cc
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,16 @@ const char **NVMeofGwMon::get_tracked_conf_keys() const
return KEYS;
}

version_t NVMeofGwMon::get_trim_to() const
{
// we don't actually need *any* old states, but keep a few.
int64_t max = g_conf().get_val<int64_t>("mon_max_nvmeof_epochs");
if (map.epoch > max) {
return map.epoch - max;
}
return 0;
}

void NVMeofGwMon::create_pending() {

pending_map = map;// deep copy of the object
Expand Down
1 change: 1 addition & 0 deletions src/mon/NVMeofGwMon.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ class NVMeofGwMon: public PaxosService,
void on_restart() override;
void update_from_paxos(bool *need_bootstrap) override;

version_t get_trim_to() const override;

bool preprocess_query(MonOpRequestRef op) override;
bool prepare_update(MonOpRequestRef op) override;
Expand Down

0 comments on commit 9ea3798

Please sign in to comment.