Skip to content
Snippets Groups Projects
Verified Commit 87faa1dc authored by Omar Qunsul's avatar Omar Qunsul :two: Committed by GitLab
Browse files

Merge branch 'zoekt-improve-index-eviction-logic' into 'master'

Zoekt: Improve index eviction logic

See merge request !175564



Merged-by: default avatarOmar Qunsul <oqunsul@gitlab.com>
Approved-by: Terri Chu's avatarTerri Chu <tchu@gitlab.com>
Approved-by: default avatarOmar Qunsul <oqunsul@gitlab.com>
Reviewed-by: default avatarDmitry Gruzd <dgruzd@gitlab.com>
Reviewed-by: Terri Chu's avatarTerri Chu <tchu@gitlab.com>
Co-authored-by: default avatarDmitry Gruzd <dgruzd@gitlab.com>
parents 044509a7 7c442d9d
No related branches found
No related tags found
2 merge requests!181325Fix ambiguous `created_at` in project.rb,!175564Zoekt: Improve index eviction logic
Pipeline #1594288517 passed
# frozen_string_literal: true
class AddIndexToZoektIndicesOnWatermarkLevel < Gitlab::Database::Migration[2.2]
INDEX_NAME = 'index_zoekt_indices_on_watermark_level_and_id'
milestone '17.8'
disable_ddl_transaction!
def up
add_concurrent_index :zoekt_indices, [:watermark_level, :id], name: INDEX_NAME
end
def down
remove_concurrent_index_by_name :zoekt_indices, INDEX_NAME
end
end
4e5bf8fb0b9f000f8f8ed7fae0e024647756198074e1162015da8153cef709ed
\ No newline at end of file
......@@ -33619,6 +33619,8 @@ CREATE INDEX index_zoekt_indices_on_replica_id ON zoekt_indices USING btree (zoe
 
CREATE UNIQUE INDEX index_zoekt_indices_on_state_and_id ON zoekt_indices USING btree (state, id);
 
CREATE INDEX index_zoekt_indices_on_watermark_level_and_id ON zoekt_indices USING btree (watermark_level, id);
CREATE INDEX index_zoekt_indices_on_watermark_level_reserved_storage_bytes ON zoekt_indices USING btree (watermark_level, id) WHERE (reserved_storage_bytes > 0);
 
CREATE UNIQUE INDEX index_zoekt_indices_on_zoekt_node_id_and_id ON zoekt_indices USING btree (zoekt_node_id, id);
......@@ -16,9 +16,7 @@ def handle_event(event)
return unless index_ids.present?
Search::Zoekt::Index.critical_watermark_exceeded.id_in(index_ids).each_batch do |batch|
::Search::Zoekt::Replica.for_namespace(batch.select(:namespace_id)).each_batch do |batch|
batch.delete_all
end
::Search::Zoekt::Replica.id_in(batch.select(:zoekt_replica_id)).delete_all
end
end
end
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment