Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions options.go
Original file line number Diff line number Diff line change
Expand Up @@ -1418,6 +1418,13 @@ type WALFailoverOptions struct {
wal.FailoverOptions
}

func (o *WALFailoverOptions) Validate() error {
if o.Secondary.FS == nil {
return errors.New("Secondary.FS is required")
}
return nil
}

// ReadaheadConfig controls the use of read-ahead.
type ReadaheadConfig = objstorageprovider.ReadaheadConfig

Expand Down Expand Up @@ -2568,6 +2575,12 @@ func (o *Options) Validate() error {
}
}

if o.WALFailover != nil {
if err := o.WALFailover.Validate(); err != nil {
fmt.Fprintf(&buf, "WALFailover validation failed: %v\n", err)
}
}

if buf.Len() == 0 {
return nil
}
Expand Down
8 changes: 8 additions & 0 deletions options_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -547,6 +547,14 @@ func TestOptionsValidate(t *testing.T) {
}
})
}
t.Run("wal-failover", func(t *testing.T) {
var opts Options
opts.EnsureDefaults()
opts.WALFailover = &WALFailoverOptions{}
err := opts.Validate()
require.Error(t, err)
require.Regexp(t, "Secondary.FS is required", err.Error())
})
}

func TestKeyCategories(t *testing.T) {
Expand Down