featurebase/batch
Travis Turner eb6c6e3105
Add kafka support to CLI (fbsql) (#2278)
* Add kafka support to CLI (fbsql)

This commit adds the ability to provide a `--kafka-config` command line
argument referncing a toml file to configure kafka.

* Move "Molecula Consumer" message to the logger; hide it in basic mode

* Fold decimal(scale) into kafka.source-type

* Build fbsql with cgo in docker for CI

* Re-organize the fbsql kafka config and setup.

Allow field config to use the table schema if no fields provided.

* Display timestamp fields with format RFC3339Nano

* remove kafkaRunner (no longer used)

* Fix cli/batch test (and make sure it's not excluded from CI)

The logic in our Makefile was exluding from tests any package with
`/batch` in the package name. This excluded `/cli/batch`, which is not
good.

This commit changes the exclusion logic to include the `/v3` portion of
the package name, so `/v3/batch`.

* Rename Basic() to SetBasic()
2023-03-07 08:18:22 -06:00
..
egpool Fixed some import issues resulting from syncing the private repo 2022-11-17 08:58:22 -08:00
testdata Batch insert via SQL (multiple tuples) (#2243) 2022-11-15 11:25:36 -08:00
batch.go SUP-288 (#2414) 2023-01-19 22:10:15 +00:00
batch_test.go Use the correct epoch when converting field.Options.Base to timestamp (#2241) 2023-02-10 17:13:09 -06:00
batcher.go Add kafka support to CLI (fbsql) (#2278) 2023-03-07 08:18:22 -06:00
convert.go Fixed some import issues resulting from syncing the private repo 2022-11-17 08:58:22 -08:00
docker-compose.yml Convert SchemaAPI interface to use dax.Table instead of pilosa.IndexInfo (#2336) 2022-12-12 09:01:20 -08:00
Dockerfile-test introduce performance counters and system table fanout, plus refactor metrics (#2363) 2023-01-19 21:35:02 +00:00
Dockerfile-wait Batch insert via SQL (multiple tuples) (#2243) 2022-11-15 11:25:36 -08:00
error.go Batch insert via SQL (multiple tuples) (#2243) 2022-11-15 11:25:36 -08:00
Makefile Convert SchemaAPI interface to use dax.Table instead of pilosa.IndexInfo (#2336) 2022-12-12 09:01:20 -08:00
metrics.go introduce performance counters and system table fanout, plus refactor metrics (#2363) 2023-01-19 21:35:02 +00:00
README.md Add DAX - full list of squashed commits below 2022-12-12 09:01:20 -08:00
wait.sh Batch insert via SQL (multiple tuples) (#2243) 2022-11-15 11:25:36 -08:00

batch

The batch package provides a standard tool set for batching records in a way that is most performant for ingesting those records into FeatureBase. The main implementation is Batch (which can be initated with the NewBatch() function). The NewBatch() function takes an Importer which contains all of the methods required to interact with FeatureBase; these include methods for doing string/id translation as well as for importing shards of data.

IDK uses the batch package internally. Another example where the batch package is used in the sql3 package. When an "INSERT INTO" statement is executed, the SQL engine uses a Batch to do key translation and build import batches prior to doing the final import.

Integration tests

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

  1. Docker
  2. Docker Compose

In addition to these dependancies, you will need to be added to the molecula Gitlab account.

First start the test environment. This is a docker-compose environment that includes featurebase.

make startup

To build and run the integration tests, run:

make test-run-local

Then to shut down the test environment, run:

make shutdown

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 batch-test for docker to run the latest code. Modify the following as needed:

make startup
docker-compose build batch-test
docker-compose run batch-test /usr/local/go/bin/go test -count=1 -mod=vendor -run=TestCmdMainOne .