Commit graph

38 commits

Author SHA1 Message Date
Seebs
f6d17b1b58 refactor testing to share clusters more often
When doing tests, we create a ton of one-off clusters. This
turns out to be expensive and slow. Fixing it is surprisingly hard.

Fundamentally: If we're sharing clusters, we need to use different
indexes for each test, to avoid clashes. This changes index names.
As a side-effect, this reorders many partition-based things, like
the order keys are returned in. Thus, to fix this, we change a lot
of tests to no longer depend on the *order* in which strings are
returned.

Having done that, we can also discard the ModHasher behavior, since
that only existed to allow us to reliably predict partitioning.

The basic design is as follows: Instead of a cluster being a
[]*Command, a "shareable" cluster is now a []*Command plus some
flags, and a "cluster" is a pointer to a possibly-shared cluster,
plus a link to the specific test using this specific cluster,
and correspondingly, its test name suitably coerced to be a valid
index name prefix.

The "test.Cluster" object now has methods to allow retrieving an
index name, and also implemnts fmt.Formatter to let you use,
e.g., `%i` with it in Sprintf to get "the index name, plus an i".
(This works for everything but %p and %T.)

This allows us to consistently rework all the many things that
use index names in a persistent way.

We also have `MustUnshared` and `MustRunUnsharedCluster` methods
which allow us to specify that a given test needs its own cluster
for some reason. For instance, the tests that want to run backups
need their own isolated cluster, and the tests that want to close
or reopen nodes need their own cluster because a reopened cluster
won't have working GRPC for some reason.

On "closing" a shared cluster (actually the test-specific wrapper
that reflects a given sharing), we delete any indexes starting with
that test's index name prefix. Otherwise, the huge pile of open
indexes prevents `go test -race` from working on MacOS, where we
run out of address space too quickly.

This is fairly enormous but most of the individual changes are
fairly trivial things like replacing the string "i" with "c.Idx()".

We also tweaked a test that failed for me a couple of times to
not depend on sort order.
2022-09-30 11:10:47 -07:00
Fletcher Haynes
da9b57bd45 Updated dependency paths to reflect new repo location 2022-09-06 09:39:22 -07:00
Fletcher Haynes
eb06bb50ae Updated code to latest version for open-sourcing. 2022-09-02 13:23:39 -07:00
Seebs
fc5fc4151b add missing error check 2019-04-16 12:08:40 -05:00
Seebs
d5907b2a2e lint fixes to cluster behavior in utils test
This is more lint fixes, but it's less obvious to me what the
right handling for errors is, or whether disregarding them is
safe, so it's a separate commit.
2019-04-16 12:07:18 -05:00
Seebs
77d49ded64 so much lint
So with the switch to a new linter, we get a lot of new warnings,
and the majority of them are harmless probably, but a few might be
real. Variously just use _ to suppress warnings, or report errors.
There's probably things here that deserve better fixes, but we can
always revisit it.
2019-04-16 12:07:18 -05:00
Cody Soyland
fdbfc68f7c Add license headers to files missing them and CI check to verify they are present. Fixes #1633 2019-04-12 11:30:41 -05:00
Matt Jaffee
d5cfe880f7
address race condition by getting cluster nodes with lock
needed an unlocked version of sendsync for use within the cluster, so also
implemented that. Added a number of tests trying to reproduce the issue, but was
not able to. Not sure it's worth keeping the new tests.
2019-04-05 15:40:24 -05:00
Matt Jaffee
fe7b926773
make sure more tests and benchmarks can have their temp dir set by flag
This is to allow the directory to be set to where a particular disk is mounted
during benchmarking.
2019-01-21 16:23:27 -06:00
Travis Turner
d28170ddc6
Syncs AvailableShards when handling a ResizeInstruction.
There was a situation where availableShards on a new
node were not in sync with the cluster, so queries
following a resize were incorrect.
- Start a one-node cluster.
- Write data to shards 0 and 1
- Start a second node.
In the case where the hash algo was moving shard 0 to
node1, then node1 only knew about shard 0, so queries
to node1 would be incomplete.

