Closed
Description
The init operation: python3 plugin/storage/es/esRollover.py init http://localhost:9200
fails if the index already exists. I would like to make it idempotent. It's useful when Jaeger is re-deployed with the same storage.
The cassandra create schema is also idempotent.
oc logs po/simple-prod-elasticsearch-create-mapping-q9wq9 3:07
PUT http://elasticsearch:9200/jaeger-span-000001 [status:400 request:0.006s]
Creating index template jaeger-span
{"acknowledged":true}
Creating index jaeger-span-000001
Traceback (most recent call last):
File "/usr/local/lib/python3.7/site-packages/curator/actions.py", line 450, in do_action
self.client.indices.create(index=self.name, body=self.body)
File "/usr/local/lib/python3.7/site-packages/elasticsearch/client/utils.py", line 76, in _wrapped
return func(*args, params=params, **kwargs)
File "/usr/local/lib/python3.7/site-packages/elasticsearch/client/indices.py", line 88, in create
params=params, body=body)
File "/usr/local/lib/python3.7/site-packages/elasticsearch/transport.py", line 318, in perform_request
status, headers_response, data = connection.perform_request(method, url, params, body, headers=headers, ignore=ignore, timeout=timeout)
File "/usr/local/lib/python3.7/site-packages/elasticsearch/connection/http_urllib3.py", line 186, in perform_request
self._raise_error(response.status, raw_data)
File "/usr/local/lib/python3.7/site-packages/elasticsearch/connection/base.py", line 125, in _raise_error
raise HTTP_EXCEPTIONS.get(status_code, TransportError)(status_code, error_message, additional_info)
elasticsearch.exceptions.RequestError: RequestError(400, 'resource_already_exists_exception', 'index [jaeger-span-000001/kaGh5-YWSFu70bcphtmADQ] already exists')
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/es-rollover/esRollover.py", line 194, in <module>
main()
File "/es-rollover/esRollover.py", line 73, in main
perform_action(action, client, write_alias, read_alias, prefix+'jaeger-span', 'jaeger-span')
File "/es-rollover/esRollover.py", line 87, in perform_action
create_index(client, index)
File "/es-rollover/esRollover.py", line 115, in create_index
create.do_action()
File "/usr/local/lib/python3.7/site-packages/curator/actions.py", line 452, in do_action
utils.report_failure(e)
File "/usr/local/lib/python3.7/site-packages/curator/utils.py", line 173, in report_failure
'Exception: {0}'.format(exception)
curator.exceptions.FailedExecution: Exception encountered. Rerun with loglevel DEBUG and/or check Elasticsearch logs for more information. Exception: RequestError(400, 'resource_already_exists_exception', 'index [jaeger-span-000001/kaGh5-YWSFu70bcphtmADQ] already exists')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment