mirror of
https://github.com/mastodon/mastodon.git
synced 2025-05-07 12:16:14 +00:00
Add warning for Elasticsearch index analyzers mismatch (#34515)
This commit is contained in:
parent
1326c8cb1d
commit
7a70d95435
|
@ -38,6 +38,11 @@ class Admin::SystemCheck::ElasticsearchCheck < Admin::SystemCheck::BaseCheck
|
||||||
:elasticsearch_index_mismatch,
|
:elasticsearch_index_mismatch,
|
||||||
mismatched_indexes.join(' ')
|
mismatched_indexes.join(' ')
|
||||||
)
|
)
|
||||||
|
elsif !specifications_match?
|
||||||
|
Admin::SystemCheck::Message.new(
|
||||||
|
:elasticsearch_analysis_mismatch,
|
||||||
|
mismatched_specifications_indexes.join(' ')
|
||||||
|
)
|
||||||
elsif cluster_health['status'] == 'red'
|
elsif cluster_health['status'] == 'red'
|
||||||
Admin::SystemCheck::Message.new(:elasticsearch_health_red)
|
Admin::SystemCheck::Message.new(:elasticsearch_health_red)
|
||||||
elsif cluster_health['number_of_nodes'] < 2 && es_preset != 'single_node_cluster'
|
elsif cluster_health['number_of_nodes'] < 2 && es_preset != 'single_node_cluster'
|
||||||
|
@ -111,10 +116,20 @@ class Admin::SystemCheck::ElasticsearchCheck < Admin::SystemCheck::BaseCheck
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def mismatched_specifications_indexes
|
||||||
|
@mismatched_specifications_indexes ||= INDEXES.filter_map do |klass|
|
||||||
|
klass.base_name if klass.specification.changed?
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def indexes_match?
|
def indexes_match?
|
||||||
mismatched_indexes.empty?
|
mismatched_indexes.empty?
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def specifications_match?
|
||||||
|
mismatched_specifications_indexes.empty?
|
||||||
|
end
|
||||||
|
|
||||||
def es_preset
|
def es_preset
|
||||||
ENV.fetch('ES_PRESET', 'single_node_cluster')
|
ENV.fetch('ES_PRESET', 'single_node_cluster')
|
||||||
end
|
end
|
||||||
|
|
|
@ -903,6 +903,8 @@ en:
|
||||||
system_checks:
|
system_checks:
|
||||||
database_schema_check:
|
database_schema_check:
|
||||||
message_html: There are pending database migrations. Please run them to ensure the application behaves as expected
|
message_html: There are pending database migrations. Please run them to ensure the application behaves as expected
|
||||||
|
elasticsearch_analysis_index_mismatch:
|
||||||
|
message_html: Elasticsearch index analyzer settings are outdated. Please run <code>tootctl search deploy --only-mapping --only=%{value}</code>
|
||||||
elasticsearch_health_red:
|
elasticsearch_health_red:
|
||||||
message_html: Elasticsearch cluster is unhealthy (red status), search features are unavailable
|
message_html: Elasticsearch cluster is unhealthy (red status), search features are unavailable
|
||||||
elasticsearch_health_yellow:
|
elasticsearch_health_yellow:
|
||||||
|
|
Loading…
Reference in New Issue
Block a user