Skip to content

Commit

Permalink
add toggle to disable confdata soft OOM degradation mode (#966)
Browse files Browse the repository at this point in the history
  • Loading branch information
DrDet authored Feb 9, 2024
1 parent c86f44a commit d898b74
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
4 changes: 4 additions & 0 deletions server/confdata-binlog-replay.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -851,6 +851,10 @@ void set_confdata_soft_oom_ratio(double soft_oom_ratio) noexcept {
confdata_settings.soft_oom_threshold_ratio = soft_oom_ratio;
}

void set_confdata_hard_oom_ratio(double hard_oom_ratio) noexcept {
confdata_settings.hard_oom_threshold_ratio = hard_oom_ratio;
}

void set_confdata_binlog_mask(const char *mask) noexcept {
confdata_settings.binlog_mask = mask;
}
Expand Down
1 change: 1 addition & 0 deletions server/confdata-binlog-replay.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ static constexpr double CONFDATA_DEFAULT_SOFT_OOM_RATIO = 0.85;
static constexpr double CONFDATA_DEFAULT_HARD_OOM_RATIO = 0.95;

void set_confdata_soft_oom_ratio(double soft_oom_ratio) noexcept;
void set_confdata_hard_oom_ratio(double hard_oom_ratio) noexcept;
void set_confdata_binlog_mask(const char *mask) noexcept;

void set_confdata_memory_limit(size_t memory_limit) noexcept;
Expand Down
10 changes: 8 additions & 2 deletions server/php-engine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2227,8 +2227,14 @@ int main_args_handler(int i, const char *long_option) {
}
case 2039: {
double soft_oom_ratio;
int res = read_option_to(long_option, 0.0, CONFDATA_DEFAULT_HARD_OOM_RATIO, soft_oom_ratio);
set_confdata_soft_oom_ratio(soft_oom_ratio);
int res = read_option_to(long_option, 0.0, 1.0, soft_oom_ratio);
if (soft_oom_ratio < CONFDATA_DEFAULT_HARD_OOM_RATIO) {
set_confdata_soft_oom_ratio(soft_oom_ratio);
} else {
kprintf("Confdata soft OOM degradation mode disabled\n");
set_confdata_soft_oom_ratio(1.0);
set_confdata_hard_oom_ratio(1.0);
}
return res;
}
default:
Expand Down

0 comments on commit d898b74

Please sign in to comment.