Skip to content

Commit

Permalink
MINOR: global: add tune.events.max-events-at-once
Browse files Browse the repository at this point in the history
Signed-off-by: Vincent Gramer <[email protected]>
  • Loading branch information
vgramer committed Dec 1, 2023
1 parent d5ea77b commit 00042dc
Show file tree
Hide file tree
Showing 8 changed files with 59 additions and 2 deletions.
1 change: 1 addition & 0 deletions configuration/configuration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ global
tune.bufsize 13
tune.comp.maxlevel 14
tune.disable-zero-copy-forwarding
tune.events.max-events-at-once 10
tune.fail-alloc
tune.fd.edge-triggered on
tune.h2.header-table-size 15
Expand Down
9 changes: 9 additions & 0 deletions configuration/global.go
Original file line number Diff line number Diff line change
Expand Up @@ -2358,6 +2358,9 @@ func serializeTuneOptions(p parser.Parser, options *models.GlobalTuneOptions) er
if err := serializeBoolOption(p, "tune.disable-zero-copy-forwarding", options.DisableZeroCopyForwarding); err != nil {
return err
}
if err := serializeInt64Option(p, "tune.events.max-events-at-once", options.EventsMaxEventsAtOnce); err != nil {
return err
}
if err := serializeBoolOption(p, "tune.fail-alloc", options.FailAlloc); err != nil {
return err
}
Expand Down Expand Up @@ -2757,6 +2760,12 @@ func parseTuneOptions(p parser.Parser) (*models.GlobalTuneOptions, error) { //no
}
options.DisableZeroCopyForwarding = boolOption

intOption, err = parseInt64Option(p, "tune.events.max-events-at-once")
if err != nil {
return nil, err
}
options.EventsMaxEventsAtOnce = intOption

boolOption, err = parseBoolOption(p, "tune.fail-alloc")
if err != nil {
return nil, err
Expand Down
4 changes: 4 additions & 0 deletions configuration/global_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,9 @@ func TestGetGlobal(t *testing.T) {
if !global.TuneOptions.DisableZeroCopyForwarding {
t.Errorf("DisableZeroCopyForwarding is %v, expected true", global.TuneOptions.DisableZeroCopyForwarding)
}
if global.TuneOptions.EventsMaxEventsAtOnce != 10 {
t.Errorf("TuneOptions.EventsMaxEventsAtOnce is %v, expected 10", global.TuneOptions.EventsMaxEventsAtOnce)
}
if global.TuneOptions.H2HeaderTableSize != 15 {
t.Errorf("H2HeaderTableSize is %v, expected 15", global.TuneOptions.H2HeaderTableSize)
}
Expand Down Expand Up @@ -727,6 +730,7 @@ func TestPutGlobal(t *testing.T) {
},
TuneOptions: &models.GlobalTuneOptions{
DisableZeroCopyForwarding: true,
EventsMaxEventsAtOnce: 50,
LuaLogLoggers: "disabled",
LuaLogStderr: "disabled",
MaxChecksPerThread: misc.Int64P(20),
Expand Down
25 changes: 25 additions & 0 deletions models/global.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions models/global_compare.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 4 additions & 2 deletions models/global_compare_test.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions specification/build/haproxy_spec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1590,6 +1590,10 @@ definitions:
disable_zero_copy_forwarding:
type: boolean
x-display-name: Disable zero-copy forwarding
events_max_events_at_once:
maximum: 10000
minimum: 1
type: integer
fail_alloc:
type: boolean
x-display-name: Failed Allocation Chance
Expand Down
4 changes: 4 additions & 0 deletions specification/models/configuration/global.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,10 @@ global:
disable_zero_copy_forwarding:
type: boolean
x-display-name: Disable zero-copy forwarding
events_max_events_at_once:
type: integer
minimum: 1
maximum: 10000
fail_alloc:
type: boolean
x-display-name: Failed Allocation Chance
Expand Down

0 comments on commit 00042dc

Please sign in to comment.