How bloomberg/comdb2 works
Comdb2 is a clustered relational database: clients submit SQL, the server executes it through its SQL and table layers, and transactional data is stored by the Berkeley DB-based engine. The README documents client-side connection negotiation/reconnect, multi-node operation, and optimistic transactions with Snapshot and Serializable isolation. The tree identifies additional product areas for schema changes, queues, stored procedures, and federated databases. Only selected sources were sampled, so links among unsampled subsystems are limited to documented capabilities and clear runtime boundaries.
Main entry points: sqlglue.c SQL integration · comdb2.c Database runtime · Driver.java JDBC driver · trans.c Transaction control
Components 21
Client access
- C client API
cdb2api/cdb2api.c - JDBC driver
cdb2jdbc/src/main/java/com/bloomberg/comdb2/jdbc/Driver.java - SQL protocol
protobuf/sqlquery.proto
SQL execution
- Network layer
net/net.c - SQL ingress
plugins/newsql/newsql.c - SQL integration
db/sqlglue.c - SQL engine
sqlite/src/main.c - Plan tracking
db/db_query_plan.c
Data and transactions
- Database runtime
db/comdb2.c - Transaction control
db/trans.c - Table layer
bdb/bdb.c - B-tree storage
berkdb/btree/bt_method.c - Metadata store
bdb/llmeta.c
Cluster services
- Replication
db/phys_rep.c - Client discovery
cdb2jdbc/src/main/java/com/bloomberg/comdb2/jdbc/DatabaseDiscovery.java
Database features
- Schema changes
schemachange/schemachange.c - Queue databases
bdb/queuedb.c - Federated databases
db/fdb_access.c - Stored procedures
lua/lua.c
Other components
- SQL application
- Cluster peers
Connections 21
- SQL application → C client API: submits SQL
- SQL application → JDBC driver: submits SQL
- C client API → SQL protocol: encodes requests
- JDBC driver → Client discovery: finds database
- JDBC driver → SQL protocol: encodes requests
- SQL protocol → Network layer: transfers requests
- Network layer → SQL ingress: dispatches SQL
- SQL ingress → SQL integration: passes requests
- SQL integration → SQL engine: executes SQL
- SQL engine → SQL integration: returns results
- SQL integration → Transaction control: coordinates transactions
- Transaction control → Table layer: reads and writes
- Table layer → B-tree storage: accesses records
- Table layer → Metadata store: accesses metadata
- Transaction control → Replication: coordinates changes
- Replication → Cluster peers: replicates changes
- Database runtime → Schema changes: supports DDL
- Database runtime → Queue databases: supports queues
- Database runtime → Federated databases: supports remote data
- Database runtime → Stored procedures: supports procedures
- SQL integration → Plan tracking: tracks query plans