Skip to content

fix(storage): remove routed USE db dependency#187

Merged
mergify[bot] merged 2 commits intomatrixorigin:mainfrom
gouhongshen:fix/multidb-purge-qualified-sql
Apr 17, 2026
Merged

fix(storage): remove routed USE db dependency#187
mergify[bot] merged 2 commits intomatrixorigin:mainfrom
gouhongshen:fix/multidb-purge-qualified-sql

Conversation

@gouhongshen
Copy link
Copy Markdown
Contributor

Summary

  • remove session-level USE db switching from routed stores
  • qualify remaining routed multi-db SQL with db.table names
  • add a multi-db purge API regression test covering memory_ids, topic, and session_id

Validation

  • cargo test -p memoria-api --test api_multi_db_purge -- --nocapture
  • cargo test -p memoria-api --test api_e2e test_remote_purge_ -- --nocapture

Route multi-db queries through fully qualified db.table references instead of session-level USE statements, and add an API regression test for purge paths.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings April 16, 2026 16:56
Copy link
Copy Markdown

Copilot AI left a comment

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 removes reliance on session-level USE <db> switching for routed (multi-DB) stores by making routed SQL explicitly target db.table via t(), and adds an integration regression test to ensure purge paths work correctly in multi-DB mode.

Changes:

  • Remove USE <db> execution from SqlMemoryStore::conn() and require qualified table usage for routed stores.
  • Update several store queries to use self.t("table")-qualified names (including joins and governance/lock paths).
  • Add a multi-DB purge API regression test covering purge by memory_ids, topic, and session_id.

Reviewed changes

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

File Description
memoria/crates/memoria-storage/src/store.rs Drops session USE switching and qualifies routed SQL via t() for multi-DB correctness.
memoria/crates/memoria-storage/src/router.rs Updates documentation to reflect the fully-qualified-table routing approach.
memoria/crates/memoria-storage/src/graph/store.rs Updates documentation to reflect table qualification by db_name.
memoria/crates/memoria-api/tests/api_multi_db_purge.rs Adds a multi-DB integration test to validate purge endpoints without USE db.

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

Comment thread memoria/crates/memoria-api/tests/api_multi_db_purge.rs
Comment thread memoria/crates/memoria-api/tests/api_multi_db_purge.rs
- Assert health check success instead of silently proceeding on failure
- Decouple JoinHandle type from Axum version (JoinHandle<()> vs std::io::Result)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@mergify
Copy link
Copy Markdown

mergify Bot commented Apr 17, 2026

Merge Queue Status

  • Entered queue2026-04-17 03:06 UTC · Rule: main
  • Checks skipped · PR is already up-to-date
  • Merged2026-04-17 03:06 UTC · at e585de1c479be8cc3c37c37aa87418cd29c258d5

This pull request spent 7 seconds in the queue, including 1 second running CI.

Required conditions to merge

@mergify mergify Bot merged commit 11603af into matrixorigin:main Apr 17, 2026
6 checks passed
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