You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by cl...@apache.org on 2019/07/30 22:05:03 UTC

[activemq-artemis] branch master updated (573e6a2 -> fb7de13)

This is an automated email from the ASF dual-hosted git repository.

clebertsuconic pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/activemq-artemis.git.


    from 573e6a2  This closes #2774
     new 32a1528  NO-JIRA no need to validate default return
     new 8019086  ARTEMIS-2435 Configuration on device-block-size through CLI / broker.xml
     new fb7de13  This closes #2775

The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../org/apache/activemq/artemis/cli/commands/Create.java    | 12 +++++++++++-
 .../org/apache/activemq/artemis/cli/commands/etc/broker.xml |  2 ++
 .../apache/activemq/artemis/core/config/Configuration.java  | 11 +++++++++++
 .../artemis/core/config/impl/ConfigurationImpl.java         | 13 +++++++++++++
 .../core/deployers/impl/FileConfigurationParser.java        |  2 ++
 .../persistence/impl/journal/JournalStorageManager.java     |  4 ++++
 .../apache/activemq/artemis/utils/XMLConfigurationUtil.java |  7 +------
 .../src/main/resources/schema/artemis-configuration.xsd     | 10 ++++++++++
 .../artemis/core/config/impl/ConfigurationImplTest.java     |  1 +
 .../artemis/core/config/impl/FileConfigurationTest.java     |  1 +
 .../src/test/resources/ConfigurationTest-full-config.xml    |  1 +
 .../test/resources/ConfigurationTest-xinclude-config.xml    |  1 +
 12 files changed, 58 insertions(+), 7 deletions(-)


[activemq-artemis] 03/03: This closes #2775

Posted by cl...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

clebertsuconic pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/activemq-artemis.git

commit fb7de135d6abc6fd9ec7251ed78dc52e37eef5da
Merge: 573e6a2 8019086
Author: Clebert Suconic <cl...@apache.org>
AuthorDate: Tue Jul 30 18:04:52 2019 -0400

    This closes #2775

 .../org/apache/activemq/artemis/cli/commands/Create.java    | 12 +++++++++++-
 .../org/apache/activemq/artemis/cli/commands/etc/broker.xml |  2 ++
 .../apache/activemq/artemis/core/config/Configuration.java  | 11 +++++++++++
 .../artemis/core/config/impl/ConfigurationImpl.java         | 13 +++++++++++++
 .../core/deployers/impl/FileConfigurationParser.java        |  2 ++
 .../persistence/impl/journal/JournalStorageManager.java     |  4 ++++
 .../apache/activemq/artemis/utils/XMLConfigurationUtil.java |  7 +------
 .../src/main/resources/schema/artemis-configuration.xsd     | 10 ++++++++++
 .../artemis/core/config/impl/ConfigurationImplTest.java     |  1 +
 .../artemis/core/config/impl/FileConfigurationTest.java     |  1 +
 .../src/test/resources/ConfigurationTest-full-config.xml    |  1 +
 .../test/resources/ConfigurationTest-xinclude-config.xml    |  1 +
 12 files changed, 58 insertions(+), 7 deletions(-)


[activemq-artemis] 02/03: ARTEMIS-2435 Configuration on device-block-size through CLI / broker.xml

Posted by cl...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

clebertsuconic pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/activemq-artemis.git

commit 80190860cc09f5dfa5b628db9e4987dc21e7136b
Author: Clebert Suconic <cl...@apache.org>
AuthorDate: Tue Jul 30 13:30:20 2019 -0400

    ARTEMIS-2435 Configuration on device-block-size through CLI / broker.xml
---
 .../org/apache/activemq/artemis/cli/commands/Create.java    | 12 +++++++++++-
 .../org/apache/activemq/artemis/cli/commands/etc/broker.xml |  2 ++
 .../apache/activemq/artemis/core/config/Configuration.java  | 11 +++++++++++
 .../artemis/core/config/impl/ConfigurationImpl.java         | 13 +++++++++++++
 .../core/deployers/impl/FileConfigurationParser.java        |  2 ++
 .../persistence/impl/journal/JournalStorageManager.java     |  4 ++++
 .../src/main/resources/schema/artemis-configuration.xsd     | 10 ++++++++++
 .../artemis/core/config/impl/ConfigurationImplTest.java     |  1 +
 .../artemis/core/config/impl/FileConfigurationTest.java     |  1 +
 .../src/test/resources/ConfigurationTest-full-config.xml    |  1 +
 .../test/resources/ConfigurationTest-xinclude-config.xml    |  1 +
 11 files changed, 57 insertions(+), 1 deletion(-)

