* Introduce ServiceManager and Refactor DAX Integration tests
The ServiceManager provides an interface with which to manage
featurebase (dax) services (mds, queryer, computer). It replaces the
confusing interface implementations in /dax/server/server.go (which
optionally used pointers to in-process objects to satisfy an interface)
with (for now) http implementations. The thought is that even if we're
running all services in-process, we should communicate between services
over http in order to mirror what we would do in a production
environment where the services are running on different nodes.
This batch of commits does quit a lot, most of which is captured here:
- Added `path` support to `dax.Address`. Address is now a string of the form [scheme]://[host]:[port]/[path].
- Added `Holder.directiveApplied` to determine (in tests) if the computer has completed applying the latest directive. This is somewhat temporary until we improve the mds-to-computer logic.
- Removed the "service prefix" code which was prepending client URL paths with the prefix. Instead, the serviceType (mds, queryer, computer[n] is now part of `dax.Address`).
- Removed, from the dax config, the top level `StorageMethod` and `StorageDSN` and now just have `MDS.Config.DataDir`.
- Added `Computer.Config.N` to specify the number of computers to run in-process.
- Moved the `pilosa.MDS` interface to `computer.Registrar`. This is an example of getting the interfaces defined in the right packages.
- Added `SnapshotTable()` method to the mds client (to align with its API).
- Changed `Balancer.AddJob()` to `Balancer.AddJobs()` to support, for example, adding 256 partitions in a single call. Refactored some of the naive Balancer to account for this.
- Added a `Seed` to the top-level config. It's not really useful because of package `crypto/rand`.
- Added an in-memory implementation of the DisCo interface and disabled etcd in a computer service.
- Create sepearte data-dirs for each in-process computer.
- Disabled grpc in dax.
- Modified the sql3 test definition format to support multiple insert steps and separate query results (to align with those steps).
* Changes necessary to get multiple computer instance running in-process
For now the config looks like this:
```
[computer]
run = true
n = 4
```
but we can probably just change that to be something like:
```
[computer]
run = 4
```
*Issues found running multiple "computers" in-process*
- grpc was trying to bind on the same port
- changed GRPCListener from `*net.TCPListener` to `net.Listener`
- created a nopListener and set to that for now (i.e. disabled grpc)
- etcd was starting more than once
- changed dax to use in-memory implementations of the disco interfaces (i.e. stop using etcd)
- IDAllocator (which uses boltdb) was trying to open the `idalloc.db` file more than once
- realized we have to set separate data-dirs for each holder. that fixed it.
* Port dax integration tests to ManagedCommand
* Modify Balancer-related methods like AddJob to AddJobs
There were (and still are) a lot of places where we were adding on job
at a time, even when we had a long list of jobs to add. This resulted in
every job add (for example adding 1 of 256 shards) taking ~40ms, or over
10s to create a keyed table. One reason was because each job add was
making multiple boltdb transactions.
* Port over more dax integration test stuff
* Add DirectiveApplied to signify that snapshot/writes have loaded.
We use this in tests to avoid using sleeps.
This should be considered temporary; we're going to need a more robust
solution for determining when a computer node is ready to serve complete
data.
* Finish porting dax integration tests
* Improve godocs
* Remove docker-based DAX integration tests.
* go mod tidy
* Move test/managed.go to avoid package conflicts
* Modify IDK integration tests to work with ServiceManager changes
This is really just computer -> computer0
And the MDS DataDir config change.
* cleanup found during review
* echo $CI_COMMIT_REF_SLUG in CI
* remove docker image arg, use build instead
(cherry picked from commit
|
||
|---|---|---|
| .. | ||
| api | ||
| bankgen | ||
| cmd | ||
| common | ||
| csv | ||
| datagen | ||
| docker-sasl | ||
| fakeidp | ||
| idktest | ||
| internal | ||
| kafka | ||
| kafka_sasl | ||
| kafka_static | ||
| kafkagen | ||
| kinesis | ||
| mds | ||
| sql | ||
| testdata | ||
| .cloud-env.template | ||
| docker-compose.yml | ||
| Dockerfile | ||
| Dockerfile-fakeIDP | ||
| Dockerfile-test | ||
| Dockerfile-wait | ||
| dup.go | ||
| dup_arm64.go | ||
| file_with_line_delimited_values | ||
| header.go | ||
| header_test.go | ||
| idallocator.go | ||
| idallocator_test.go | ||
| ingest.go | ||
| ingest_test.go | ||
| interfaces.go | ||
| interfaces_test.go | ||
| Makefile | ||
| metrics.go | ||
| pilosa-sec-test.conf | ||
| postgres.go | ||
| progress.go | ||
| README.md | ||
| reingest_test.sh | ||
| sample.csv | ||
| test_postgres.go | ||
| tls.go | ||
| util.go | ||
| util_test.go | ||
| version.go | ||
| wait.sh | ||
idk: Ingest Development Kit
Integration tests
To run the tests, you will need to install the following dependencies:
In addition to these dependancies, you will need to be added to the moleculacorp Dockerhub account.
First start the test environment. This is a docker-compose environment that includes pilosa and a confluent kafka stack. Run the following to start those services:
make startup
To build and run the integration tests, run:
make test-run
An alternative command to use, if you're running tests locally and want human-friendly output, is:
make test-run-local
With that command you can also specify individual tests to run like this:
make test-run-local TCMD='-run=TestJustThisOne .'
Then to shut down the test environment, run:
make shutdown
You can run all of the previous commands by calling test-all:
make test-all
The previous command is equivalent to running the following:
make startup
sleep 30 # wait for services to come up
make test-run
make shutdown
To run an individual test, you can run the command directly using docker-compose. Note that you must run docker-compose build idk-test for docker to run the latest code. Modify the following as needed:
make startup
docker-compose build idk-test
docker-compose run idk-test /usr/local/go/bin/go test -count=1 -mod=vendor -run=TestCmdMainOne ./kafka
To shutdown and reset the environment:
make clean
Running dependencies locally (rather than in docker) "make test-local"
This is for running the tests locally and not in Docker... so you have to be running a bunch of stuff natively on your machine.
Run Pilosa with default config:
pilosa server
Run another pilosa like
pilosa server --config=pilosa-sec-test.conf
which will run Pilosa with TLS using certs in testenv. (make testenv first if you haven't).
You also need to be running the Confluent stack which, after you've installed it from Confluent's site might look something like:
export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_66.jdk/Contents/Home
confluent local destroy && confluent local start schema-registry
Or it might not! You may not need the first line, but if you have the wrong Java version by default, that's how you set it. The second line may change depending on what version of the confluent stack you get. According to
confluent version
I'm running:
Version: v0.212.0
Git Ref: 2b04985
Use the test-local make target:
make test-local
This sets a number of environment variables (which it prints when you run it), and should set them correctly if you follow the instructions above, but if you're running things on non-default ports you may need to tweak them.
CSV Ingester
- make sure you're running Pilosa (localhost:10101 for these instructions)
molecula-consumer-csv --primary-key-fields=asset_tag -i sample-index --files sample.csv
asset_tag__String,fan_time__RecordTime_2006-01-02,fan_val__String_F_YMD
ABCD,2019-01-02,70%
ABCD,2019-01-03,20%
ABCD,2019-01-04,30%
BEDF,2019-01-02,70%
BEDF,2019-01-05,90%
BEDF,2019-01-08,10%
BEDF,2019-01-08,20%
ABCD,2019-01-30,40%
Datagen
Datagen is an internal command-line tool to generate various application-specific datasets, and ingest them directly into Pilosa. After running make install, run datagen with no arguments to see a list of available "sources".
When running Datagen with local Docker stacks, make sure to add individual docker stacks to the /etc/hosts file:
127.0.0.1 kafka
127.0.0.1 pilosa
127.0.0.1 <docker stack>
ODBC Support
By default, the SQL ingester is not built with ODBC support.
This is because it uses CGO with extra dependencies, and the resulting binaries are not portable.
In order to build with ODBC support, it is necessary to install unixODBC to the system.
Then run:
make bin/molecula-consumer-sql-odbc
Different Linux distros will store certain libraries in different locations. ODBC uses dynamic library loading to handle drivers, so full static linking of dependencies is not possible. It is therefore necessary to build on a system with the same distro and the same software versions as the target machine.