-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
100979: asim: extend datadriven test to support recovery r=kvoli a=kvoli Previously, only rebalancing was supported in the data driven simulation test. This commit extends the syntax to support recovery scenarios. As part of the extension, the state generator is split into range generation and cluster generation. Examples are added for each command, along with common testing scenarios such as decommissioning, IO overload, disk fullness and adding a node (with a store). The newly supported commands are listed below: ``` - "load_cluster": config=<name> Load a defined cluster configuration to be the generated cluster in the simulation. The available confiurations are: single_region: 15 nodes in region=US, 5 in each zone US_1/US_2/US_3. single_region_multi_store: 3 nodes, 5 stores per node with the same zone/region configuration as above. multi_region: 36 nodes, 12 in each region and 4 in each zone, regions having 3 zones. complex: 28 nodes, 3 regions with a skewed number of nodes per region. - "gen_ranges" [ranges=<int>] [placement_skew=<bool>] [repl_factor=<int>] [keyspace=<int>] [range_bytes=<int>] Initialize the range generator parameters. On the next call to eval, the range generator is called to assign an ranges and their replica placement. The default values are ranges=1 repl_factor=3 placement_skew=false keyspace=10000. - set_liveness node=<int> [delay=<duration>] status=(dead|decommissioning|draining|unavailable) Set the liveness status of the node with ID NodeID. This applies at the start of the simulation or with some delay after the simulation starts, if specified. - add_node: [stores=<int>] [locality=<string>] [delay=<duration>] Add a node to the cluster after initial generation with some delay, locality and number of stores on the node. The default values are stores=0 locality=none delay=0. - set_span_config [delay=<duration>] [startKey, endKey): <span_config> Provide a new line separated list of spans and span configurations e.g. [0,100): num_replicas=5 num_voters=3 constraints={'+region=US_East'} [100, 500): num_replicas=3 ... This will update the span config for the span [0,100) to specify 3 voting replicas and 2 non-voting replicas, with a constraint that all replicas are in the region US_East. - assertion extended to support two new assertion types: For type=stat assertions, if the stat (e.g. stat=replicas) value of the last ticks (e.g. ticks=5) duration is not exactly equal to threshold, the assertion fails. This applies for a specified store which must be provided with store=storeID. For type=conformance assertions, you may assert on the number of replicas that you expect to be under-replicated(under), over-replicated(over), unavailable(unavailable) and violating constraints(violating) at the end of the evaluation. - "topology" [sample=<int>] Print the cluster locality topology of the sample given (default=last). e.g. for the load_cluster config=single_region US ..US_1 ....└── [1 2 3 4 5] ..US_2 ....└── [6 7 8 9 10] ..US_3 ....└── [11 12 13 14 15] ``` Informs: #90137 Release note: None Co-authored-by: Austen McClernon <[email protected]>
- Loading branch information
Showing
29 changed files
with
1,464 additions
and
148 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
load("@io_bazel_rules_go//go:def.bzl", "go_library") | ||
|
||
go_library( | ||
name = "event", | ||
srcs = ["delayed_event.go"], | ||
importpath = "github.com/cockroachdb/cockroach/pkg/kv/kvserver/asim/event", | ||
visibility = ["//visibility:public"], | ||
deps = ["//pkg/kv/kvserver/asim/state"], | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
// Copyright 2023 The Cockroach Authors. | ||
// | ||
// Use of this software is governed by the Business Source License | ||
// included in the file licenses/BSL.txt. | ||
// | ||
// As of the Change Date specified in that file, in accordance with | ||
// the Business Source License, use of this software will be governed | ||
// by the Apache License, Version 2.0, included in the file | ||
// licenses/APL.txt. | ||
|
||
package event | ||
|
||
import ( | ||
"context" | ||
"time" | ||
|
||
"github.com/cockroachdb/cockroach/pkg/kv/kvserver/asim/state" | ||
) | ||
|
||
type DelayedEventList []DelayedEvent | ||
|
||
// Len implements sort.Interface. | ||
func (del DelayedEventList) Len() int { return len(del) } | ||
|
||
// Less implements sort.Interface. | ||
func (del DelayedEventList) Less(i, j int) bool { | ||
return del[i].At.Before(del[j].At) | ||
} | ||
|
||
// Swap implements sort.Interface. | ||
func (del DelayedEventList) Swap(i, j int) { | ||
del[i], del[j] = del[j], del[i] | ||
} | ||
|
||
type DelayedEvent struct { | ||
At time.Time | ||
EventFn func(context.Context, time.Time, state.State) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.