Skip to content

perf(backup): LanceDB dump で既存キャッシュを直接使用 - #560

Merged
hmjn023 merged 2 commits into
developfrom
perf/lancedb-dump-cache
Jun 30, 2026
Merged

hmjn023 merged 2 commits into
developfrom
perf/lancedb-dump-cache

Conversation

@hmjn023

@hmjn023 hmjn023 commented Jun 29, 2026

Copy link
Copy Markdown
Owner

概要

createDump の lancedb モードで、既存の LanceDB キャッシュディレクトリを直接 tar にパッケージするように最適化します。

変更内容

  • readMediaFilePaths を ILanceDbDumpService に追加(cache から id + filePath を取得)
  • createDump lancedb ブロックにキャッシュ存在チェックと分岐ロジックを追加
  • キャッシュあり: DB クエリ・writeToLanceDB をスキップし cache を直接 tar
  • キャッシュなし: 従来通り rebuild (fallback)
  • includeImages=true 時も cache から filePath を取得して画像を追加

技術詳細

syncSourceLanceDBCache / syncSourceLanceDBDeltaCache が常時最新のキャッシュを維持しているため、dump 時の再構築は不要。metadata only dump でも DB に全件クエリが飛っていた問題を解消します。

…ng from DB

createDump lancedb mode now checks for an existing cache directory
(.cache/lancedb-cache/source-{id}/). When found, the cache is
tarred directly without DB queries or writeToLanceDB rebuild.
Falls back to the original rebuild path when cache is unavailable.
@coderabbitai

coderabbitai Bot commented Jun 29, 2026 •

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: f8b895d0-3f54-4a21-9438-1f5d50a48811

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch perf/lancedb-dump-cache

Comment @coderabbitai help to get the list of available commands.

@gemini-code-assist gemini-code-assist Bot 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.

Code Review

このプルリクエストでは、targetMode が "lancedb" の場合にローカルキャッシュを利用して高速にバックアップ(TARアーカイブ)を作成する処理が追加されました。キャッシュが存在しない場合は、従来通りデータベースから再構築するフォールバック処理が実行されます。レビューでは、キャッシュ存在確認の厳密化(manifest.json の確認)やエラーハンドリングによる安全なフォールバックの確保、画像の並列ダウンロードによるパフォーマンス向上、およびメモリ上限(OOM)対策として一時ディレクトリへの書き出しを行うことなどが提案されています。また、アーカイブ作成中のキャッシュ書き込みとの競合を防ぐための排他制御や一時コピーの作成についても指摘されています。

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread apps/server/src/application/services/backup-service.ts Outdated
Comment thread apps/server/src/application/services/backup-service.ts Outdated
- Check manifest.json instead of just directory existence
- Wrap cache path in try-catch for safe fallback to DB rebuild
- Parallelize image downloads with Promise.all
- Only readMediaFilePaths when includeImages is true
@hmjn023
hmjn023 merged commit 1ba477f into develop Jun 30, 2026
1 check passed
@hmjn023
hmjn023 deleted the perf/lancedb-dump-cache branch June 30, 2026 14:28
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.

1 participant