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

rsm: proposal for refactoring #316

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
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
4 changes: 2 additions & 2 deletions .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ on:
name: Nightly
jobs:
monkey-test:
runs-on: ubuntu-20.04
runs-on: ubuntu-latest
strategy:
matrix:
target: [race-monkey-test, race-ondisk-monkey-test, memfs-monkey-test, memfs-ondisk-monkey-test]
steps:
- name: Install Go
uses: actions/setup-go@v3
uses: actions/setup-go@v4
with:
go-version: 1.19.x
- name: Test
Expand Down
81 changes: 35 additions & 46 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,80 +2,69 @@ on: [push, pull_request]
name: Test
jobs:
unit-test:
runs-on: ubuntu-18.04
runs-on: ubuntu-latest
steps:
- name: Install Go
uses: actions/setup-go@v3
with:
go-version: 1.19.x
- name: Checkout code
uses: actions/checkout@v3
- name: Install Go
uses: actions/setup-go@v4
with:
go-version-file: go.mod
- name: Test
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
run: |
make actions-test
bash <(curl -s https://codecov.io/bash) -t $CODECOV_TOKEN
race-unit-test:
runs-on: ubuntu-18.04
runs-on: ubuntu-latest
steps:
- name: Install Go
uses: actions/setup-go@v3
with:
go-version: 1.19.x
- name: Checkout code
uses: actions/checkout@v3
- name: Install Go
uses: actions/setup-go@v4
with:
go-version-file: go.mod
- name: Test
run: RACE=1 make test
memfs-unit-test:
runs-on: ubuntu-18.04
runs-on: ubuntu-latest
steps:
- name: Install Go
uses: actions/setup-go@v3
with:
go-version: 1.19.x
- name: Checkout code
uses: actions/checkout@v3
- name: Test
run: MEMFS_TEST=1 make test
go1-18-unit-test:
runs-on: ubuntu-18.04
steps:
- name: Install Go
uses: actions/setup-go@v3
uses: actions/setup-go@v4
with:
go-version: 1.18.x
- name: Checkout code
uses: actions/checkout@v3
go-version-file: go.mod
- name: Test
run: make test
run: MEMFS_TEST=1 make test
macos-unit-test:
runs-on: macos-latest
steps:
- name: Install Go
uses: actions/setup-go@v3
with:
go-version: 1.19.x
- name: Checkout code
uses: actions/checkout@v3
- name: Install Go
uses: actions/setup-go@v4
with:
go-version-file: go.mod
- name: Test
run: make test
build-tools:
runs-on: ubuntu-18.04
runs-on: ubuntu-latest
steps:
- name: Install Go
uses: actions/setup-go@v3
with:
go-version: 1.19.x
- name: Checkout code
uses: actions/checkout@v3
- name: Install Go
uses: actions/setup-go@v4
with:
go-version-file: go.mod
- name: Build
run: make tools
build-examples:
runs-on: ubuntu-20.04
runs-on: ubuntu-latest
steps:
- name: Install Go
uses: actions/setup-go@v3
uses: actions/setup-go@v4
with:
go-version: 1.19.x
- name: Build
Expand All @@ -85,15 +74,15 @@ jobs:
GOPROXY=direct go get github.com/lni/dragonboat/v4@master
make
static-check:
runs-on: ubuntu-18.04
steps:
- name: Install Go
uses: actions/setup-go@v3
with:
go-version: 1.19.x
- name: Checkout code
uses: actions/checkout@v3
- name: Static check
run: |
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Install Go
uses: actions/setup-go@v4
with:
go-version-file: go.mod
- name: Static check
run: |
make install-static-check-tools
make static-check
20 changes: 0 additions & 20 deletions benchmark_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -526,26 +526,6 @@ func BenchmarkLookup(b *testing.B) {
}
}

func BenchmarkNALookup(b *testing.B) {
b.ReportAllocs()
b.StopTimer()
ds := &tests.NoOP{}
done := make(chan struct{})
config := config.Config{ShardID: 1, ReplicaID: 1}
nds := rsm.NewNativeSM(config, rsm.NewInMemStateMachine(ds), done)
input := make([]byte, 1)
b.StartTimer()
for i := 0; i < b.N; i++ {
result, err := nds.NALookup(input)
if err != nil {
b.Fatalf("lookup failed %v", err)
}
if len(result) != 1 {
b.Fatalf("unexpected result")
}
}
}

func benchmarkStateMachineStep(b *testing.B, sz int, noopSession bool) {
b.ReportAllocs()
b.StopTimer()
Expand Down
8 changes: 4 additions & 4 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ require (
github.com/pierrec/lz4/v4 v4.1.14
github.com/stretchr/testify v1.7.0
golang.org/x/exp v0.0.0-20200513190911-00229845015e
golang.org/x/sys v0.3.0
golang.org/x/sys v0.9.0
)

require (
Expand Down Expand Up @@ -42,9 +42,9 @@ require (
github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529 // indirect
github.com/valyala/fastrand v1.1.0 // indirect
github.com/valyala/histogram v1.2.0 // indirect
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519 // indirect
golang.org/x/net v0.0.0-20211008194852-3b03d305991f // indirect
golang.org/x/crypto v0.10.0 // indirect
golang.org/x/net v0.11.0 // indirect
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect
)

go 1.17
go 1.19
Loading