Add delete route and required code to clean up a vectorize job.#259
Merged
Add delete route and required code to clean up a vectorize job.#259
Conversation
ChuckHend
approved these changes
Oct 20, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add DELETE endpoint for vectorize jobs
Summary
Adds a
DELETE /api/v1/table/{job_name}endpoint to clean up all resources associated with a vectorize job, including database objects, PGMQ messages, and in-memory cache.Changes
Core (
core/)src/query.rs: Added SQL generation functions for cleanup operations:drop_embeddings_table(),drop_search_tokens_table(),drop_project_view()drop_trigger_handler(),drop_event_trigger(),drop_search_tokens_trigger()delete_job_record()src/init.rs: Addedcleanup_job()function to orchestrate resource cleanup:Server (
server/)src/routes/table.rs: Addeddelete_table()endpoint handlerDELETE /api/v1/table/{job_name}routesrc/server.rs: Registered the new DELETE routeWorkers (
worker/&extension/)Ok()instead of error to allow message deletionResources Cleaned Up
vectorize._embeddings_{job_name}) and HNSW indexvectorize._search_tokens_{job_name}) and FTS indexvectorize.{job_name}_view)vectorize.handle_update_{job_name})vectorize.jobtableNote: Source table and its data are preserved (not deleted).
Tests
Unit Tests (8 tests in
core/src/query.rs)Integration Tests (5 tests in
server/tests/tests.rs)test_delete_job- Full lifecycle verificationtest_delete_nonexistent_job- 404 error handlingtest_delete_job_idempotency- Double delete protectiontest_delete_job_preserves_source_table- Data integritytest_delete_job_with_pending_messages- PGMQ cleanupUsage