Repository navigation
[2.0] Fixes #37316: key BigQuery DDL cache by FQN for concurrent dataset safety (backport 2.0 #37333) - #38234
Conversation
❌ PR checklist incompleteThis PR cannot be merged until the following are addressed on its linked issue:
The fields live on the linked issue in the Shipping project (open the issue → right sidebar → Projects). After you set them, re-run this check (or push a commit) — issue/project changes do not re-trigger it automatically. Maintainers can bypass this check by adding the |
Code Review ✅ Approved 🟡 Medium riskThread-local, dataset-scoped BigQuery DDL caching changes metadata extraction under concurrency; mismatched table definitions could be reported if cache selection fails. Keys the BigQuery DDL cache per schema worker thread using VerificationRules No rules evaluated Functional validation Not enabledAuto-approval Not enabledFor more verification details, comment OptionsDisplay: compact → Showing compact verification results. Comment with these commands to change the behavior for this request:
Was this helpful? React with 👍 / 👎 | Powered by Gitar — free for open source |
| ddls = self._fetch_table_ddls(database, schema_name) | ||
| self._ddl_local.dataset_key = f"{database}.{schema_name}" | ||
| self._ddl_local.ddls = ddls |
There was a problem hiding this comment.
DDL cache has no limit.
_load_table_ddls keeps every table definition in a plain dictionary for each worker. Limiting storage to one dataset per worker does not limit the number or size of those definitions. Large datasets can therefore consume substantial memory across concurrent workers.
The repository requires all caches to have an explicit size cap. Keep the thread separation, but use bounded batches or bounded storage with a fallback that still returns definitions for tables outside the cache.
Context Used: CLAUDE.md (source)
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
Fixes #37316
Backport of #37333 to 2.0.
threading.local()), so concurrent datasets withincludeDDLandthreads > 1no longer clear or overwrite each other's DDLs.🤖 Generated with Claude Code
The thread separation looks sound, but the existing bounded-cache requirement must be satisfied before merging.
Findings
Summary
Moves BigQuery's DDL cache from shared storage to
threading.local()so concurrent schema workers keep separate definitions.Diagram
%%{init: {'theme': 'neutral'}}%% flowchart TD A[Schema worker] --> B[Fetch dataset DDLs] B --> C[Keep definitions in thread-local storage] C --> D{Project and dataset match?} D -->|Yes| E[Read table definition] D -->|No| BReviews (2) · Last reviewed commit: "[2.0] Fixes #37316: key BigQuery DDL cac..." · Reviewed by Greptile