mysql

command
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 5, 2024 License: Apache-2.0 Imports: 13 Imported by: 0

README

Conformance MySQL log

This binary runs an HTTP web server that accepts POST HTTP requests to an /add endpoint. This endpoint takes arbitrary data and adds it to a MySQL based Tessera log.

[!WARNING]

  • This is an example and is not fit for production use, but demonstrates a way of using the Tessera Log with MySQL storage backend.
  • This example is built on the tlog tiles API for read endpoints and exposes a /add endpoint that allows any POSTed data to be added to the log.

Bring up a log

This will help you bring up a MySQL database to store a Tessera log, and start a personality binary that can add entries to it.

You can run this personality using Docker Compose or manually with go run.

Note that all the commands are executed at the root directory of this repository.

Docker Compose
Prerequisites

Install Docker Compose.

Start the log
docker compose -f ./cmd/conformance/mysql/docker/compose.yaml up

Add -d if you want to run the log in detached mode.

Stop the log
docker compose -f ./cmd/conformance/mysql/docker/compose.yaml down
Manual
Prerequisites

You need to have a MySQL database configured to run on port 3306, accepting password auth for root with the password set to root, and a DB instance called test_tessera.

You can start one using Docker.

docker run --name test-mysql -p 3306:3306 -e MYSQL_ROOT_PASSWORD=root -e MYSQL_DATABASE=test_tessera -d mysql:8.4
Start the log
go run ./cmd/conformance/mysql --mysql_uri="root:root@tcp(localhost:3306)/test_tessera" --init_schema_path="./storage/mysql/schema.sql" --private_key_path="./cmd/conformance/mysql/docker/testdata/key"
Stop the log

Ctrl C

Add entries to the log

Manually

Head over to the codelab to manually add entries to the log, and inspect the log.

Using the hammer

In this example, we're running 256 writers against the log to add 1024 new leaves within 1 minute.

Note that the writes are sent to the HTTP server we brought up in the previous step, but reads are sent directly to the file system.

go run ./internal/hammer \
  --log_public_key=transparency.dev/tessera/example+ae330e15+ASf4/L1zE859VqlfQgGzKy34l91Gl8W6wfwp+vKP62DW \
  --log_url=http://localhost:2024/ \
  --max_read_ops=0 \
  --num_writers=256 \
  --max_write_ops=256 \
  --max_runtime=1m \
  --leaf_write_goal=1024 \
  --show_ui=false

Optionally, inspect the log using the woodpecker tool to see the contents:

go run github.com/mhutchinson/woodpecker@main --custom_log_type=tiles --custom_log_url=http://localhost:2024/ --custom_log_vkey=transparency.dev/tessera/example+ae330e15+ASf4/L1zE859VqlfQgGzKy34l91Gl8W6wfwp+vKP62DW

Documentation

Overview

mysql is a simple personality allowing to run conformance/compliance/performance tests and showing how to use the Tessera MySQL storage implmentation.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL