Architecture
VDB for MySQL is a stock, unmodified mysqld 8.4 (Oracle's source, built by VDB) that loads four VDB plug-ins (vdb.so), and a Go process, vdb-mysql, that owns the data. Clients talk to mysqld itself, so the SQL dialect, the optimizer, error codes and the wire protocol are MySQL's own. Every table uses VDB's storage engine, which asks vdb-mysql for rows: the Source's rows merged with the environment's own changes, the Delta.
| Part | Does |
|---|---|
mysqld 8.4 | Parses, plans and executes every statement; speaks the MySQL protocol to clients |
vdb.so | A storage engine, two login plug-ins and an audit plug-in that forward to vdb-mysql over a local socket |
vdb-mysql | Reads the Source, keeps the Delta, enforces InnoDB's locks, isolation and foreign keys, relays logins, mirrors grants, and supervises mysqld |
One container runs two processes as user vdb: vdb-mysql and the mysqld it supervises.
- Start.
vdb-mysqlconnects to the Source over verified TLS, discovers its databases, tables, views, routines and accounts, opens the plug-in socket/run/vdb/vdb.sock, copies the template data directory, startsmysqldwithout networking, rebuilds every object from the catalog of record, then restartsmysqldwith its client port open. The port opens only when the environment is complete. - Reads. Every table uses the
vdb_mysql_storageengine. A scan reads the Source in pages inside a consistent snapshot and merges them with the Delta: rows the environment updated or deleted are hidden, its own rows added. Ordered index scans interleave the two sides in MySQL's sort order;COUNT(*)is answered exactly with one Source count and a correction. - Writes. Inserts, updates and deletes go to the Delta, with uniqueness checked against the Delta and the Source, row and gap locks, foreign keys enforced as InnoDB enforces them, and savepoints. The Source is never written: the service account can only read, its session is read-only, and every statement is built from fixed read-only shapes.
- Logins. The Source decides every login.
mysqld's VDB login plug-ins pass the Source's own challenge to the client and the answer back; the password reaches VDB only when the Source asks for it, and is then sent once over TLS and wiped. Accounts and privileges are mirrored from the Source and polled. - Changes on the Source. Schema changes are polled and applied; the Delta's rows are converted with MySQL's own conversion rules. Grants are polled; locked and dropped accounts lose their sessions.
- Restarts. The Delta lives in memory.
mysqld's data directory is rebuilt at every start; amysqldcrash triggers the same rebuild, and committed work survives invdb-core.