Local database
The builder does not parse SQL dumps itself. It loads them into a local MariaDB server, then queries the tables. The dev shell provides the server and three scripts to manage it.
Scripts
| Script | What it does |
|---|---|
db-start | Creates the data directory on first run, starts the server, creates the wikipedia database |
db-stop | Stops the server |
db-reset | Stops the server, deletes all data, starts a fresh server |
Open a SQL shell with:
mariadb wikipedia
Where the data lives
- Data directory:
$WPATH_DB_DIR/data, which is.mariadb/datain the repository. - Socket:
$WPATH_DB_DIR/mariadb.sock. The server does not listen on TCP. - Log:
$WPATH_DB_DIR/mariadb.log.
.mariadb/ is in .gitignore.
Settings
The server is tuned for bulk loading of data you can download again. It gives up durability for
speed: no binary log, no doublewrite buffer, and the log is not flushed on each commit. If the
machine crashes during provision, run provision again.
| Variable | Default | Effect |
|---|---|---|
WPATH_DB_BUFFER_POOL | 8G | InnoDB buffer pool size |
WPATH_DB_NAME | wikipedia | Database created by db-start and used by provision and build |
Set them before db-start, for example WPATH_DB_BUFFER_POOL=16G db-start. The buffer pool size
applies each time the server starts.
Be careful with db-reset
db-reset deletes every loaded table. Loading them again with provision takes hours. Only run
it when you really want an empty database.
Read-only access from build
build never writes to the database. Each query runs in a session opened with
SET SESSION TRANSACTION READ ONLY, and the builder checks @@session.transaction_read_only
before it reads any row. If the check fails, the build stops.