-
Notifications
You must be signed in to change notification settings - Fork 453
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
Add support for putting commit log bootstrapper before peers #894
Changes from all commits
61af15d
77fe988
7b1646e
bfad99f
11367e1
a8ef19e
232fce9
47c1473
6f53985
a3d2bf1
4e0e180
a1fe6c2
139b87a
4ac6997
c82ffe3
8c8c5e7
257ddbe
7b9f60f
b1a3dea
a33867e
22b4495
b48b4e4
9c1b059
437df7a
d3bb018
7777763
c27062a
1d11b84
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -34,8 +34,10 @@ import ( | |
"time" | ||
|
||
"github.com/gogo/protobuf/proto" | ||
"github.com/m3db/m3/src/dbnode/client" | ||
"github.com/m3db/m3/src/dbnode/retention" | ||
"github.com/m3db/m3/src/dbnode/storage/namespace" | ||
"github.com/m3db/m3cluster/shard" | ||
"github.com/m3db/m3x/ident" | ||
"github.com/stretchr/testify/assert" | ||
"github.com/stretchr/testify/require" | ||
|
@@ -139,3 +141,35 @@ func newNamespaceWithIndexProtoValue(id string, indexEnabled bool) (proto.Messag | |
} | ||
return namespace.ToProto(nsMap), nil | ||
} | ||
|
||
// waitUntilAllShardsAreAvailable continually polls the session checking to see if the topology.Map | ||
// that the session is currently storing contains a non-zero number of host shard sets, and if so, | ||
// makes sure that all their shard states are Available. | ||
func waitUntilAllShardsAreAvailable(t *testing.T, session client.AdminSession) { | ||
outer: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. should there be a timeout here too ? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Eh, the tests will already timeout by default. Also I'm just moving this function, not adding it There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yeah fair enough. |
||
for { | ||
time.Sleep(10 * time.Millisecond) | ||
|
||
topoMap, err := session.TopologyMap() | ||
require.NoError(t, err) | ||
|
||
var ( | ||
hostShardSets = topoMap.HostShardSets() | ||
) | ||
|
||
if len(hostShardSets) == 0 { | ||
// We haven't received an actual topology yet. | ||
continue | ||
} | ||
|
||
for _, hostShardSet := range hostShardSets { | ||
for _, hostShard := range hostShardSet.ShardSet().All() { | ||
if hostShard.State() != shard.Available { | ||
continue outer | ||
} | ||
} | ||
} | ||
|
||
break | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i hate it, but i hate all others more =P