[PR #25399] fix: include DROP INDEX in transaction to prevent missing index on rollback #18195

Open
opened 2026-02-05 16:34:17 +03:00 by OVERLORD · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/immich-app/immich/pull/25399
Author: @haoxi911
Created: 1/20/2026
Status: 🔄 Open

Base: mainHead: fix/drop_index_not_in_transaction


📝 Commits (3)

  • dd60a33 fix: ERR_PNPM_ENOENT error while make dev on macOS.
  • 484eab7 fix: include DROP INDEX in transaction to prevent missing index on rollback.
  • 3d5e1ff chore: clean up this PR.

📊 Changes

1 file changed (+4 additions, -4 deletions)

View changed files

📝 server/src/repositories/database.repository.ts (+4 -4)

📄 Description

Description

I have a large dataset. When the number of vector records exceeds a certain threshold, the reindexVectors method is called during system boot. Since the vector index is enormous, the transaction costed too much system resources and resulted in an error and was rolled back. However, because the DROP INDEX command was not included in the transaction, I ended up without any vector indexes.

How Has This Been Tested?

  • Transaction rollbacks were performed, and the previous vector index was retained.

Screenshots (if appropriate)

Checklist:

  • I have performed a self-review of my own code
  • I have made corresponding changes to the documentation if applicable
  • I have no unrelated changes in the PR.
  • I have confirmed that any new dependencies are strictly necessary.
  • I have written tests for new code (if applicable)
  • I have followed naming conventions/patterns in the surrounding code
  • All code in src/services/ uses repositories implementations for database calls, filesystem operations, etc.
  • All code in src/repositories/ is pretty basic/simple and does not have any immich specific logic (that belongs in src/services/)

Please describe to which degree, if any, an LLM was used in creating this pull request.

...


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/immich-app/immich/pull/25399 **Author:** [@haoxi911](https://github.com/haoxi911) **Created:** 1/20/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `fix/drop_index_not_in_transaction` --- ### 📝 Commits (3) - [`dd60a33`](https://github.com/immich-app/immich/commit/dd60a33283545615f7493f88a9d51c8ac78f994a) fix: ERR_PNPM_ENOENT error while `make dev` on macOS. - [`484eab7`](https://github.com/immich-app/immich/commit/484eab7407e20a68a3ff00a74824a65b191c40c2) fix: include `DROP INDEX` in transaction to prevent missing index on rollback. - [`3d5e1ff`](https://github.com/immich-app/immich/commit/3d5e1fffdfb34409112f5a3da69160c4b958af76) chore: clean up this PR. ### 📊 Changes **1 file changed** (+4 additions, -4 deletions) <details> <summary>View changed files</summary> 📝 `server/src/repositories/database.repository.ts` (+4 -4) </details> ### 📄 Description ## Description <!--- Describe your changes in detail --> <!--- Why is this change required? What problem does it solve? --> <!--- If it fixes an open issue, please link to the issue here. --> I have a large dataset. When the number of vector records exceeds a certain threshold, the `reindexVectors` method is called during system boot. Since the vector index is enormous, the transaction costed too much system resources and resulted in an error and was rolled back. However, because the `DROP INDEX` command was not included in the transaction, I ended up without any vector indexes. ## How Has This Been Tested? <!-- 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 --> - [x] Transaction rollbacks were performed, and the previous vector index was retained. <details><summary><h2>Screenshots (if appropriate)</h2></summary> <!-- Images go below this line. --> </details> <!-- API endpoint changes (if relevant) ## API Changes The `/api/something` endpoint is now `/api/something-else` --> ## Checklist: - [x] I have performed a self-review of my own code - [x] I have made corresponding changes to the documentation if applicable - [x] I have no unrelated changes in the PR. - [x] I have confirmed that any new dependencies are strictly necessary. - [x] I have written tests for new code (if applicable) - [x] I have followed naming conventions/patterns in the surrounding code - [x] All code in `src/services/` uses repositories implementations for database calls, filesystem operations, etc. - [x] All code in `src/repositories/` is pretty basic/simple and does not have any immich specific logic (that belongs in `src/services/`) ## Please describe to which degree, if any, an LLM was used in creating this pull request. ... --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
OVERLORD added the pull-request label 2026-02-05 16:34:17 +03:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: immich-app/immich#18195