Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[POC] Add Robustness test to reproduce issue 18089 #19169

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft
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
6 changes: 6 additions & 0 deletions tests/robustness/makefile.mk
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,11 @@ test-robustness-issue17780: /tmp/etcd-v3.5.13-compactBeforeSetFinishedCompact/bi
GO_TEST_FLAGS='-v --run=TestRobustnessRegression/Issue17780 --count 200 --failfast --bin-dir=/tmp/etcd-v3.5.13-compactBeforeSetFinishedCompact/bin' make test-robustness && \
echo "Failed to reproduce" || echo "Successful reproduction"

.PHONY: test-robustness-issue18089
test-robustness-issue18089: /tmp/etcd-v3.5.15-failpoints/bin
GO_TEST_FLAGS='-v --run=TestRobustnessRegression/Issue18089 --count 100 --failfast --bin-dir=/tmp/etcd-v3.5.15-failpoints/bin' make test-robustness && \
echo "Failed to reproduce" || echo "Successful reproduction"

# Failpoints

GOPATH = $(shell go env GOPATH)
Expand Down Expand Up @@ -97,6 +102,7 @@ $(GOPATH)/bin/gofail: tools/mod/go.mod tools/mod/go.sum
/tmp/etcd-v3.5.2-failpoints/bin:
/tmp/etcd-v3.5.4-failpoints/bin:
/tmp/etcd-v3.5.5-failpoints/bin:
/tmp/etcd-v3.5.15-failpoints/bin:
/tmp/etcd-v3.5.%-failpoints/bin: $(GOPATH)/bin/gofail
rm -rf /tmp/etcd-v3.5.$*-failpoints/
mkdir -p /tmp/etcd-v3.5.$*-failpoints/
Expand Down
12 changes: 12 additions & 0 deletions tests/robustness/scenarios/scenarios.go
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,18 @@ func Regression(t *testing.T) []TestScenario {
e2e.WithGoFailEnabled(true),
),
})
scenarios = append(scenarios, TestScenario{
Name: "Issue18089",
Profile: traffic.LowTraffic,
Failpoint: failpoint.RaftBeforeLeaderSendPanic,
Traffic: traffic.Kubernetes,
Cluster: *e2e.NewConfig(
e2e.WithClusterSize(1),
e2e.WithCompactionBatchLimit(300),
e2e.WithSnapshotCount(1000),
e2e.WithGoFailEnabled(true),
),
})
if v.Compare(version.V3_5) >= 0 {
opts := []e2e.EPClusterOption{
e2e.WithSnapshotCount(100),
Expand Down
21 changes: 7 additions & 14 deletions tests/robustness/traffic/etcd.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,17 +36,11 @@ var (
largePutSize: 32769,
// Please keep the sum of weights equal 100.
requests: []random.ChoiceWeight[etcdRequestType]{
{Choice: Get, Weight: 15},
{Choice: List, Weight: 15},
{Choice: StaleGet, Weight: 10},
{Choice: StaleList, Weight: 10},
{Choice: Delete, Weight: 5},
{Choice: MultiOpTxn, Weight: 5},
{Choice: PutWithLease, Weight: 5},
{Choice: LeaseRevoke, Weight: 5},
{Choice: CompareAndSet, Weight: 5},
{Choice: Put, Weight: 20},
{Choice: LargePut, Weight: 5},
{Choice: Get, Weight: 5},
{Choice: List, Weight: 5},
{Choice: Delete, Weight: 30},
{Choice: Put, Weight: 30},
{Choice: CompareAndSet, Weight: 20},
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will add a new type of Traffic for high Delete traffic

},
}
EtcdPut Traffic = etcdTraffic{
Expand All @@ -55,10 +49,9 @@ var (
leaseTTL: DefaultLeaseTTL,
// Please keep the sum of weights equal 100.
requests: []random.ChoiceWeight[etcdRequestType]{
{Choice: Get, Weight: 15},
{Choice: Get, Weight: 5},
{Choice: List, Weight: 15},
{Choice: StaleGet, Weight: 10},
{Choice: StaleList, Weight: 10},
{Choice: Delete, Weight: 30},
{Choice: MultiOpTxn, Weight: 5},
{Choice: LargePut, Weight: 5},
{Choice: Put, Weight: 40},
Expand Down
4 changes: 2 additions & 2 deletions tests/robustness/traffic/traffic.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ var (
RequestTimeout = 200 * time.Millisecond
WatchTimeout = time.Second
MultiOpTxnOpCount = 4
CompactionPeriod = 200 * time.Millisecond
CompactionPeriod = 20 * time.Millisecond
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will refactor this to be controlled by traffic parameter in a formal PR.


LowTraffic = Profile{
MinimalQPS: 100,
Expand Down Expand Up @@ -208,7 +208,7 @@ func RunCompactLoop(ctx context.Context, c *client.RecordingClient, period time.
}

// Range allows for both revision has been compacted and future revision errors
compactRev := random.RandRange(lastRev, resp.Header.Revision+5)
compactRev := random.RandRange(lastRev, resp.Header.Revision)
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will refactor this to be controlled by traffic parameter in a formal PR.

_, err = c.Compact(ctx, compactRev)
if err != nil {
continue
Expand Down