Commit graph

75 commits

Author SHA1 Message Date
Kasey Rodgers
e75abc3c38 added testify dependency 2022-09-30 11:31:37 -07:00
Seebs
ea69b0637d significant refactor of test setup and teardown
We centralize the creation paths for test indexes, fields,
etcetera so they all have a common path, all using standard
test holders. There's still two versions, one for test.* functions
and one for internal. They do share a TestHolderConfig though.

Large hunks of the related APIs are simplified/streamlined.
* Fragments are always created with a Field and don't need
  a workaround in case they don't have it.
* Creation of test fragments, etc., use optional FieldOptions
  but don't specify names because they're all using new holders
  for each thing created anyway. This dramatically reduces
  the complexity of the calls.
* test fragments are created inside test views which are created
  inside test fields, etcetera, so everything is using the same
  logic; test views aren't bypassing the other layers, they're
  creating themselves normally within a field.
* Quite a few things now use the standard runtime/production
  logic instead of being custom workarounds; for instance, instead
  of `mustOpenMutexFragment` creating a fragment and then creating
  a mutex vector for it, we just create a mutex-typed field and
  have the normal runtime code do this.
* Similarly, we now use the same field creation logic that production
  does, instead of having our own test-only thing that validates
  field names directly, so our test that we're validating field names
  is actually testing the runtime code. Yay.
* fragSpec goes away. it was a replacement for fragProxy which existed
  to solve memory allocation problems but replaced them with interface
  overhead problems. Now we just have pointers to things and maintain
  valid data structures.
* Many panics are now Fatal or Fatalf calls.
* Some specific bugs fixed, like a cluster which was requested and
  then had its first node directly overwritten, which isn't valid with
  shared clusters.
* Drop the temp-dir test flag and TempDir variable, we can just use
  $TMPDIR.
* Drop a benchmark of "write file to disk" that was purely a benchmark
  of file write speed, not a benchmark of rendering the data that needs
  to be written.
* Drop the unused "flags" parameter to fragment creation, which was
  only used back when we changed the BSI format.
* Use holder.Txf() rather than index.Txf(). The TxFactory has to be
  holder-level anyway, referring to it via the index is misleading.
* Test holders automatically close themselves and delete themselves,
  we remove various other things that thought they were responsible
  for deleting themselves.
2022-09-30 11:25:27 -07:00
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
Travis Turner
56adbfedfd
Fix off-by-one maxRowID in block limits 2020-05-04 17:29:53 -05:00
Kuba Podgórski
b9fa6da5d2 Simplify Holder's logic 2020-02-03 18:12:15 +01:00
Ben Johnson
c7c9c1e1d7
v2.0.0
Co-authored-by: Cody Soyland <codysoyland@gmail.com>
2019-10-08 14:56:17 -06: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
Travis Turner
eadd77f901
fixed a mistake in the test from PR 1780 2018-12-11 16:20:10 -06:00
Travis Turner
c66daabc81
convert the anti-entropy logic to use ImportRoaring instead of QueryNode 2018-12-10 21:05:08 -06:00
Travis Turner
f1a460aca7
adds view parameter to sync logic for syncing time fields 2018-08-16 11:27:08 -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
a6a0c6a7c3
unexport Holder.view and prepare to unexport Holder.Fragment 2018-07-02 13:58:20 -05:00
Matt Jaffee
4182678d5a
work on unexporting View stuff 2018-07-02 10:11:56 -05:00
Matt Jaffee
ea77db895a
fix syncholder test and a few bugs
The http internal client's FragmentBlocks and Blockdata methods were being used
incorrectly, and incorrect respectively. One was not being passed a node URI by
monitorAntiEntropy, and the other was always using the defaultURI regardless of
what was passed to it. Antientropy was doubling not working because of this. I
think this crept in pretty recently, so hasn't actually affected anyone.

