Skip to content

Commit b416891

Browse files
vgramermjuraga
authored andcommitted
MINOR: global: add experimental shm-stats-file-max-objects option
Signed-off-by: Vincent Gramer <vgramer@haproxy.com>
1 parent c088020 commit b416891

File tree

11 files changed

+53
-2
lines changed

11 files changed

+53
-2
lines changed

config-parser/section-parsers.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -480,6 +480,7 @@ func (p *configParser) getGlobalParser() *Parsers { //nolint: maintidx
480480
addParser(parser, &sequence, &simple.Word{Name: "acme.scheduler"})
481481
addParser(parser, &sequence, &simple.Number{Name: "stress-level"})
482482
addParser(parser, &sequence, &simple.Word{Name: "shm-stats-file"})
483+
addParser(parser, &sequence, &simple.Number{Name: "shm-stats-file-max-objects"})
483484
// the ConfigSnippet must be at the end to parsers load order to ensure
484485
// the overloading of any option has been declared previously
485486
addParser(parser, &sequence, &parsers.ConfigSnippet{})

config-parser/tests/configs/haproxy.cfg.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ global
7474
warn-blocked-traffic-after 50ms
7575
dns-accept-family ipv4,ipv6
7676
shm-stats-file some_file
77+
shm-stats-file-max-objects 100
7778
# random comment before snippet
7879
###_config-snippet_### BEGIN
7980
tune.ssl.default-dh-param 2048

configuration/global.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2331,6 +2331,12 @@ func ParseGlobalSection(p parser.Parser) (*models.Global, error) { //nolint:goco
23312331
}
23322332
global.ShmStatsFile = shmStatsFile
23332333

2334+
shmStatSileMaxObjects, err := parseInt64POption(p, "shm-stats-file-max-objects")
2335+
if err != nil {
2336+
return nil, err
2337+
}
2338+
global.ShmStatsFileMaxObjects = shmStatSileMaxObjects
2339+
23342340
envOptions, err := parseEnvironmentOptions(p)
23352341
if err != nil {
23362342
return nil, err
@@ -3245,6 +3251,10 @@ func SerializeGlobalSection(p parser.Parser, data *models.Global, opt *options.C
32453251
return err
32463252
}
32473253

3254+
if err := serializeInt64POption(p, "shm-stats-file-max-objects", data.ShmStatsFileMaxObjects); err != nil {
3255+
return err
3256+
}
3257+
32483258
if err := serializeStringOption(p, "description", data.Description); err != nil {
32493259
return err
32503260
}

models/global_base.go

Lines changed: 21 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

models/global_base_compare_test.go

Lines changed: 4 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

models/globalbase_diff_generated.go

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

models/globalbase_equal_generated.go

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

specification/build/haproxy_spec.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2545,6 +2545,11 @@ definitions:
25452545
pattern: ^[^\s]+$
25462546
type: string
25472547
x-display-name: Shared Memory Statistics File (EXPERIMENTAL)
2548+
shm_stats_file_max_objects:
2549+
minimum: 0
2550+
type: integer
2551+
x-display-name: Maximum number of objects the shared memory used for shared counters will be able to store per thread group. (EXPERIMENTAL)
2552+
x-nullable: true
25482553
ssl_options:
25492554
$ref: '#/definitions/ssl_options'
25502555
stats_file:

specification/models/configuration/global.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -371,6 +371,11 @@ global_base:
371371
type: string
372372
pattern: '^[^\s]+$'
373373
x-display-name: Shared Memory Statistics File (EXPERIMENTAL)
374+
shm_stats_file_max_objects:
375+
type: integer
376+
minimum: 0
377+
x-nullable: true
378+
x-display-name: Maximum number of objects the shared memory used for shared counters will be able to store per thread group. (EXPERIMENTAL)
374379
environment_options:
375380
$ref: "#/definitions/environment_options"
376381
performance_options:

test/configuration_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -288,6 +288,7 @@ global
288288
ocsp-update.mode on
289289
dns-accept-family ipv4,ipv6
290290
shm-stats-file some_file
291+
shm-stats-file-max-objects 100
291292
warn-blocked-traffic-after 50ms
292293
acme.scheduler off
293294
stress-level 5

0 commit comments

Comments
 (0)