Proposal: Transition to Single Table BigQuery Coverage
Overview
Currently, the coverage merger collects data from per-namespace BigQuery tables (syzbot_coverage.<namespace>). We want to transition to using single tables instead, to simplify management and enable coverage for all namespaces.
We propose using two shared tables:
syzbot_coverage.public: For public kernel namespaces.
- <...>
These tables will have an additional namespace column to distinguish the data.
Cost vs. Maintenance Trade-off
-
Data Retrieval Cost: Querying shared tables will be slightly more expensive because we will be scanning larger partitions (which now contain data for multiple namespaces).
-
Maintenance Benefit: This change significantly reduces maintenance overhead. We will manage only 2 tables instead of $N$ tables (where $N$ grows with every new namespace). Onboarding new namespaces will no longer require creating new BigQuery tables or configuring new GCS-to-BQ data transfers.
-
Mitigation: To minimize the cost increase, we are making
namespace the primary clustering key in the new tables. This allows BigQuery to prune blocks and scan only the data relevant to the target namespace.
Overall, the reduction in maintenance cost and ease of onboarding new namespaces outweighs the minor increase in BigQuery query costs.
Proposed Technical Changes
To support a gradual, namespace-by-namespace transition, we propose the following changes:
- Schema Update (
pkg/coveragedb/bq-schema.json): Add a required namespace column.
syz-ci Updates:
- Update
syz-ci to include the namespace in the raw coverage JSONL files uploaded to GCS.
- Merger & Tool Updates (
pkg/covermerger, tools/syz-covermerger, tools/syz-bq.sh):
- Update
InitNsRecords to accept an optional tableName.
- If
tableName is provided, query that table and filter by namespace.
- If empty (fallback/transition state), query the old per-namespace table?
- Update
syz-bq.sh to accept -e <table_name> and conditionally query either the table directly (new) or INFORMATION_SCHEMA.PARTITIONS (old).
- Get rid of syz-bq.sh and rewrite it in golang?
- Dashboard Updates (
dashboard/app):
- Add
UseSingleTable flag to CoverageConfig.
- Add logic to route queries to new tables based on namespace access level if
UseSingleTable is enabled.
Clustering Key Optimization
For the new tables, we propose changing the clustering keys:
- Current clustering:
file_path, kernel_commit, hit_count
- Proposed clustering:
namespace, file_path, kernel_commit
Proposed Rollout Plan
To ensure zero data loss and minimal disruption, we propose the following phased rollout:
Phase 1: Preparation (Backward Compatible)
Alter Old Tables: Add namespace column (optional) to all existing per-namespace tables.
- Add the namespace discovery API: It is a prerequisite for the syz-ci changes.
- Deploy
syz-ci: Deploy updated syz-ci. It will start uploading new format (with namespace), which old tables will accept.
- Deploy Dashboard (Inactive): Deploy dashboard code changes with
UseSingleTable: false to verify old path stability.
- Create New Tables: Create
public and XXX tables with namespace as REQUIRED, clustered by namespace, file_path, kernel_commit.### Phase 2: Migration/Switchover1. Pause Transfers: Temporarily pause BigQuery Data Transfers.2. Migrate History: Copy historical data from old tables to new tables, backfilling the namespace column (e.g., COALESCE(namespace, 'upstream')).
- Update & Resume Transfers: Point Data Transfers to new tables and resume them.
- Enable Dashboard: Set
UseSingleTable: true in dashboard config for transitioned namespaces and deploy.
Phase 3: Cleanup
- After 1-2 quarters of stability, delete old per-namespace tables and remove legacy fallback code.
Rollback Plan
If issues arise after switchover, we can rollback by:
- Reverting dashboard config (
UseSingleTable: false).
- Pointing Data Transfers back to old tables.
Proposal: Transition to Single Table BigQuery Coverage
Overview
Currently, the coverage merger collects data from per-namespace BigQuery tables (
syzbot_coverage.<namespace>). We want to transition to using single tables instead, to simplify management and enable coverage for all namespaces.We propose using two shared tables:
syzbot_coverage.public: For public kernel namespaces.These tables will have an additional
namespacecolumn to distinguish the data.Cost vs. Maintenance Trade-off
namespacethe primary clustering key in the new tables. This allows BigQuery to prune blocks and scan only the data relevant to the target namespace.Overall, the reduction in maintenance cost and ease of onboarding new namespaces outweighs the minor increase in BigQuery query costs.
Proposed Technical Changes
To support a gradual, namespace-by-namespace transition, we propose the following changes:
pkg/coveragedb/bq-schema.json): Add a requirednamespacecolumn.syz-ciUpdates:syz-cito include thenamespacein the raw coverage JSONL files uploaded to GCS.pkg/covermerger,tools/syz-covermerger,tools/syz-bq.sh):InitNsRecordsto accept an optionaltableName.tableNameis provided, query that table and filter bynamespace.syz-bq.shto accept-e <table_name>and conditionally query either the table directly (new) orINFORMATION_SCHEMA.PARTITIONS(old).dashboard/app):UseSingleTableflag toCoverageConfig.UseSingleTableis enabled.Clustering Key Optimization
For the new tables, we propose changing the clustering keys:
file_path, kernel_commit, hit_countnamespace, file_path, kernel_commitProposed Rollout Plan
To ensure zero data loss and minimal disruption, we propose the following phased rollout:
Phase 1: Preparation (Backward Compatible)
Alter Old Tables: Addnamespacecolumn (optional) to all existing per-namespace tables.syz-ci: Deploy updatedsyz-ci. It will start uploading new format (with namespace), which old tables will accept.UseSingleTable: falseto verify old path stability.publicandXXXtables withnamespaceas REQUIRED, clustered bynamespace, file_path, kernel_commit.### Phase 2: Migration/Switchover1. Pause Transfers: Temporarily pause BigQuery Data Transfers.2. Migrate History: Copy historical data from old tables to new tables, backfilling thenamespacecolumn (e.g.,COALESCE(namespace, 'upstream')).UseSingleTable: truein dashboard config for transitioned namespaces and deploy.Phase 3: Cleanup
Rollback Plan
If issues arise after switchover, we can rollback by:
UseSingleTable: false).