I exposed a SyncData method on Server so that we can invoke the anti entropy
task manually instead of trying to set up the interval so that it will run and
then sleeping and waiting for it to run. Now that this test works the way it
does, the other anti entropy test is obsolete, and I deleted it.
2018-06-29 14:48:13 -05:00
Travis Turner
5dd7a9556a
rename slice to shard 2018-06-28 14:07:07 -05:00
Cody Soyland
c6db3974bc WIP API refactor 2018-06-21 13:51:31 -05:00
Travis Turner
c77b7d5ca5
remove view argument from Field.SetBit and Field.ClearBit 2018-06-19 18:15:38 -05:00
Cody Soyland
fba865fc6c Remove more net/http references 2018-06-13 16:50:44 -05:00
Travis Turner
8021fc389b
un-export (some) Cluster methods 2018-06-13 15:42:35 -05:00
Cody Soyland
ecbbd31b4e Improve naming 2018-06-13 09:18:50 -05:00
Cody Soyland
daffa3b125 Rename InternalHTTPClient -> InternalClient 2018-06-13 09:04:04 -05:00
Cody Soyland
0b16a3afb9 Merge branch 'develop' into http-inversion 2018-06-12 14:49:54 -05:00
Cody Soyland
f2c104dfef Migrate HTTP handler and client into http subpackage. 2018-06-12 13:22:40 -05:00
Travis Turner
e58d407182
unexport (most) View methods 2018-06-07 22:50:49 -05:00
Travis Turner
173939813f
remove slice argment from Field.Row() method 2018-06-07 17:14:46 -05:00
Travis Turner
3c3c98371b
unexport Fragment.Row(). This required creating Field.Row() and View.row() 2018-06-07 15:09:58 -05:00
Travis Turner
468ad57b6d
un-export Fragment.SetBit and Fragment.ClearBit.
adds methods to test.Holder to set/clear bits on a field.
2018-06-07 13:43:20 -05:00
Travis Turner
2a9b1e9e5b
final Frame to Field rename 2018-06-06 01:27:12 -05:00
Travis Turner
4254eb1d11
rename internal FrameMeta to FieldOptions 2018-06-05 23:10:59 -05:00
Travis Turner
3531c128c4
GoRename Frame to Field in index.go 2018-06-05 22:33:48 -05:00
Travis Turner
1d3c4d6fcb
first pass at GoRename Frame to Field in frame.go 2018-06-05 17:52:22 -05:00
Matt Jaffee
ca530b1fc3
more fixes 2018-05-25 10:57:51 -05:00
Todd Gruben
fb7bf11825 Bit -> Column migration 2018-05-23 15:05:22 -05:00
alanbernstein
64ebae3a8a
Merge branch 'master' into wrap-errors-index 2018-05-10 18:57:44 -05:00
alanbernstein
515b1bd418
Merge branch 'master' into wrap-errors-frame 2018-05-10 17:54:05 -05:00
alanbernstein
32ed40ad45
Merge pull request #1274 from alanbernstein/wrap-errors-fragment
Wrap errors in fragment
2018-05-10 17:48:08 -05:00
alanbernstein
ec503740e4
Merge branch 'master' into wrap-errors-frame 2018-05-10 17:28:54 -05:00
Alan Bernstein
6e28624528 Wrap errors in fragment 2018-05-10 13:09:07 -05:00
Alan Bernstein
eb888b74f7 Update test error strings 2018-05-10 12:12:55 -05:00
Alan Bernstein
4f300f5c2e Wrap errors in index 2018-05-10 11:33:14 -05:00
Alan Bernstein
17520033c6 Update test error strings 2018-05-10 10:57:27 -05:00
Alan Bernstein
3907e21f6f Wrap errors in frame 2018-05-08 18:40:44 -05:00
Matthew Jaffee
f9ff20689a
remove holder.Peek, combine with HasData, move server logic
Server initializing happens more in NewServer than Open now - expecting to
continue this trend. goal was to remove remoteClient from Server (since it has a
defaultClient) as well, but we'll have to refactor the client usage in fragment
and frame first.
2018-04-24 08:44:58 -05:00
Matthew Jaffee
28acc29a10
refactoring pilosa/server
trying to separate internal an external concerns in pilosa.Server - it should
handle Cluster, Holder, etc. while pilosa/server handles things with external
deps - e.g. Logger, Stats, Handler, etc. Using functional options in
pilosa.Server now.
2018-04-23 13:35:39 -05:00
Travis Turner
e7151eb2a8
Remove Index.TimeQuantum 2018-04-18 08:17:26 -05:00
Matthew Jaffee
07610560df
Merge branch 'master' into 1151-http-refactor 2018-04-10 08:10:25 -05:00
Travis Turner
1764d5a9bf
Merge pull request #1180 from travisturner/remove-rowcol-labels
Remove rowcol labels
2018-04-03 22:37:59 -05:00
Yuce Tekol
c36dd395e6
All tests pass 2018-04-03 15:20:33 -07:00