Skip to content

Commit

Permalink
[tests] Support aggregator's leader/follower mode in in-process clust…
Browse files Browse the repository at this point in the history
…er setup (#3925)

This commit enables the aggregators to run with RF=2 in the in-process cluster setup.
  • Loading branch information
fishie9 committed Nov 19, 2021
1 parent 565c655 commit 81a7a7d
Show file tree
Hide file tree
Showing 10 changed files with 316 additions and 72 deletions.
166 changes: 111 additions & 55 deletions src/cluster/generated/proto/placementpb/placement.pb.go

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

1 change: 1 addition & 0 deletions src/cluster/generated/proto/placementpb/placement.proto
Original file line number Diff line number Diff line change
Expand Up @@ -96,5 +96,6 @@ message PlacementSnapshots {

message Options {
google.protobuf.BoolValue is_sharded = 1;
google.protobuf.BoolValue skip_port_mirroring = 2;
// TODO: cover all the fields in src/cluster/placement/config.go
}
8 changes: 8 additions & 0 deletions src/cluster/placement/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ type Configuration struct {
IsSharded *bool `yaml:"isSharded"`
ShardStateMode *ShardStateMode `yaml:"shardStateMode"`
IsMirrored *bool `yaml:"isMirrored"`
SkipPortMirroring *bool `yaml:"skipPortMirroring"`
IsStaged *bool `yaml:"isStaged"`
ValidZone *string `yaml:"validZone"`
}
Expand All @@ -63,6 +64,9 @@ func (c *Configuration) NewOptions() Options {
if value := c.IsMirrored; value != nil {
opts = opts.SetIsMirrored(*value)
}
if value := c.SkipPortMirroring; value != nil {
opts = opts.SetSkipPortMirroring(*value)
}
if value := c.IsStaged; value != nil {
opts = opts.SetIsStaged(*value)
}
Expand Down Expand Up @@ -94,6 +98,10 @@ func (c Configuration) ApplyOverride(opts *placementpb.Options) Configuration {
isShardedValueCopy := opts.IsSharded.Value
c.IsSharded = &isShardedValueCopy
}
if opts.SkipPortMirroring != nil {
skipPortMirroringCopy := opts.SkipPortMirroring.Value
c.SkipPortMirroring = &skipPortMirroringCopy
}
return c
}

Expand Down
10 changes: 10 additions & 0 deletions src/cluster/placement/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ type options struct {
dryrun bool
isSharded bool
isMirrored bool
skipPortMirroring bool
isStaged bool
compress bool
instanceSelector InstanceSelector
Expand Down Expand Up @@ -153,6 +154,15 @@ func (o options) SetIsMirrored(v bool) Options {
return o
}

func (o options) SkipPortMirroring() bool {
return o.skipPortMirroring
}

func (o options) SetSkipPortMirroring(v bool) Options {
o.skipPortMirroring = v
return o
}

func (o options) IsStaged() bool {
return o.isStaged
}
Expand Down
28 changes: 28 additions & 0 deletions src/cluster/placement/placement_mock.go

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

0 comments on commit 81a7a7d

Please sign in to comment.