diff --git a/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/Create.java b/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/Create.java
index 12e7446..99d4b13 100644
--- a/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/Create.java
+++ b/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/Create.java
@@ -266,10 +266,12 @@ public class Create extends InputAbstract {
    @Option(name = "--no-fsync", description = "Disable usage of fdatasync (channel.force(false) from java nio) on the journal")
    private boolean noJournalSync;
 
+   @Option(name = "--device-block-size", description = "The block size by the device, default at 4096.")
+   private int journalDeviceBlockSize = 4096;
+
    @Option(name = "--global-max-size", description = "Maximum amount of memory which message data may consume (Default: Undefined, half of the system's memory)")
    private String globalMaxSize;
 
-
    @Option(name = "--jdbc", description = "It will activate jdbc")
    boolean jdbc;
 
@@ -548,6 +550,14 @@ public class Create extends InputAbstract {
 
       HashMap<String, String> filters = new LinkedHashMap<>();
 
+      if (journalDeviceBlockSize % 512 != 0) {
+         // This will generate a CLI error
+         // no need to a logger here as this would be just a regular UI output
+         throw new IllegalArgumentException("You must pass a device-block-size multiple of 512");
+      }
+
+      filters.put("${device-block-size}", Integer.toString(journalDeviceBlockSize));
+
       filters.put("${master-slave}", isSlave() ? "slave" : "master");
 
       filters.put("${failover-on-shutdown}", isFailoverOnShutodwn() ? "true" : "false");
diff --git a/artemis-cli/src/main/resources/org/apache/activemq/artemis/cli/commands/etc/broker.xml b/artemis-cli/src/main/resources/org/apache/activemq/artemis/cli/commands/etc/broker.xml
index 772c7bd..4472c46 100644
--- a/artemis-cli/src/main/resources/org/apache/activemq/artemis/cli/commands/etc/broker.xml
+++ b/artemis-cli/src/main/resources/org/apache/activemq/artemis/cli/commands/etc/broker.xml
@@ -52,6 +52,8 @@ ${jdbc}
 
       <journal-pool-files>10</journal-pool-files>
 
+      <journal-device-block-size>${device-block-size}</journal-device-block-size>
+
       <journal-file-size>10M</journal-file-size>
       ${journal-buffer.settings}${ping-config.settings}${connector-config.settings}
 
diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/config/Configuration.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/config/Configuration.java
index 0bc2b63..40fb4f3 100644
--- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/config/Configuration.java
+++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/config/Configuration.java
@@ -735,6 +735,17 @@ public interface Configuration {
     */
    Configuration setJournalBufferTimeout_AIO(int journalBufferTimeout);
 
+   /** This is the device block size used on writing.
+    * This is usually translated as st_blksize from fstat.
+    * returning null mans the system should instead make a call on fstat and use st_blksize.
+    *  The intention of this setting was to bypass the value in certain devices that will return a huge number as their block size (e.g. CephFS) */
+   Integer getJournalDeviceBlockSize();
+
+   /**
+    * @see #getJournalDeviceBlockSize()
+    */
+   Configuration setJournalDeviceBlockSize(Integer deviceBlockSize);
+
    /**
     * Returns the buffer size (in bytes) for AIO.
     * <br>
diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/config/impl/ConfigurationImpl.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/config/impl/ConfigurationImpl.java
index 31624f3..db83e5a 100644
--- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/config/impl/ConfigurationImpl.java
+++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/config/impl/ConfigurationImpl.java
@@ -212,6 +212,8 @@ public class ConfigurationImpl implements Configuration, Serializable {
 
    protected int journalBufferTimeout_AIO = ActiveMQDefaultConfiguration.getDefaultJournalBufferTimeoutAio();
 
+   protected Integer deviceBlockSize = null;
+
    protected int journalBufferSize_AIO = ActiveMQDefaultConfiguration.getDefaultJournalBufferSizeAio();
 
    protected int journalMaxIO_NIO = ActiveMQDefaultConfiguration.getDefaultJournalMaxIoNio();
@@ -1289,6 +1291,17 @@ public class ConfigurationImpl implements Configuration, Serializable {
    }
 
    @Override
+   public Integer getJournalDeviceBlockSize() {
+      return deviceBlockSize;
+   }
+
+   @Override
+   public ConfigurationImpl setJournalDeviceBlockSize(Integer deviceBlockSize) {
+      this.deviceBlockSize = deviceBlockSize;
+      return this;
+   }
+
+   @Override
    public ConfigurationImpl setJournalBufferTimeout_AIO(final int journalBufferTimeout) {
       journalBufferTimeout_AIO = journalBufferTimeout;
       return this;
diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/deployers/impl/FileConfigurationParser.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/deployers/impl/FileConfigurationParser.java
index aa1effb..8171210 100644
--- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/deployers/impl/FileConfigurationParser.java
+++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/deployers/impl/FileConfigurationParser.java
@@ -605,6 +605,8 @@ public final class FileConfigurationParser extends XMLConfigurationUtil {
 
       int journalMaxIO = getInteger(e, "journal-max-io", config.getJournalType() == JournalType.ASYNCIO ? ActiveMQDefaultConfiguration.getDefaultJournalMaxIoAio() : ActiveMQDefaultConfiguration.getDefaultJournalMaxIoNio(), Validators.GT_ZERO);
 
+      config.setJournalDeviceBlockSize(getInteger(e, "journal-device-block-size", null, Validators.MINUS_ONE_OR_GE_ZERO));
+
       if (config.getJournalType() == JournalType.ASYNCIO) {
          config.setJournalBufferTimeout_AIO(journalBufferTimeout);
          config.setJournalBufferSize_AIO(journalBufferSize);
diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/persistence/impl/journal/JournalStorageManager.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/persistence/impl/journal/JournalStorageManager.java
index c06b640..2ae475c 100644
--- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/persistence/impl/journal/JournalStorageManager.java
+++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/persistence/impl/journal/JournalStorageManager.java
@@ -148,6 +148,10 @@ public class JournalStorageManager extends AbstractJournalStorageManager {
                ActiveMQServerLogger.LOGGER.journalUseAIO();
             }
             journalFF = new AIOSequentialFileFactory(config.getJournalLocation(), config.getJournalBufferSize_AIO(), config.getJournalBufferTimeout_AIO(), config.getJournalMaxIO_AIO(), config.isLogJournalWriteRate(), criticalErrorListener, getCriticalAnalyzer());
+
+            if (config.getJournalDeviceBlockSize() != null) {
+               journalFF.setAlignment(config.getJournalDeviceBlockSize());
+            }
             break;
          case MAPPED:
             if (criticalErrorListener != null) {
diff --git a/artemis-server/src/main/resources/schema/artemis-configuration.xsd b/artemis-server/src/main/resources/schema/artemis-configuration.xsd
index 03ff9f8..78d5ba4 100644
--- a/artemis-server/src/main/resources/schema/artemis-configuration.xsd
+++ b/artemis-server/src/main/resources/schema/artemis-configuration.xsd
@@ -673,6 +673,16 @@
             </xsd:annotation>
          </xsd:element>
 
+
+         <xsd:element name="journal-device-block-size" type="xsd:long" maxOccurs="1" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+                  The size in bytes used by the device. This is usually translated as fstat/st_blksize
+                  And this is a way to bypass the value returned as st_blksize.
+               </xsd:documentation>
+            </xsd:annotation>
+         </xsd:element>
+
          <xsd:element name="journal-buffer-size" type="xsd:string" default="501760" maxOccurs="1" minOccurs="0">
             <xsd:annotation>
                <xsd:documentation>
diff --git a/artemis-server/src/test/java/org/apache/activemq/artemis/core/config/impl/ConfigurationImplTest.java b/artemis-server/src/test/java/org/apache/activemq/artemis/core/config/impl/ConfigurationImplTest.java
index 8509450..22e577e 100644
--- a/artemis-server/src/test/java/org/apache/activemq/artemis/core/config/impl/ConfigurationImplTest.java
+++ b/artemis-server/src/test/java/org/apache/activemq/artemis/core/config/impl/ConfigurationImplTest.java
@@ -87,6 +87,7 @@ public class ConfigurationImplTest extends ActiveMQTestBase {
       Assert.assertEquals(ActiveMQDefaultConfiguration.getDefaultMemoryWarningThreshold(), conf.getMemoryWarningThreshold());
       Assert.assertEquals(ActiveMQDefaultConfiguration.getDefaultMemoryMeasureInterval(), conf.getMemoryMeasureInterval());
       Assert.assertEquals(conf.getJournalLocation(), conf.getNodeManagerLockLocation());
+      Assert.assertNull(conf.getJournalDeviceBlockSize());
    }
 
    @Test
diff --git a/artemis-server/src/test/java/org/apache/activemq/artemis/core/config/impl/FileConfigurationTest.java b/artemis-server/src/test/java/org/apache/activemq/artemis/core/config/impl/FileConfigurationTest.java
index d0934dd..91f92aa 100644
--- a/artemis-server/src/test/java/org/apache/activemq/artemis/core/config/impl/FileConfigurationTest.java
+++ b/artemis-server/src/test/java/org/apache/activemq/artemis/core/config/impl/FileConfigurationTest.java
@@ -117,6 +117,7 @@ public class FileConfigurationTest extends ConfigurationImplTest {
       Assert.assertEquals(25000, conf.getAddressQueueScanPeriod());
       Assert.assertEquals(127, conf.getIDCacheSize());
       Assert.assertEquals(true, conf.isPersistIDCache());
+      Assert.assertEquals(Integer.valueOf(777), conf.getJournalDeviceBlockSize());
       Assert.assertEquals(true, conf.isPersistDeliveryCountBeforeDelivery());
       Assert.assertEquals("pagingdir", conf.getPagingDirectory());
       Assert.assertEquals("somedir", conf.getBindingsDirectory());
diff --git a/artemis-server/src/test/resources/ConfigurationTest-full-config.xml b/artemis-server/src/test/resources/ConfigurationTest-full-config.xml
index 9042426..9815511 100644
--- a/artemis-server/src/test/resources/ConfigurationTest-full-config.xml
+++ b/artemis-server/src/test/resources/ConfigurationTest-full-config.xml
@@ -356,6 +356,7 @@
       <journal-compact-min-files>123</journal-compact-min-files>
       <journal-max-io>56546</journal-max-io>
       <journal-file-open-timeout>9876</journal-file-open-timeout>
+      <journal-device-block-size>777</journal-device-block-size>
       <server-dump-interval>5000</server-dump-interval>
       <memory-warning-threshold>95</memory-warning-threshold>
       <memory-measure-interval>54321</memory-measure-interval>
diff --git a/artemis-server/src/test/resources/ConfigurationTest-xinclude-config.xml b/artemis-server/src/test/resources/ConfigurationTest-xinclude-config.xml
index dc8dc45..4a1ece0 100644
--- a/artemis-server/src/test/resources/ConfigurationTest-xinclude-config.xml
+++ b/artemis-server/src/test/resources/ConfigurationTest-xinclude-config.xml
@@ -270,6 +270,7 @@
       <journal-compact-min-files>123</journal-compact-min-files>
       <journal-max-io>56546</journal-max-io>
       <journal-file-open-timeout>9876</journal-file-open-timeout>
+      <journal-device-block-size>777</journal-device-block-size>
       <server-dump-interval>5000</server-dump-interval>
       <memory-warning-threshold>95</memory-warning-threshold>
       <memory-measure-interval>54321</memory-measure-interval>


[activemq-artemis] 01/03: NO-JIRA no need to validate default return

Posted by cl...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

clebertsuconic pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/activemq-artemis.git

commit 32a15284cafe8c63f09e8c4febd53304d098e96b
Author: Clebert Suconic <cl...@apache.org>
AuthorDate: Wed Jul 24 15:36:09 2019 -0400

    NO-JIRA no need to validate default return
---
 .../org/apache/activemq/artemis/utils/XMLConfigurationUtil.java    | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/utils/XMLConfigurationUtil.java b/artemis-server/src/main/java/org/apache/activemq/artemis/utils/XMLConfigurationUtil.java
index 29cfef9..906fd81 100644
--- a/artemis-server/src/main/java/org/apache/activemq/artemis/utils/XMLConfigurationUtil.java
+++ b/artemis-server/src/main/java/org/apache/activemq/artemis/utils/XMLConfigurationUtil.java
@@ -44,7 +44,6 @@ public class XMLConfigurationUtil {
          validator.validate(name, val);
          return val;
       } else {
-         validator.validate(name, def);
          return def;
       }
    }
@@ -59,7 +58,6 @@ public class XMLConfigurationUtil {
          validator.validate(name, val);
          return val;
       } else {
-         validator.validate(name, def);
          return def;
       }
    }
@@ -74,7 +72,6 @@ public class XMLConfigurationUtil {
          validator.validate(name, val);
          return val;
       } else {
-         validator.validate(name, def);
          return def;
       }
    }
@@ -89,14 +86,13 @@ public class XMLConfigurationUtil {
          validator.validate(name, val);
          return val;
       } else {
-         validator.validate(name, def);
          return def;
       }
    }
 
    public static final Integer getInteger(final Element e,
                                           final String name,
-                                          final int def,
+                                          final Integer def,
                                           final Validators.Validator validator) {
       NodeList nl = e.getElementsByTagName(name);
       if (nl.getLength() > 0) {
@@ -104,7 +100,6 @@ public class XMLConfigurationUtil {
          validator.validate(name, val);
          return val;
       } else {
-         validator.validate(name, def);
          return def;
       }
    }