Skip to content

Commit 45c7e18

Browse files
committed
Add api for bootstrap
Summary: This diff downgrades packages to comply with CrDB and also adds a Bootstrap api that CrDB can call during init for initialization. Test Plan: - make test - make acceptance - http://phab-jenkins-beta.rubrik-lab.com/job/Build_Kronos/100135/ Reviewers: jj Reviewed By: jj Subscribers: jenkins.bot, jj JIRA Issues: CDM-450261, PHAB-6730 Differential Revision: https://phabricator.rubrik.com/D337578
1 parent d14c1ca commit 45c7e18

30 files changed

+142
-444
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ gofail:
2626

2727
# Run these tests serially to avoid port conflicts.
2828
acceptance: install_with_failpoints goreman getaddrinfo
29-
PATH=$(shell $(GO) env GOPATH)/bin:$(PATH) PROXY_AWARE_RESOLVER=$(PWD)/getaddrinfo.so $(GO) test -p 1 -v ./acceptance/... --tags=acceptance --timeout 30m
29+
PATH=$(shell $(GO) env GOPATH)/bin:$(PATH) PROXY_AWARE_RESOLVER=$(PWD)/getaddrinfo.so $(GO) test -p 1 -v ./acceptance/... --tags=acceptance --timeout 60m
3030
$(shell $(GO) env GOPATH)/bin/gofail disable ./oracle
3131
./acceptance/run_upgrade_test.sh b9.1 $(shell $(GIT) rev-parse --abbrev-ref HEAD)
3232

