opendistro-for-elasticsearch / performance-analyzer

📈 OpenDistro Performance Analyzer
https://opendistro.github.io/
Apache License 2.0
146 stars 49 forks source link

performance-analyzer not working after upgrade to opendistro-performance-analyzer-1.13.0.0-1.noarch #281

Open TheMeier opened 3 years ago

TheMeier commented 3 years ago

The script referenced in the systemd unit does not exist

$ ls /usr/share/elasticsearch/bin/performance-analyzer-agent-cli
ls: cannot access '/usr/share/elasticsearch/bin/performance-analyzer-agent-cli': No such file or directory
$ rpmverify opendistro-performance-analyzer-1.13.0.0-1.noarch
missing     /usr/share/elasticsearch/bin/performance-analyzer-agent-cli

There is a PR related to this https://github.com/opendistro-for-elasticsearch/performance-analyzer/pull/254/files but that seems to be outdated. (refereces $ES_HOME/plugins/opendistro_performance_analyzer instead of $ES_HOME"/plugins/opendistro-performance-analyzer)

The scripts which is in the RPM /usr/share/elasticsearch/plugins/opendistro-performance-analyzer/bin/performance-analyzer-agent-cli exits with Error: Could not find or load main class com.amazon.opendistro.elasticsearch.performanceanalyzer.PerformanceAnalyzerApp

sbruno commented 3 years ago

I found the same problem today.

It is not only /usr/share/elasticsearch/bin/performance-analyzer-agent-cli which is gone after an RPM upgrade, also the whole /usr/share/elasticsearch/performance-analyzer-rca directory and the /usr/share/elasticsearch/data/rca_enabled.conf configuration file.

Only the CLI file is identified by the verify command because that path is present in the %files list of the RPM. The other files are created in the post script of the RPM: Those files are removed by the postrm script:

So what I think that happens is that the post script of the new RPM is executed first, creating (overwriting) those files, and then the postrm script of the old package removes them.

This RPM behavior seems to cause other problems. I also filed a bug in elasticsearch because that behavior causes that the service fails to restart on upgrades: https://github.com/elastic/elasticsearch/issues/71784

But is the expected RPM upgrade behavior: https://docs.fedoraproject.org/en-US/packaging-guidelines/Scriptlets/#ordering

The steps I used to reproduce this are:

# Install elastcisearch older version
curl https://d3g5vo6xdbdb9a.cloudfront.net/yum/opendistroforelasticsearch-artifacts.repo -o /etc/yum.repos.d/opendistroforelasticsearch-artifacts.repo
yum install -y curl unzip wget libcap java-11-openjdk-devel
yum install -y opendistroforelasticsearch-1.12.0-1
systemctl daemon-reload
systemctl enable elasticsearch.service
systemctl start elasticsearch.service

# Check that performance analyzer is running
systemctl status opendistro-performance-analyzer
ps aux | grep elasticsearch | grep java

# Check that files exist
ls /usr/share/elasticsearch/bin/performance-analyzer-agent-cli
ls /usr/share/elasticsearch/performance-analyzer-rca
ls /usr/share/elasticsearch/data/rca_enabled.conf

rpm -V opendistro-performance-analyzer

# Install newer version
yum install -y opendistroforelasticsearch-1.13.2-1
systemctl daemon-reload
systemctl restart elasticsearch.service

# Check that performance analyzer did not run
systemctl status opendistro-performance-analyzer
ps aux | grep elasticsearch | grep java

# Check that files do not exist
ls /usr/share/elasticsearch/bin/performance-analyzer-agent-cli
ls /usr/share/elasticsearch/performance-analyzer-rca
ls /usr/share/elasticsearch/data/rca_enabled.conf

rpm -V opendistro-performance-analyzer

And as workaround, to set up the performance analyzer again, some steps that the RPM does can be done manually:

echo  true > /usr/share/elasticsearch/data/rca_enabled.conf
cp -r /usr/share/elasticsearch/plugins/opendistro-performance-analyzer/performance-analyzer-rca /usr/share/elasticsearch/
cp /usr/share/elasticsearch/plugins/opendistro-performance-analyzer/bin/performance-analyzer-agent-cli /usr/share/elasticsearch/bin/
chmod +x /usr/share/elasticsearch/bin/performance-analyzer-agent-cli
systemctl restart elasticsearch.service