Allow elastic client adapter to be set
What does this MR do and why?
This MR re-instates a reverted MR. I added the fix in a separate fixup commit to ease review from the original MR
The fix included:
- add null check operator when using
options[:client_adapter]
- adding
.to_sym
to value - adding some tests which fail before the fix
References
merge requests
- Original: !204437 (merged)
- Revert: !205662 (merged)
issues
- TCP connections from GitLab processes accumulat... (#550805 - closed)
- Reinstate https://gitlab.com/gitlab-org/gitlab/... (#571222 - closed)
Screenshots or screen recordings
Before | After |
---|---|
How to set up and validate locally
- enable elasticsearch for gdk
- setup a new connection for the elastic adapter
es_connection = Ai::ActiveContext::Connection.create!(name: 'es-test-adapter', adapter_class: "ActiveContext::Databases::Elasticsearch::Adapter", options: { use_advanced_search_config: true } )
- activate connection
es_connection.activate!
- reload or restart rails console
reload!
- run the migration worker
Ai::ActiveContext::MigrationWorker.new.perform
logs before
{
"severity": "INFO",
"time": "2025-09-19T12:59:27.664Z",
"class": "Ai::ActiveContext::MigrationWorker",
"message": "Ai::ActiveContext::MigrationWorker: Created missing migration records for 20250423135734, 20250430114936, 20250508151423",
"job_status": "running",
"queue": "default",
"jid": null
}
{
"severity": "INFO",
"time": "2025-09-19T12:59:27.667Z",
"class": "Ai::ActiveContext::MigrationWorker",
"message": "Ai::ActiveContext::MigrationWorker: Starting migration 20250423135734",
"job_status": "running",
"queue": "default",
"jid": null
}
{
"severity": "INFO",
"time": "2025-09-19T12:59:27.672Z",
"class": "Ai::ActiveContext::MigrationWorker",
"message": "Ai::ActiveContext::MigrationWorker: Migration 20250423135734 failed: wrong constant name typhoeus. Retries left: 2",
"job_status": "running",
"queue": "default",
"jid": null
}
logs after
{
"severity": "INFO",
"time": "2025-09-19T13:00:31.529Z",
"class": "Ai::ActiveContext::MigrationWorker",
"message": "Ai::ActiveContext::MigrationWorker: Starting migration 20250423135734",
"job_status": "running",
"queue": "default",
"jid": null
}
{
"severity": "INFO",
"time": "2025-09-19T13:00:31.554Z",
"class": "Ai::ActiveContext::MigrationWorker",
"message": "Ai::ActiveContext::MigrationWorker: Marking migration 20250423135734 as completed",
"job_status": "running",
"queue": "default",
"jid": null
}
MR acceptance checklist
Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
Related to #550805 (closed)
Edited by Terri Chu