Skip to content

Commit

Permalink
Snapshots now created concurrently
Browse files Browse the repository at this point in the history
By default it uses the number of CPUs as concurrency limit and it can be
changed in config:

```yaml
jobs:
  - name: "zroot-to-zdisk"
    snapshotting:
type: "periodic"
concurrency: 1
```
  • Loading branch information
dsh2dsh committed Jan 21, 2025
1 parent bb54a46 commit de26680
Show file tree
Hide file tree
Showing 6 changed files with 294 additions and 198 deletions.
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -590,6 +590,19 @@ pkg install zrepl-dsh2dsh

See also zrepl/zrepl#403

* Snapshots now created concurrently.

By default it uses the number of CPUs as concurrency limit and it can be
changed in config:

```yaml
jobs:
- name: "zroot-to-zdisk"
snapshotting:
type: "periodic"
concurrency: 1
```

## Upstream user documentation

**User Documentation** can be found at
Expand Down
1 change: 1 addition & 0 deletions internal/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -342,6 +342,7 @@ type SnapshottingPeriodic struct {
Hooks []HookCommand `yaml:"hooks" validate:"dive"`
TimestampFormat string `yaml:"timestamp_format" default:"dense" validate:"required"`
TimestampLocal bool `yaml:"timestamp_local" default:"true"`
Concurrency uint `yaml:"concurrency"`
}

func (self *SnapshottingPeriodic) CronSpec() string {
Expand Down
6 changes: 4 additions & 2 deletions internal/daemon/hooks/hook_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ import (
"github.com/dsh2dsh/zrepl/internal/zfs"
)

type List []*CommandHook

func ListFromConfig(in []config.HookCommand) (List, error) {
hl := make(List, len(in))
for i, h := range in {
Expand All @@ -21,6 +19,10 @@ func ListFromConfig(in []config.HookCommand) (List, error) {
return hl, nil
}

type List []*CommandHook

func (self List) Slice() []*CommandHook { return []*CommandHook(self) }

func (self List) WithCombinedOutput() List {
for _, h := range self {
h.WithCombinedOutput()
Expand Down
Loading

0 comments on commit de26680

Please sign in to comment.