This PR modifies the ResizeInstruction message to replace
`Schema` with `NodeStatus` (which contains both `Schema` and
`AvailableShards`). So now when a resize instruction is received,
the receiving node is able to sync its schema and availableShards.
2018-12-18 08:34:48 -06:00
Matt Jaffee
0e467e5492
rename cluster.nodes and fix race in API 2018-08-08 15:11:39 -05:00
Matt Jaffee
fa755fdd81
fix ClusterCluster not to broadcast to self.
stops deadlock when cluster has appropriate internal locking
2018-07-17 16:34:49 -05:00
Cody Soyland
7807b92b13 Unexport URI.SetScheme 2018-07-05 23:11:56 -05:00
Cody Soyland
ac83bf4422 Unexport URI.SetHost 2018-07-05 23:11:56 -05:00
Cody Soyland
65472609a5 Unexport Topology.Encode 2018-07-05 23:11:56 -05:00
Cody Soyland
3e91a0d32c Unexport NodeStateReady 2018-07-05 23:11:56 -05:00
Cody Soyland
2031345c86 Unexport NewTopology 2018-07-05 23:11:56 -05:00
Cody Soyland
761f6878fb Unexport DefaultURI 2018-07-05 23:11:56 -05:00
Matt Jaffee
e33682cfd2
address feedback 2018-07-05 17:38:49 -05:00
Matt Jaffee
0a94d2f10d
Merge branch 'develop' into core-structs 2018-07-05 16:38:14 -05:00
Matt Jaffee
1b2aaa26bf
export NodeEvent 2018-07-05 09:26:58 -05:00
Travis Turner
44f0b992f6
change all CreateField() methods to take functional options instead of FieldOptions 2018-07-04 21:22:35 -05:00
Matt Jaffee
6417f468bb
wip implement more... still quite broken 2018-07-04 16:50:20 -05:00
Matt Jaffee
009242fef9
unexport more Holder stuff (gorename) 2018-07-02 14:07:06 -05:00
Matt Jaffee
9995b0032e
unexport Holder.Fragment, HolderSyncer and HolderCleaner 2018-07-02 14:00:31 -05:00
Matt Jaffee
4182678d5a
work on unexporting View stuff 2018-07-02 10:11:56 -05:00
Matt Jaffee
3be609ed10
unexport newCluster and some other stuff 2018-07-02 09:10:09 -05:00
Matt Jaffee
7801b81b10
unexport cluster (gorename) 2018-07-02 07:56:51 -05:00
Matt Jaffee
2e15db7ce0
Merge branch 'develop' into more-gossip-stuff 2018-06-29 06:49:13 -05:00
Matt Jaffee
91454a5cd0
collapse *handler interfaces into MemberServer
gossip now takes a single "MemberServer" which is implemented by server. Several
interfaces have been removed.

MemberServer contains ReceiveMessage which is a superset of the functionality of
ReceiveEvent, LocalStatus and HandleRemoteStatus are all that's left of
StatusHandler -  ClusterStatus was not used and is gone. The Node() method is
actually a subset of LocalStatus() functionality. Maybe we should break up
localstatus or remove Node... not sure.

Remove BroadcastReceiver test which was a bit silly.

NodeEvent can now be unexported, and is.
2018-06-28 17:16:08 -05:00
Travis Turner
5dd7a9556a
rename slice to shard 2018-06-28 14:07:07 -05:00
Matt Jaffee
648cfe7ad0
unexport Cluster fields which could be automatically unexported 2018-06-27 15:39:12 -05:00
Matt Jaffee
41bdfceb57
remove MemberSet from cluster, Open in server package 2018-06-27 07:22:32 -05:00
Travis Turner
b7470ba8a8
Merge branch 'develop' into remove-view-argument 2018-06-19 19:50:03 -05:00
Travis Turner
c77b7d5ca5
remove view argument from Field.SetBit and Field.ClearBit 2018-06-19 18:15:38 -05:00
Travis Turner
ca6b3b5524
simplify test cluter addNode signature 2018-06-19 17:48:37 -05:00
Todd Gruben
eb43707d19 cleanup 2018-06-19 13:34:44 -05:00
Travis Turner
8021fc389b
un-export (some) Cluster methods 2018-06-13 15:42:35 -05:00
Renamed from utils_test.go (Browse further)