Skip to content

Bug 2080901 - [BMO-ETL] When any table fails to export, the entire snapshot should be rolled back to avoid incorrect results in charts/dashboards - #2784

Open
dklawren wants to merge 2 commits into
mozilla:masterfrom
dklawren:2080901

Conversation

@dklawren

Copy link
Copy Markdown
Collaborator

No description provided.

…apshot should be rolled back to avoid incorrect results in charts/dashboards
@dklawren
dklawren requested review from cgsheeh and a balanced review from Copilot October 14, 2026 22:02

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Changes recommended

Locking and remote query lifecycle issues can still allow duplicate snapshots or interrupt valid exports.

0 open findings

What changed in this PR

This PR aims to prevent partial BMO-ETL snapshots from affecting charts and dashboards by staging exports before transactional publication.

Changes:

  • Adds staging tables, transactional publication, and cleanup.
  • Introduces lock heartbeats, stale-lock recovery, and query polling.
  • Expands tests for retries, cleanup, locking, and invalid dates.
File Description
extensions/​BMO/​t/​bmo/​bmo_etl.t Adds export lifecycle and validation tests.
extensions/​BMO/​Extension.pm Adds the lock heartbeat column and migration.
extensions/​BMO/​bin/​export_bmo_etl.pl Implements staged publication and export lifecycle handling.

🧠 Review effort: Balanced


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Changes recommended

Query-result handling and lock/publication races can abort valid exports or duplicate snapshots.

0 open findings

🧠 Review effort: Balanced

Comment on lines +61 to +64
use constant LOCK_REFRESH_EVERY => 60; # one minute
use constant LOCK_STALE_AFTER => 10 * 60; # ten minutes
use constant LOCK_MAX_WAIT => 15 * 60; # fifteen minutes
use constant LOCK_POLL_INTERVAL => 30;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Should we make these configurable with defaults, in case we need to tweak them in the future?

logger("$staging_table has $count of $sent_counts{$table} rows, waiting.");
sleep 10;
}
if ($count != $sent_counts{$table}) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Should a count mismatch here be fatal? If a retried insertAll duplicates rows, the whole run fails even though staging has everything we need. Could we instead dedupe when copying out of staging (e.g. SELECT DISTINCT in the publish INSERT ... SELECT, since retried rows are identical) and relax this to $count >= $sent_counts{$table}?

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants