featurebase/idk
Travis Turner 468461fbcf
Add Drop Database and Drop Table support (#2208)
* Support Drop Table in serverless (include Snapshotter, Writelogger)

* Finish Database methods

Things like:
- `Databases`
- `DatabaseByID`
- `DatabaseByName`
- `DropDatabase`

* Change Poller to use NodeService instead of its own map

Instead of the Poller maintaining its own map of Addresses to poll, this
commit changes the Poller to use the NodeService interface to get all
known nodes from the Controller.

The next commit needs to:
Next, the logic in the boltdb NodeService implementation was moved to
the boltdb Balancer implementation. That way, the Balancer can be the
source of truth for all things nodes/workers/jobs.

* Move NodeService from Controller to Balancer

This commit moves the implementation of the NodeService into the
Balancer, and aligns `Balancer.AddWorker` with `NodeService.CreateNode`
so that they stay in sync. (Same for `Balancer.RemoveWorker` and
`NodeService.DeleteNode`).

* fix import of private repo

* Fix go vet issues

* Fix bug in DeregisterNode

We need to remove the node from the NodeService even if it's not
assigned to a database. The logic had a bug in it.

This also adds some no-op implementations for SnapshotService and
WriteloggerService. If a directory was not configured for that, then the
computer node would panic on trying to read from the Snapshotter upon
receiving a Directive.

* queryer response content-type: json

* Add support for NULL to WriteloggerDir and SnapshotterDir configs

This commit changes the way WriteLoggerDir and SnapshotterDir are
handled.
If value is empty `""`, an error will be returned on computer startup.
If value is `"NULL"`, a no-op implementation of the service will be
used. This would be for a case that wanted to run serverless on-prem
with no durable storage.
Finally, any other value will be used as the directory to use.

Some things which aren't considered here and may result in unexpected
behavior:
- a value with spaces `" "`
- any "null" which is not "NULL"... like lowercase.

* Finish the DropTable test

* Change "disable service" value to case-insensitive "off"

This commit also removes an unnecessary sleep in the tests.

* Fix docker-compose variables for IDK test

Co-authored-by: Matthew Jaffee <jaffee@pilosa.com>
2023-01-23 19:59:47 -06:00
..
api Sync from private repo to commit 12d608c80d 2022-12-12 09:01:20 -08:00
bankgen Sup 294 pre sort command (#2209) 2023-01-23 12:26:38 -06:00
cmd Sup 294 pre sort command (#2209) 2023-01-23 12:26:38 -06:00
common SUP-288 (#2414) 2023-01-19 22:10:15 +00:00
csv staticcheck fixes (#2278) 2022-11-15 11:33:10 -08:00
datagen Sup 294 pre sort command (#2209) 2023-01-23 12:26:38 -06:00
docker-sasl Updated code to latest version for open-sourcing. 2022-09-02 13:23:39 -07:00
fakeidp Updated code to latest version for open-sourcing. 2022-09-02 13:23:39 -07:00
idktest Add DAX - full list of squashed commits below 2022-12-12 09:01:20 -08:00
internal fix: updating code to meet linting requirements (#2171) 2022-09-29 12:34:29 -04:00
kafka Sup 294 pre sort command (#2209) 2023-01-23 12:26:38 -06:00
kafka_sasl drop invalid UTF8 encoding from encoding tests 2022-12-12 09:01:20 -08:00
kafka_static drop invalid UTF8 encoding from encoding tests 2022-12-12 09:01:20 -08:00
kafkagen staticcheck fixes (#2278) 2022-11-15 11:33:10 -08:00
kinesis fix: updating code to meet linting requirements (#2171) 2022-09-29 12:34:29 -04:00
mds Add Drop Database and Drop Table support (#2208) 2023-01-23 19:59:47 -06:00
sql Updated dependency paths to reflect new repo location 2022-09-06 09:39:22 -07:00
testdata Add DAX - full list of squashed commits below 2022-12-12 09:01:20 -08:00
.cloud-env.template Updated code to latest version for open-sourcing. 2022-09-02 13:23:39 -07:00
docker-compose.yml Add Drop Database and Drop Table support (#2208) 2023-01-23 19:59:47 -06:00
Dockerfile Make SOURCE_DATE_EPOCH changes for idk 2022-12-12 09:01:20 -08:00
Dockerfile-fakeIDP Updated code to latest version for open-sourcing. 2022-09-02 13:23:39 -07:00
Dockerfile-test Updated dependency paths to reflect new repo location 2022-09-06 09:39:22 -07:00
Dockerfile-wait Updated code to latest version for open-sourcing. 2022-09-02 13:23:39 -07:00
dup.go Updated code to latest version for open-sourcing. 2022-09-02 13:23:39 -07:00
dup_arm64.go Updated code to latest version for open-sourcing. 2022-09-02 13:23:39 -07:00
file_with_line_delimited_values Updated code to latest version for open-sourcing. 2022-09-02 13:23:39 -07:00
header.go staticcheck fixes (#2278) 2022-11-15 11:33:10 -08:00
header_test.go Updated code to latest version for open-sourcing. 2022-09-02 13:23:39 -07:00
idallocator.go fix: updating code to meet linting requirements (#2171) 2022-09-29 12:34:29 -04:00
idallocator_test.go Updated dependency paths to reflect new repo location 2022-09-06 09:39:22 -07:00
ingest.go Add Drop Database and Drop Table support (#2208) 2023-01-23 19:59:47 -06:00
ingest_test.go Add Drop Database and Drop Table support (#2208) 2023-01-23 19:59:47 -06:00
interfaces.go Add DAX - full list of squashed commits below 2022-12-12 09:01:20 -08:00
interfaces_test.go merge: featurebase merge updates for 2022-10-28 (#2188) 2022-10-28 13:08:23 -04:00
Makefile introduce performance counters and system table fanout, plus refactor metrics (#2363) 2023-01-19 21:35:02 +00:00
metrics.go introduce performance counters and system table fanout, plus refactor metrics (#2363) 2023-01-19 21:35:02 +00:00
pilosa-sec-test.conf Updated code to latest version for open-sourcing. 2022-09-02 13:23:39 -07:00
postgres.go Updated dependency paths to reflect new repo location 2022-09-06 09:39:22 -07:00
progress.go Updated code to latest version for open-sourcing. 2022-09-02 13:23:39 -07:00
README.md Add DAX - full list of squashed commits below 2022-12-12 09:01:20 -08:00
reingest_test.sh Updated code to latest version for open-sourcing. 2022-09-02 13:23:39 -07:00
sample.csv Updated code to latest version for open-sourcing. 2022-09-02 13:23:39 -07:00
test_postgres.go Updated code to latest version for open-sourcing. 2022-09-02 13:23:39 -07:00
tls.go fix: updating code to meet linting requirements (#2171) 2022-09-29 12:34:29 -04:00
util.go Updated dependency paths to reflect new repo location 2022-09-06 09:39:22 -07:00
util_test.go Updated code to latest version for open-sourcing. 2022-09-02 13:23:39 -07:00
version.go Updated code to latest version for open-sourcing. 2022-09-02 13:23:39 -07:00
wait.sh Updated code to latest version for open-sourcing. 2022-09-02 13:23:39 -07:00

idk: Ingest Development Kit

Integration tests

To run the tests, you will need to install the following dependencies:

  1. Docker
  2. Docker Compose
  3. Certstrap

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

  1. 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.