elastic / elasticsearch

Free and Open Source, Distributed, RESTful Search Engine
https://www.elastic.co/products/elasticsearch
Other
1.17k stars 24.84k forks source link

Improve use of thread context propagation in CCR #89076

Open DaveCTurner opened 2 years ago

DaveCTurner commented 2 years ago

Today CCR sends its cross-cluster requests using a client which switches thread context to one with the right authorisation headers just before sending the request to the remote cluster (see e.g. CcrLicenseChecker#wrapClient). Instead we should run all the relevant code in the right thread context to begin with, and then just switch to a regular client. This would prevent surprises such as https://github.com/elastic/elasticsearch/issues/61308 and https://github.com/elastic/elasticsearch/pull/84409 and would also let us propagate other headers across clusters (e.g. for tracing).

elasticsearchmachine commented 2 years ago

Pinging @elastic/es-distributed (Team:Distributed)