acceptance/sanity_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1014,6 +1014,7 @@ func TestDoNotUseSeedsBeyondBootstrap(t *testing.T) {
10141014
stopNode(0)
10151015
stopNode(1)
10161016
// add back again
1017+
time.Sleep(kronosStabilizationBufferTime)
10171018
nodeId := addNode(3)
10181019
time.Sleep(kronosStabilizationBufferTime)
10191020
removeNode(3)

go.mod

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@ require (
66
github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f
77
github.com/gogo/protobuf v1.3.2
88
github.com/pkg/errors v0.9.1
9-
github.com/rubrikinc/failure-test-utils v0.0.0-20240617184314-d8206e413175
9+
github.com/rubrikinc/failure-test-utils v0.0.0-20240831074746-82dbc141e899
1010
github.com/spf13/afero v1.1.2
1111
github.com/spf13/cobra v1.1.1
1212
github.com/stretchr/testify v1.8.4
13-
go.uber.org/atomic v1.10.0
13+
go.uber.org/atomic v1.9.0 // CrDB 22.2 doesn't play well with v1.10.0 due to lack of generics in go 1.19
1414
golang.org/x/sync v0.0.0-20220513210516-0976fa681c29
1515
google.golang.org/grpc v1.32.0
1616
)

go.sum

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -253,8 +253,8 @@ github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40T
253253
github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg=
254254
github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ=
255255
github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4=
256-
github.com/rubrikinc/failure-test-utils v0.0.0-20240617184314-d8206e413175 h1:qbad6/9sVUzfyCDLUta1j+2vOdGwrVt1n0m4soNL3tI=
257-
github.com/rubrikinc/failure-test-utils v0.0.0-20240617184314-d8206e413175/go.mod h1:bUFEMAffg3+HUC5mmgd5ZfKQ64794R3666HJXL4eYvU=
256+
github.com/rubrikinc/failure-test-utils v0.0.0-20240831074746-82dbc141e899 h1:ovn7YYf2u5CFxSMJJcJs67ejCQq3lbLLoXVPYvZpMpo=
257+
github.com/rubrikinc/failure-test-utils v0.0.0-20240831074746-82dbc141e899/go.mod h1:U0fJoQqV371twiNJbhM0LIFGyCvI6grvRyq3HwSaCRc=
258258
github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
259259
github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts=
260260
github.com/sasha-s/go-deadlock v0.2.0 h1:lMqc+fUb7RrFS3gQLtoQsJ7/6TV/pAIFvBsqX73DK8Y=
@@ -312,8 +312,8 @@ go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8=
312312
go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE=
313313
go.uber.org/atomic v1.6.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ=
314314
go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc=
315-
go.uber.org/atomic v1.10.0 h1:9qC72Qh0+3MqyJbAn8YU5xVq1frD8bn3JtD2oXtafVQ=
316-
go.uber.org/atomic v1.10.0/go.mod h1:LUxbIzbOniOlMKjJjyPfpl4v+PKK2cNJn91OQbhoJI0=
315+
go.uber.org/atomic v1.9.0 h1:ECmE8Bn/WFTYwEW/bpKD3M8VtR/zQVbavAoalC1PYyE=
316+
go.uber.org/atomic v1.9.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc=
317317
go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0=
318318
go.uber.org/multierr v1.5.0/go.mod h1:FeouvMocqHpRaaGuG9EjoKcStLC43Zu/fmqdUMPcKYU=
319319
go.uber.org/multierr v1.6.0 h1:y6IPFStTAIT5Ytl7/XYmHvzXQ7S3g/IeZW9hyZ5thw4=

gossip/gossip.go

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ var (
2020
nodeDescriptorPeriod = 1 * time.Second
2121
livenessPeriod = 1 * time.Second
2222
gossipPeriod = time.Second
23-
printGossipPeriod = time.Second
23+
printGossipPeriod = 1 * time.Minute
2424
delimiter = "-"
2525
)
2626

@@ -32,6 +32,22 @@ const (
3232
type PrefixKey string
3333
type GossipKey string
3434

35+
func SetGossipPeriod(period time.Duration) {
36+
gossipPeriod = period
37+
}
38+
39+
func SetNodeDescriptorPeriod(period time.Duration) {
40+
nodeDescriptorPeriod = period
41+
}
42+
43+
func SetLivenessPeriod(period time.Duration) {
44+
livenessPeriod = period
45+
}
46+
47+
func SetPrintGossipPeriod(period time.Duration) {
48+
printGossipPeriod = period
49+
}
50+
3551
func (p PrefixKey) String() string {
3652
return string(p)
3753
}
@@ -502,5 +518,5 @@ func (g *Server) GetNodeDesc(id string) *kronospb.NodeDescriptor {
502518

503519
func IsNodeLive(desc *kronospb.NodeDescriptor) bool {
504520
return desc != nil && desc.IsRemoved == false && desc.
505-
LastHeartbeat > time.Now().Add(-10*nodeDescriptorPeriod).UnixNano()
521+
LastHeartbeat > time.Now().Add(-5*nodeDescriptorPeriod).UnixNano()
506522
}

time.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import (
99
"github.com/rubrikinc/kronos/kronoshttp"
1010
"github.com/rubrikinc/kronos/kronosstats"
1111
"github.com/rubrikinc/kronos/kronosutil/log"
12+
kronospb "github.com/rubrikinc/kronos/pb"
1213
"github.com/rubrikinc/kronos/server"
1314
)
1415

@@ -180,3 +181,13 @@ func GetTime(timeout time.Duration) (int64, error) {
180181
return 0, errors.New(fmt.Sprintf(
181182
"Couldn't get kronos time within timeout - %v", timeout))
182183
}
184+
185+
func Bootstrap(ctx context.Context, expectedNodeCount int32) error {
186+
if kronosServer == nil {
187+
return errors.New("kronos server is not initialized")
188+
}
189+
_, err := kronosServer.Bootstrap(ctx, &kronospb.BootstrapRequest{
190+
ExpectedNodeCount: expectedNodeCount,
191+
})
192+
return err
193+
}

vendor/github.com/rubrikinc/failure-test-utils/tcpproxy/tcpproxy.go

Lines changed: 60 additions & 16 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/go.uber.org/atomic/CHANGELOG.md

Lines changed: 0 additions & 17 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/go.uber.org/atomic/bool.go

Lines changed: 2 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/go.uber.org/atomic/duration.go

Lines changed: 2 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/go.uber.org/atomic/error.go

Lines changed: 1 addition & 12 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/go.uber.org/atomic/error_ext.go

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)