Skip to content

[2.0] Fixes #37316: key BigQuery DDL cache by FQN for concurrent dataset safety (backport 2.0 #37333) - #38234

Merged
Khairajani merged 1 commit into
2.0from
bp-37333-2.0
Nov 20, 2026
Merged

Khairajani merged 1 commit into
2.0from
bp-37333-2.0

Conversation

@Khairajani

@Khairajani Khairajani commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #37316

Backport of #37333 to 2.0.

  • BigQuery DDLs are held per schema worker thread (threading.local()), so concurrent datasets with includeDDL and threads > 1 no longer clear or overwrite each other's DDLs.
  • Source change applies as-is. The test file conflicted only because 2.0 lacks main's Delta Lake tests; those were left out and only the DDL tests were kept.
  • BigQuery unit tests pass on 2.0 (106).

🤖 Generated with Claude Code

RetriggerView in GreptileConfidence Score: 4/5

The thread separation looks sound, but the existing bounded-cache requirement must be satisfied before merging.

Findings

  1. P2 DDL cache has no limit. ▶

Summary

Moves BigQuery's DDL cache from shared storage to threading.local() so concurrent schema workers keep separate definitions.

  • BigQuery keeps each dataset worker's table DDLs separate.

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| B
Loading

Reviews (2) · Last reviewed commit: "[2.0] Fixes #37316: key BigQuery DDL cac..." · Reviewed by Greptile

…set safety (#37333)

Backport of #37333. Each schema worker thread holds only its current
dataset's DDLs in a thread-local slot, so concurrent datasets no longer
clear or overwrite each other's entries.

(cherry picked from commit dbed533)
@Khairajani
Khairajani requested a review from a team as a code owner November 19, 2026 16:42
@Khairajani Khairajani added the safe to test Add this label to run secure Github workflows on PRs label Nov 19, 2026
@Khairajani
Khairajani requested review from ulixius9 and removed request for a team November 19, 2026 16:42
@github-actions

Copy link
Copy Markdown
Contributor

❌ PR checklist incomplete

This PR cannot be merged until the following are addressed on its linked issue:

  • No GitHub issue is linked. Link an issue in the Development section of the PR (or add Fixes #12345 to the description). For a same-org cross-repo issue, add Fixes open-metadata/<repo>#123 to the description.

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 skip-pr-checks label.

@gitar-bot

gitar-bot Bot commented Nov 19, 2026 •

Copy link
Copy Markdown
Code Review ✅ Approved 🟡 Medium risk

Thread-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 threading.local(), so concurrent datasets with includeDDL and threads > 1 no longer clear or overwrite each other's DDLs. No issues found.

Verification

Rules No rules evaluated

Functional validation Not enabled

Set up

Auto-approval Not enabled

Set up

For more verification details, comment gitar display:verbose.

Options

Display: compact → Showing compact verification results.

Comment with these commands to change the behavior for this request:

Compact
gitar display:verbose         

Was this helpful? React with 👍 / 👎 | Powered by Gitar — free for open source

Comment on lines +885 to +887
ddls = self._fetch_table_ddls(database, schema_name)
self._ddl_local.dataset_key = f"{database}.{schema_name}"
self._ddl_local.ddls = ddls

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 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!

@Khairajani
Khairajani merged commit 3d7d95d into 2.0 Nov 20, 2026
68 of 75 checks passed
@Khairajani
Khairajani deleted the bp-37333-2.0 branch November 20, 2026 05:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

safe to test Add this label to run secure Github workflows on PRs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant