Skip to content

refactor(db): Add MVE scheduler support#1243

Open
michalkrzyz wants to merge 2 commits into
mainfrom
mikrzyz/issue-1031
Open

refactor(db): Add MVE scheduler support#1243
michalkrzyz wants to merge 2 commits into
mainfrom
mikrzyz/issue-1031

Conversation

@michalkrzyz

Copy link
Copy Markdown
Collaborator

On-behalf-of: SAP Michal Krzyz michal.krzyz@sap.com

Description

  • Add MVE (Materialized View Engine) scheduler
  • Remove list of post migration procedures from sql schema
  • Adjust e2e for db_migration

Please include a summary of the changes and the related issue. Please also include relevant motivation and context. List any dependencies that are required for this change.

What type of PR is this? (check all applicable)

  • 🍕 Feature
  • 🐛 Bug Fix
  • 📝 Documentation Update
  • 🎨 Style
  • 🧑‍💻 Code Refactor
  • 🔥 Performance Improvements
  • ✅ Test
  • 🤖 Build
  • 🔁 CI
  • 📦 Chore (Release)
  • ⏩ Revert

Related Tickets & Documents

  • Related Issue # (issue)
  • Closes # (issue)
  • Fixes # (issue)

Remove if not applicable

Added tests?

  • 👍 yes
  • 🙅 no, because they aren't needed
  • 🙋 no, because I need help
  • Separate ticket for tests # (issue/pr)

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration

Added to documentation?

  • 📜 README.md
  • 🤝 Documentation pages updated
  • 🙅 no documentation needed
  • (if applicable) generated OpenAPI docs for CRD changes

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

Copilot AI review requested due to automatic review settings July 1, 2026 16:20

Copilot AI left a comment

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.

Pull request overview

This PR refactors MariaDB “post-migration” behavior by introducing an MVE (Materialized View Engine) scheduler that periodically triggers MV refresh stored procedures, while removing the legacy post-migration procedure registry mechanism and adapting e2e migration tests accordingly.

Changes:

  • Add an MVE scheduler/trigger implementation in the MariaDB layer and integrate it into the migration flow.
  • Remove the legacy post_migration_procedure_registry table and related stored procedures via a new migration.
  • Update e2e DB migration tests/fixtures to stop using the removed post-migration registry and instead configure MVE procedures directly.

Reviewed changes

Copilot reviewed 12 out of 13 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
internal/database/mariadb/mve.go Introduces MVE trigger + scheduler implementation and first-run wait signaling.
internal/database/mariadb/migration.go Switches post-migration handling to MVE scheduler (async) and TriggerMVE (sync), and changes WaitPostMigrations semantics.
internal/database/interface.go Updates Database interface to make WaitPostMigrations non-error-returning.
internal/app/heureka.go Aligns app wrapper method signature with updated database interface.
internal/e2e/common/server.go Updates server startup helper to call WaitPostMigrations without asserting on an error return.
internal/e2e/db_migration_test.go Adjusts e2e migration setup to configure MVE procedures and removes post-migration registry fixture usage.
internal/e2e/migrations/70250915164215_add_post_migration.up.sql Removes obsolete e2e migration fixture that registered a post-migration procedure.
internal/e2e/migrations/70250915164215_add_post_migration.down.sql Removes obsolete e2e migration fixture down script.
internal/database/mariadb/migrations/20260701112108_app_scheduler.up.sql Drops legacy post-migration registry table/procedures.
internal/database/mariadb/migrations/20260701112108_app_scheduler.down.sql Restores legacy post-migration registry table/procedures on rollback.
go.mod Adds scheduler-related dependencies (includes an apparently unused gocron/v2 entry).
go.sum Updates module sums for the newly introduced dependencies.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread internal/database/mariadb/mve.go
Comment thread internal/database/mariadb/mve.go
Comment thread internal/database/mariadb/mve.go
Comment thread internal/database/mariadb/mve.go Outdated
Comment thread go.mod Outdated
@michalkrzyz michalkrzyz marked this pull request as draft July 2, 2026 06:17
@michalkrzyz michalkrzyz force-pushed the mikrzyz/issue-1031 branch 2 times, most recently from 509b671 to 15a3e8c Compare July 2, 2026 09:10
@michalkrzyz michalkrzyz marked this pull request as ready for review July 2, 2026 09:10
@michalkrzyz michalkrzyz requested a review from Copilot July 2, 2026 09:19

Copilot AI left a comment

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.

Pull request overview

Copilot reviewed 12 out of 13 changed files in this pull request and generated 4 comments.

Comment thread internal/database/mariadb/mve.go
Comment thread internal/database/mariadb/mve.go
Comment thread internal/database/mariadb/mve.go
Comment thread internal/e2e/common/server.go
@michalkrzyz michalkrzyz marked this pull request as draft July 3, 2026 09:12
@michalkrzyz michalkrzyz force-pushed the mikrzyz/issue-1031 branch 3 times, most recently from a815820 to ad72c15 Compare July 3, 2026 11:20
@michalkrzyz michalkrzyz marked this pull request as ready for review July 3, 2026 11:21
@michalkrzyz michalkrzyz force-pushed the mikrzyz/issue-1031 branch 2 times, most recently from 81392d0 to 117231f Compare July 3, 2026 12:57
On-behalf-of: SAP Michal Krzyz <michal.krzyz@sap.com>
Signed-off-by: Michal Krzyz <michalkrzyz@gmail.com>
@michalkrzyz michalkrzyz force-pushed the mikrzyz/issue-1031 branch from 117231f to 44f68af Compare July 3, 2026 13:06
On-behalf-of: SAP Michal Krzyz <michal.krzyz@sap.com>
Signed-off-by: Michal Krzyz <michalkrzyz@gmail.com>
@michalkrzyz michalkrzyz force-pushed the mikrzyz/issue-1031 branch from 4626040 to 38f615d Compare July 9, 2026 06:53
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.

2 participants