[rhq] Branch 'release/jon3.1.x' - 2 commits - modules/enterprise

Jay Shaughnessy jshaughn at fedoraproject.org
Mon Aug 6 19:30:13 UTC 2012


 modules/enterprise/gui/installer-war/src/main/java/org/rhq/enterprise/installer/ConfigurationBean.java |   27 +++++----
 modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/cloud/StatusManagerBean.java     |   29 +++++++---
 2 files changed, 37 insertions(+), 19 deletions(-)

New commits:
commit b80fc17d83ea07a605708bc082889767f87a8146
Author: Jay Shaughnessy <jshaughn at redhat.com>
Date:   Mon Aug 6 15:29:24 2012 -0400

    [Bug 826094 - [installer] DB user password is logged to the Server log in cleartext]
    Omit the db password properyy from the raw settings log message.  Note that
    the raw values are subject to change by the installer, so its actually the
    latter, submitted value log message that shows what is really being applied.
    
    Cherry-pick of master commit: 09c6c5cf29c044ddb4e21d71c2ae3aeb56683ecd

diff --git a/modules/enterprise/gui/installer-war/src/main/java/org/rhq/enterprise/installer/ConfigurationBean.java b/modules/enterprise/gui/installer-war/src/main/java/org/rhq/enterprise/installer/ConfigurationBean.java
index 1ee1741..2af8f15 100644
--- a/modules/enterprise/gui/installer-war/src/main/java/org/rhq/enterprise/installer/ConfigurationBean.java
+++ b/modules/enterprise/gui/installer-war/src/main/java/org/rhq/enterprise/installer/ConfigurationBean.java
@@ -147,20 +147,20 @@ public class ConfigurationBean {
 
     public void initConfiguration() {
         if (configuration == null) {
-            Properties properties = serverInfo.getServerProperties();            
+            Properties properties = serverInfo.getServerProperties();
             List<PropertyItem> itemDefs = new ServerProperties().getPropertyItems();
-            
-            if ((serverInfo.getProduct() == ServerInformation.Product.JON) && 
-                !serverInfo.isUnsupportedJonFeaturesEnabled()) {
+
+            if ((serverInfo.getProduct() == ServerInformation.Product.JON)
+                && !serverInfo.isUnsupportedJonFeaturesEnabled()) {
                 LOG.debug("Hiding the embedded agent props and the unsupported DB types...");
                 for (PropertyItem itemDef : itemDefs) {
                     if (itemDef.getPropertyName().startsWith(ServerProperties.PREFIX_PROP_EMBEDDED_AGENT)) {
                         itemDef.setHidden(true);
                     }
-                    
+
                     if (itemDef.getPropertyName().equals(ServerProperties.PROP_DATABASE_TYPE)) {
                         List<SelectItem> options = itemDef.getOptions();
-                        for (Iterator<SelectItem> iterator = options.iterator(); iterator.hasNext(); ) {
+                        for (Iterator<SelectItem> iterator = options.iterator(); iterator.hasNext();) {
                             SelectItem option = iterator.next();
                             String databaseType = (String) option.getValue();
                             if (!JON_SUPPORTED_DATABASE_TYPES.contains(databaseType)) {
@@ -170,7 +170,7 @@ public class ConfigurationBean {
                     }
                 }
             }
-                        
+
             configuration = new ArrayList<PropertyItemWithValue>();
 
             for (PropertyItem itemDef : itemDefs) {
@@ -570,7 +570,10 @@ public class ConfigurationBean {
     }
 
     public StartPageResults save() {
-        LOG.info("Installer raw values: " + configuration);
+        // log the raw values but don't write out the potentially unobfuscated db password
+        Properties props = getConfigurationAsProperties(configuration);
+        props.remove(ServerProperties.PROP_DATABASE_PASSWORD);
+        LOG.info("Installer: raw values (these may be updated by the installer, see submitted values below): " + props);
 
         // if auto-install is enabled, the db password will be encrypted - decrypt it internally and we'll re-encrypt later
         if (isAutoinstallEnabled()) {
@@ -708,8 +711,8 @@ public class ConfigurationBean {
 
         // Ensure server info has been set
         if ((null == haServer) || (null == haServer.getName()) || "".equals(haServer.getName().trim())) {
-            lastError = I18Nmsg.getMsg(InstallerI18NResourceKeys.INVALID_STRING, I18Nmsg
-                .getMsg(InstallerI18NResourceKeys.PROP_HIGH_AVAILABILITY_NAME));
+            lastError = I18Nmsg.getMsg(InstallerI18NResourceKeys.INVALID_STRING,
+                I18Nmsg.getMsg(InstallerI18NResourceKeys.PROP_HIGH_AVAILABILITY_NAME));
             return StartPageResults.ERROR;
         }
 
@@ -720,8 +723,8 @@ public class ConfigurationBean {
                 } catch (Exception e) {
                     // there is one special property - the connector bind port - that is allowed to be empty
                     // ignore this error if we are looking at that property and its empty; otherwise, this is an error
-                    if (!(newValue.getItemDefinition().getPropertyName().equals(
-                        ServerProperties.PROP_CONNECTOR_BIND_PORT) && newValue.getValue().length() == 0)) {
+                    if (!(newValue.getItemDefinition().getPropertyName()
+                        .equals(ServerProperties.PROP_CONNECTOR_BIND_PORT) && newValue.getValue().length() == 0)) {
                         lastError = I18Nmsg.getMsg(InstallerI18NResourceKeys.INVALID_NUMBER, newValue
                             .getItemDefinition().getPropertyLabel(), newValue.getValue());
                         return StartPageResults.ERROR;


commit d49931a0ff15de321edc8c49b04741b5737d3a91
Author: Jay Shaughnessy <jshaughn at redhat.com>
Date:   Mon Aug 6 15:27:28 2012 -0400

    [Bug 828428 - org.rhq.enterprise.server.cloud.instance.CacheConsistencyManagerBean ERROR ORA-01795: maximum number of expressions in a list is 1000]
    This time the problem is 1000 or more agents on a server (with status <> 0).
    Batch the updates to avoid the Oracle limitation.
    
    Cherry-pick of master commit 11f741ebd98c10d294e23d5f7174d12b67baea90

diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/cloud/StatusManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/cloud/StatusManagerBean.java
index dfd1990..9658dd1 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/cloud/StatusManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/cloud/StatusManagerBean.java
@@ -95,13 +95,28 @@ public class StatusManagerBean implements StatusManagerLocal {
         List<Integer> agentIds = selectQuery.getResultList();
 
         if (agentIds.size() > 0) {
-            /* 
-             * note: not worried about size of the in clause, because the number of
-             * agents per server will be reasonable, say, 50-150
-             */
-            Query updateQuery = entityManager.createNamedQuery(Agent.QUERY_UPDATE_CLEAR_STATUS_BY_IDS);
-            updateQuery.setParameter("agentIds", agentIds);
-            updateQuery.executeUpdate();
+
+            // handle the oracle 1000 member IN clause issue
+            final int ORACLE_BATCH_SIZE = 1000;
+
+            int numAgents = agentIds.size();
+            int batches = (numAgents / ORACLE_BATCH_SIZE) + 1;
+
+            // iterate over the agent ids when we have more than 1000 of them
+            for (int batch = 0; batch < batches; ++batch) {
+                int fromIndex = batch * ORACLE_BATCH_SIZE;
+                int toIndex = fromIndex + ORACLE_BATCH_SIZE;
+                if (toIndex > numAgents) // don't run over the end of the list
+                    toIndex = numAgents;
+                List<Integer> agentIdBatch = agentIds.subList(fromIndex, toIndex);
+
+                if (fromIndex == toIndex)
+                    continue;
+
+                Query updateQuery = entityManager.createNamedQuery(Agent.QUERY_UPDATE_CLEAR_STATUS_BY_IDS);
+                updateQuery.setParameter("agentIds", agentIdBatch);
+                int numUpdated = updateQuery.executeUpdate();
+            }
         }
 
         return agentIds;




More information about the rhq-commits mailing list