Remove zoekt_nodes unique URL indices
What does this MR do and why?
As I was trying to add internalAPI to GDK mode for zoekt-indexer, I encountered a bug with our current validation logic for index_base_url
and search_base_url
.
If you execute truncate
on a node, it won't be able to register anymore because it will try to use the same base URLs and fail validations and unique indices. The same situation can happen with self-managed customers if they re-use previously used URL when replacing a node.
To fix that we need to remove those validations/indices.
Screenshots or screen recordings
Screenshots are required for UI changes, and strongly recommended for all other merge requests.
2023/11/26 20:21:47 TASK_REQUEST_ERROR: TaskRequest responded with [422] {"message":"422 Unprocessable Entity"}
2023/11/26 20:21:55 TASK_REQUEST_ERROR: TaskRequest responded with [422] {"message":"422 Unprocessable Entity"}
2023/11/26 20:22:05 TASK_REQUEST_ERROR: TaskRequest responded with [422] {"message":"422 Unprocessable Entity"}
2023/11/26 20:22:15 TASK_REQUEST_ERROR: TaskRequest responded with [422] {"message":"422 Unprocessable Entity"}
2023/11/26 20:22:59 TASK_REQUEST_ERROR: TaskRequest responded with [422] {"message":"422 Unprocessable Entity"}
2023/11/26 20:23:00 TASK_REQUEST_ERROR: TaskRequest responded with [422] {"message":"422 Unprocessable Entity"}
2023/11/26 20:23:08 TASK_REQUEST_ERROR: TaskRequest responded with [422] {"message":"422 Unprocessable Entity"}
2023/11/26 20:23:19 TASK_REQUEST_ERROR: TaskRequest responded with [422] {"message":"422 Unprocessable Entity"}
2023/11/26 20:23:25 TASK_REQUEST_ERROR: TaskRequest responded with [422] {"message":"422 Unprocessable Entity"}
2023/11/26 20:23:35 TASK_REQUEST_ERROR: TaskRequest responded with [422] {"message":"422 Unprocessable Entity"}
How to set up and validate locally
[28] pry(main)> Search::Zoekt::Node.delete_all
=> 1
[29] pry(main)> Search::Zoekt::Node.find_or_initialize_by_task_request("uuid" => "0b24c06d-92f0-4d00-9403-1143fb6b7378", "node.url" => "http://localhost:6080", "disk.used" => 0, "disk.all" => 0, "node.name" => "zoekt_node").save!
=> true
[30] pry(main)> Search::Zoekt::Node.find_or_initialize_by_task_request("uuid" => "0b24c06d-92f0-4d00-9403-1143fb6b7300", "node.url" => "http://localhost:6080", "disk.used" => 0, "disk.all" => 0, "node.name" => "new_zoekt_node").save!
ActiveRecord::RecordInvalid: Validation failed: Index base url has already been taken, Search base url has already been taken
from /Users/dgruzd/.asdf/installs/ruby/3.1.4/lib/ruby/gems/3.1.0/gems/activerecord-7.0.8/lib/active_record/validations.rb:80:in `raise_validation_error'
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Edited by Dmitry Gruzd