[thermostat/f19] Fix mongodb-server 2.4 compatibility
jerboaa
jerboaa at fedoraproject.org
Tue Oct 15 09:59:27 UTC 2013
commit a32aeb40345c157eb24ce23043828a414e00439d
Author: Severin Gehwolf <sgehwolf at redhat.com>
Date: Tue Oct 15 11:57:14 2013 +0200
Fix mongodb-server 2.4 compatibility
This prevents thermostat storage/service from working. Resolves RHBZ#1019152.
mongodb_24_compat.patch | 48 +++++++++++++++++++++++++++++++++++++++++++++++
thermostat.spec | 11 +++++++++-
2 files changed, 58 insertions(+), 1 deletions(-)
---
diff --git a/mongodb_24_compat.patch b/mongodb_24_compat.patch
new file mode 100644
index 0000000..0b9ba5e
--- /dev/null
+++ b/mongodb_24_compat.patch
@@ -0,0 +1,48 @@
+diff --git a/agent/cli/src/main/java/com/redhat/thermostat/agent/cli/impl/db/MongoProcessRunner.java b/agent/cli/src/main/java/com/redhat/thermostat/agent/cli/impl/db/MongoProcessRunner.java
+--- a/agent/cli/src/main/java/com/redhat/thermostat/agent/cli/impl/db/MongoProcessRunner.java
++++ b/agent/cli/src/main/java/com/redhat/thermostat/agent/cli/impl/db/MongoProcessRunner.java
+@@ -74,7 +74,7 @@
+ };
+
+ private static final String NO_JOURNAL_ARGUMENT = "--nojournal";
+- private static final String NO_JOURNAL_FIRST_VERSION = "1.9.2";
++ static final String NO_JOURNAL_FIRST_VERSION = "1.9.2";
+
+ private DBStartupConfiguration configuration;
+ private boolean isQuiet;
+@@ -271,11 +271,31 @@
+ throw e;
+ }
+ InputStream out = process.getInputStream();
+- InputStreamReader reader = new InputStreamReader(out);
+- BufferedReader bufReader = new BufferedReader(reader);
+- String firstLine = bufReader.readLine();
+- int commaIdx = firstLine.indexOf(",", 12);
+- String versionString = firstLine.substring(12, commaIdx);
++ return doGetDBVersion(out);
++ }
++
++ // package private for testing
++ String doGetDBVersion(InputStream in) throws IOException {
++ // Default to no-journal first version if we can't parse the version
++ // output for some reason.
++ String versionString = NO_JOURNAL_FIRST_VERSION;
++ String firstLine = null;
++ try(InputStreamReader reader = new InputStreamReader(in)) {
++ BufferedReader bufReader = new BufferedReader(reader);
++ firstLine = bufReader.readLine();
++ int commaIdx = firstLine.indexOf(",", 12);
++ if (commaIdx != -1) {
++ versionString = firstLine.substring(12, commaIdx);
++ } else {
++ versionString = firstLine.substring(12);
++ }
++ } catch (Exception e) {
++ // catching Exception here in order to also catch potential NPEs or
++ // IndexOutOfBoundExceptions. If those conditions happen we fall
++ // back to the no journal first version.
++ logger.log(Level.WARNING, "Failed to parse mongodb version from: '" +
++ firstLine + "'. Assuming version " + NO_JOURNAL_FIRST_VERSION, e);
++ }
+ return versionString;
+ }
diff --git a/thermostat.spec b/thermostat.spec
index ef5d667..f38515f 100644
--- a/thermostat.spec
+++ b/thermostat.spec
@@ -10,7 +10,7 @@ Name: thermostat
Version: 0.9.2
# If building from snapshot out of hg, uncomment and adjust below value as appropriate
#Release: 0.1.20130521hg%{hgrev}%{?dist}
-Release: 4%{?dist}
+Release: 5%{?dist}
Summary: A monitoring and serviceability tool for OpenJDK
License: GPLv2+ with exceptions
URL: http://icedtea.classpath.org/thermostat/
@@ -53,6 +53,9 @@ Patch7: fix_loglevel.patch
# FIXME: This has been fixed upstream with rev cffa49e21080.
# Should get removed next release.
Patch8: systemd_fixes.patch
+# FIXME: This has been fixed upstream with rev 4279c0994a38.
+# Should get removed next major release.
+Patch9: mongodb_24_compat.patch
BuildRequires: java-devel >= 1:1.7.0
BuildRequires: jpackage-utils
@@ -178,6 +181,7 @@ tomcat's webapps directory.
%patch6 -p1
%patch7 -p1
%patch8 -p1
+%patch9 -p1
# webservice command is going to be disabled.
rm distribution/config/commands/webservice.properties
@@ -629,6 +633,11 @@ fi
%{_datadir}/tomcat/webapps/%{name}
%changelog
+* Thu Oct 15 2013 Severin Gehwolf <sgehwolf at redhat.com> 0.9.2-5
+- Fix mongodb-server 2.4 compatibility, which prevented
+ thermostat storage from working.
+- Resolves RHBZ#1019152.
+
* Wed Jun 05 2013 Severin Gehwolf <sgehwolf at redhat.com> 0.9.2-4
- Don't install thermostat-agent.service due to IcedTea BZ#1460.
More information about the scm-commits
mailing list