You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
DROP POLICY IF EXISTS tenant_isolation_policy ON zoekt_index_jobs;
26
+
CREATE POLICY tenant_isolation_policy ON zoekt_index_jobs AS PERMISSIVE FOR ALL TO PUBLIC USING (( SELECT (current_setting('app.current_tenant'::text) ='workertenant'::text)) OR (tenant_id = ( SELECT (NULLIF(current_setting('app.current_tenant'::text), 'workertenant'::text))::integerAS current_tenant)));
27
+
28
+
-- Ensure only one pending/running zoekt index job per repo at a time.
29
+
CREATEUNIQUE INDEXIF NOT EXISTS zoekt_index_jobs_one_concurrent_per_repo ON zoekt_index_jobs (repository_id, tenant_id) WHERE (state IN('queued', 'processing', 'errored'));
30
+
31
+
-- Ensure dequeues are fast.
32
+
CREATEINDEXIF NOT EXISTS zoekt_index_jobs_dequeue_idx ON zoekt_index_jobs (state, process_after);
33
+
CREATEINDEXIF NOT EXISTS zoekt_index_jobs_dequeue_order_idx ON zoekt_index_jobs (priority DESC, coalesce(process_after, queued_at) ASC, id ASC, tenant_id);
34
+
35
+
-- Speed up lookups by repo ID and foreign key cascades on repository_id.
36
+
CREATEINDEXIF NOT EXISTS
37
+
idx_zoekt_index_jobs_repository_id
38
+
ON zoekt_index_jobs (tenant_id, repository_id);
39
+
40
+
-- Index added by later migration 1744156395
41
+
CREATEINDEXIF NOT EXISTS zoekt_index_jobs_repository_id ON zoekt_index_jobs (repository_id);
COMMENT ON COLUMN deepsearch_references.file_path IS 'File path can be empty because some agent tools only produce repo or commit information but not file content. We use empty string as the sentinel value so that the unique constraint works correctly';
created_at timestamp without time zone DEFAULT now() NOT NULL
2386
-
);
2387
-
2388
-
COMMENT ON COLUMN deepsearch_references.file_path IS 'File path can be empty because some agent tools only produce repo or commit information but not file content. We use empty string as the sentinel value so that the unique constraint works correctly';
2389
-
2390
-
CREATESEQUENCEdeepsearch_references_id_seq
2391
-
ASinteger
2392
-
START WITH 1
2393
-
INCREMENT BY 1
2394
-
NO MINVALUE
2395
-
NO MAXVALUE
2396
-
CACHE 1;
2397
-
2398
-
ALTERSEQUENCE deepsearch_references_id_seq OWNED BY deepsearch_references.id;
@@ -7263,8 +7201,6 @@ CREATE INDEX idx_repo_update_jobs_repository_id ON repo_update_jobs USING btree
7263
7201
7264
7202
CREATEINDEXidx_user_id_created_atON cody_audit_log USING btree (user_id, created_at);
7265
7203
7266
-
CREATEINDEXidx_zoekt_index_jobs_repository_idON zoekt_index_jobs USING btree (tenant_id, repository_id);
7267
-
7268
7204
CREATEINDEXinsights_query_runner_jobs_cost_idxON insights_query_runner_jobs USING btree (cost);
7269
7205
7270
7206
CREATEINDEXinsights_query_runner_jobs_dependencies_job_id_fk_idxON insights_query_runner_jobs_dependencies USING btree (job_id);
@@ -7569,14 +7505,6 @@ CREATE INDEX webhook_logs_received_at_idx ON webhook_logs USING btree (received_
7569
7505
7570
7506
CREATEINDEXwebhook_logs_status_code_idxON webhook_logs USING btree (status_code);
7571
7507
7572
-
CREATEINDEXzoekt_index_jobs_dequeue_idxON zoekt_index_jobs USING btree (state, process_after);
7573
-
7574
-
CREATEINDEXzoekt_index_jobs_dequeue_order_idxON zoekt_index_jobs USING btree (priority DESC, COALESCE(process_after, queued_at), id, tenant_id);
7575
-
7576
-
CREATEUNIQUE INDEXzoekt_index_jobs_one_concurrent_per_repoON zoekt_index_jobs USING btree (repository_id, tenant_id) WHERE (state = ANY (ARRAY['queued'::text, 'processing'::text, 'errored'::text]));
7577
-
7578
-
CREATEINDEXzoekt_index_jobs_repository_idON zoekt_index_jobs USING btree (repository_id);
7579
-
7580
7508
CREATEINDEXzoekt_repos_index_statusON zoekt_repos USING btree (index_status);
7581
7509
7582
7510
CREATETRIGGERbatch_spec_workspace_execution_last_dequeues_insert AFTER INSERT ON batch_spec_workspace_execution_jobs REFERENCING NEW TABLE AS newtab FOR EACH STATEMENT EXECUTE FUNCTION batch_spec_workspace_execution_last_dequeues_upsert();
@@ -7878,12 +7806,6 @@ ALTER TABLE ONLY deepsearch_questions
0 commit comments