You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-dev@james.apache.org by bt...@apache.org on 2017/08/22 03:32:00 UTC
[5/9] james-project git commit: JAMES-2111 Drop V1 -> V2
configuration options
JAMES-2111 Drop V1 -> V2 configuration options
Project: http://git-wip-us.apache.org/repos/asf/james-project/repo
Commit: http://git-wip-us.apache.org/repos/asf/james-project/commit/51a1311f
Tree: http://git-wip-us.apache.org/repos/asf/james-project/tree/51a1311f
Diff: http://git-wip-us.apache.org/repos/asf/james-project/diff/51a1311f
Branch: refs/heads/master
Commit: 51a1311ffb06f684feb62aea7acc51f5a589189f
Parents: 4e0f131
Author: benwa <bt...@linagora.com>
Authored: Tue Aug 15 15:50:39 2017 +0700
Committer: benwa <bt...@linagora.com>
Committed: Tue Aug 22 10:31:07 2017 +0700
----------------------------------------------------------------------
.../cassandra/CassandraConfiguration.java | 97 +-------------------
.../cassandra/CassandraConfigurationTest.java | 60 ------------
.../destination/conf/cassandra.properties | 3 -
.../destination/conf/cassandra.properties | 3 -
.../modules/mailbox/CassandraSessionModule.java | 12 ---
.../mailbox/CassandraSessionModuleTest.java | 4 -
.../modules/mailbox/cassandra.properties | 4 -
src/site/xdoc/server/config-cassandra.xml | 8 +-
8 files changed, 8 insertions(+), 183 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/james-project/blob/51a1311f/backends-common/cassandra/src/main/java/org/apache/james/backends/cassandra/CassandraConfiguration.java
----------------------------------------------------------------------
diff --git a/backends-common/cassandra/src/main/java/org/apache/james/backends/cassandra/CassandraConfiguration.java b/backends-common/cassandra/src/main/java/org/apache/james/backends/cassandra/CassandraConfiguration.java
index 5de74a4..f976242 100644
--- a/backends-common/cassandra/src/main/java/org/apache/james/backends/cassandra/CassandraConfiguration.java
+++ b/backends-common/cassandra/src/main/java/org/apache/james/backends/cassandra/CassandraConfiguration.java
@@ -38,11 +38,7 @@ public class CassandraConfiguration {
public static final int DEFAULT_UID_MAX_RETRY = 100000;
public static final int DEFAULT_ACL_MAX_RETRY = 1000;
public static final int DEFAULT_FETCH_NEXT_PAGE_ADVANCE_IN_ROW = 100;
- public static final boolean DEFAULT_ON_THE_FLY_MIGRATION_V1_TO_V2 = false;
public static final int DEFAULT_BLOB_PART_SIZE = 100 * 1024;
- public static final int DEFAULT_MIGRATION_V1_TO_V2_QUEUE_LENGTH = 1000;
- public static final int DEFAULT_MIGRATION_V1_TO_V2_THREAD_COUNT = 2;
- public static final int DEFAULT_MIGRATION_V1_READ_FETCH_SIZE = 10;
public static class Builder {
private Optional<Integer> messageReadChunkSize = Optional.empty();
@@ -55,10 +51,6 @@ public class CassandraConfiguration {
private Optional<Integer> aclMaxRetry = Optional.empty();
private Optional<Integer> fetchNextPageInAdvanceRow = Optional.empty();
private Optional<Integer> blobPartSize = Optional.empty();
- private Optional<Boolean> onTheFlyV1ToV2Migration = Optional.empty();
- private Optional<Integer> v1ToV2QueueLength = Optional.empty();
- private Optional<Integer> v1ToV2ThreadCount = Optional.empty();
- private Optional<Integer> v1ReadFetchSize = Optional.empty();
public Builder messageReadChunkSize(int value) {
Preconditions.checkArgument(value > 0, "messageReadChunkSize needs to be strictly positive");
@@ -120,29 +112,6 @@ public class CassandraConfiguration {
return this;
}
- public Builder v1ToV2QueueLength(int value) {
- Preconditions.checkArgument(value > 0, "v1ToV2QueueLength needs to be strictly positive");
- this.v1ToV2QueueLength = Optional.of(value);
- return this;
- }
-
- public Builder v1ToV2ThreadCount(int value) {
- Preconditions.checkArgument(value > 0, "v1ToV2ThreadCount needs to be strictly positive");
- this.v1ToV2ThreadCount = Optional.of(value);
- return this;
- }
-
- public Builder v1ReadFetchSize(int value) {
- Preconditions.checkArgument(value > 0, "v1ReadFetchSize needs to be strictly positive");
- this.v1ReadFetchSize = Optional.of(value);
- return this;
- }
-
- public Builder onTheFlyV1ToV2Migration(boolean value) {
- this.onTheFlyV1ToV2Migration = Optional.of(value);
- return this;
- }
-
public Builder messageReadChunkSize(Optional<Integer> value) {
value.ifPresent(this::messageReadChunkSize);
return this;
@@ -193,26 +162,6 @@ public class CassandraConfiguration {
return this;
}
- public Builder onTheFlyV1ToV2Migration(Optional<Boolean> value) {
- value.ifPresent(this::onTheFlyV1ToV2Migration);
- return this;
- }
-
- public Builder v1ToV2QueueLength(Optional<Integer> value) {
- value.ifPresent(this::v1ToV2QueueLength);
- return this;
- }
-
- public Builder v1ToV2ThreadCount(Optional<Integer> value) {
- value.ifPresent(this::v1ToV2ThreadCount);
- return this;
- }
-
- public Builder v1ReadFetchSize(Optional<Integer> value) {
- value.ifPresent(this::v1ReadFetchSize);
- return this;
- }
-
public CassandraConfiguration build() {
return new CassandraConfiguration(aclMaxRetry.orElse(DEFAULT_ACL_MAX_RETRY),
messageReadChunkSize.orElse(DEFAULT_MESSAGE_CHUNK_SIZE_ON_READ),
@@ -223,11 +172,7 @@ public class CassandraConfiguration {
modSeqMaxRetry.orElse(DEFAULT_MODSEQ_MAX_RETRY),
uidMaxRetry.orElse(DEFAULT_UID_MAX_RETRY),
fetchNextPageInAdvanceRow.orElse(DEFAULT_FETCH_NEXT_PAGE_ADVANCE_IN_ROW),
- blobPartSize.orElse(DEFAULT_BLOB_PART_SIZE),
- onTheFlyV1ToV2Migration.orElse(DEFAULT_ON_THE_FLY_MIGRATION_V1_TO_V2),
- v1ToV2QueueLength.orElse(DEFAULT_MIGRATION_V1_TO_V2_QUEUE_LENGTH),
- v1ToV2ThreadCount.orElse(DEFAULT_MIGRATION_V1_TO_V2_THREAD_COUNT),
- v1ReadFetchSize.orElse(DEFAULT_MIGRATION_V1_READ_FETCH_SIZE));
+ blobPartSize.orElse(DEFAULT_BLOB_PART_SIZE));
}
}
@@ -245,18 +190,12 @@ public class CassandraConfiguration {
private final int aclMaxRetry;
private final int fetchNextPageInAdvanceRow;
private final int blobPartSize;
- private final boolean onTheFlyV1ToV2Migration;
- private final int v1ToV2QueueLength;
- private final int v1ToV2ThreadCount;
- private final int v1ReadFetchSize;
@VisibleForTesting
CassandraConfiguration(int aclMaxRetry, int messageReadChunkSize, int expungeChunkSize,
int flagsUpdateChunkSize, int flagsUpdateMessageIdMaxRetry, int flagsUpdateMessageMaxRetry,
int modSeqMaxRetry, int uidMaxRetry, int fetchNextPageInAdvanceRow,
- int blobPartSize, boolean onTheFlyV1ToV2Migration, int v1ToV2QueueLength,
- int v1ToV2ThreadCount, int v1ReadFetchSize
- ) {
+ int blobPartSize) {
this.aclMaxRetry = aclMaxRetry;
this.messageReadChunkSize = messageReadChunkSize;
this.expungeChunkSize = expungeChunkSize;
@@ -267,20 +206,12 @@ public class CassandraConfiguration {
this.fetchNextPageInAdvanceRow = fetchNextPageInAdvanceRow;
this.flagsUpdateChunkSize = flagsUpdateChunkSize;
this.blobPartSize = blobPartSize;
- this.onTheFlyV1ToV2Migration = onTheFlyV1ToV2Migration;
- this.v1ToV2QueueLength = v1ToV2QueueLength;
- this.v1ToV2ThreadCount = v1ToV2ThreadCount;
- this.v1ReadFetchSize = v1ReadFetchSize;
}
public int getBlobPartSize() {
return blobPartSize;
}
- public boolean isOnTheFlyV1ToV2Migration() {
- return onTheFlyV1ToV2Migration;
- }
-
public int getFlagsUpdateChunkSize() {
return flagsUpdateChunkSize;
}
@@ -317,18 +248,6 @@ public class CassandraConfiguration {
return fetchNextPageInAdvanceRow;
}
- public int getV1ToV2QueueLength() {
- return v1ToV2QueueLength;
- }
-
- public int getV1ToV2ThreadCount() {
- return v1ToV2ThreadCount;
- }
-
- public int getV1ReadFetchSize() {
- return v1ReadFetchSize;
- }
-
@Override
public final boolean equals(Object o) {
if (o instanceof CassandraConfiguration) {
@@ -343,11 +262,7 @@ public class CassandraConfiguration {
&& Objects.equals(this.uidMaxRetry, that.uidMaxRetry)
&& Objects.equals(this.flagsUpdateChunkSize, that.flagsUpdateChunkSize)
&& Objects.equals(this.fetchNextPageInAdvanceRow, that.fetchNextPageInAdvanceRow)
- && Objects.equals(this.blobPartSize, that.blobPartSize)
- && Objects.equals(this.onTheFlyV1ToV2Migration, that.onTheFlyV1ToV2Migration)
- && Objects.equals(this.v1ToV2ThreadCount, that.v1ToV2ThreadCount)
- && Objects.equals(this.v1ToV2QueueLength, that.v1ToV2QueueLength)
- && Objects.equals(this.v1ReadFetchSize, that.v1ReadFetchSize);
+ && Objects.equals(this.blobPartSize, that.blobPartSize);
}
return false;
}
@@ -356,7 +271,7 @@ public class CassandraConfiguration {
public final int hashCode() {
return Objects.hash(aclMaxRetry, messageReadChunkSize, expungeChunkSize, flagsUpdateMessageIdMaxRetry,
flagsUpdateMessageMaxRetry, modSeqMaxRetry, uidMaxRetry, fetchNextPageInAdvanceRow, flagsUpdateChunkSize,
- blobPartSize, onTheFlyV1ToV2Migration, v1ToV2ThreadCount, v1ToV2QueueLength, v1ReadFetchSize);
+ blobPartSize);
}
@Override
@@ -372,10 +287,6 @@ public class CassandraConfiguration {
.add("flagsUpdateChunkSize", flagsUpdateChunkSize)
.add("uidMaxRetry", uidMaxRetry)
.add("blobPartSize", blobPartSize)
- .add("onTheFlyV1ToV2Migration", onTheFlyV1ToV2Migration)
- .add("v1ToV2ThreadCount", v1ToV2ThreadCount)
- .add("v1ToV2QueueLength", v1ToV2QueueLength)
- .add("v1ReadFetchSize", v1ReadFetchSize)
.toString();
}
}
http://git-wip-us.apache.org/repos/asf/james-project/blob/51a1311f/backends-common/cassandra/src/test/java/org/apache/james/backends/cassandra/CassandraConfigurationTest.java
----------------------------------------------------------------------
diff --git a/backends-common/cassandra/src/test/java/org/apache/james/backends/cassandra/CassandraConfigurationTest.java b/backends-common/cassandra/src/test/java/org/apache/james/backends/cassandra/CassandraConfigurationTest.java
index b38dbf8..9366b13 100644
--- a/backends-common/cassandra/src/test/java/org/apache/james/backends/cassandra/CassandraConfigurationTest.java
+++ b/backends-common/cassandra/src/test/java/org/apache/james/backends/cassandra/CassandraConfigurationTest.java
@@ -192,54 +192,6 @@ public class CassandraConfigurationTest {
}
@Test
- public void v1toV2ThreadCountShouldThrowOnZero() {
- expectedException.expect(IllegalArgumentException.class);
-
- CassandraConfiguration.builder()
- .v1ToV2ThreadCount(0);
- }
-
- @Test
- public void v1toV2ThreadCountShouldThrowOnNegative() {
- expectedException.expect(IllegalArgumentException.class);
-
- CassandraConfiguration.builder()
- .v1ToV2ThreadCount(-1);
- }
-
- @Test
- public void v1toV2QueueLengthShouldThrowOnZero() {
- expectedException.expect(IllegalArgumentException.class);
-
- CassandraConfiguration.builder()
- .v1ToV2QueueLength(0);
- }
-
- @Test
- public void v1toV2QueueLengthShouldThrowOnNegative() {
- expectedException.expect(IllegalArgumentException.class);
-
- CassandraConfiguration.builder()
- .v1ToV2QueueLength(-1);
- }
-
- @Test
- public void v1ReadFetchSizeShouldThrowOnNegative() {
- expectedException.expect(IllegalArgumentException.class);
-
- CassandraConfiguration.builder()
- .v1ReadFetchSize(-1);
- }
-
- @Test
- public void v1ReadFetchSizeShouldThrowOnZero() {
- expectedException.expect(IllegalArgumentException.class);
-
- CassandraConfiguration.builder()
- .v1ToV2QueueLength(0);
- }
-
- @Test
public void builderShouldCreateTheRightObject() {
int aclMaxRetry = 1;
int modSeqMaxRetry = 2;
@@ -251,10 +203,6 @@ public class CassandraConfigurationTest {
int messageReadChunkSize = 8;
int expungeChunkSize = 9;
int blobPartSize = 10;
- boolean onTheFlyV1ToV2Migration = true;
- int v1ToV2ThreadCount = 11;
- int v1ToV2QueueLength = 12;
- int v1ReadFetchSize = 13;
CassandraConfiguration configuration = CassandraConfiguration.builder()
.aclMaxRetry(aclMaxRetry)
@@ -267,10 +215,6 @@ public class CassandraConfigurationTest {
.messageReadChunkSize(messageReadChunkSize)
.expungeChunkSize(expungeChunkSize)
.blobPartSize(blobPartSize)
- .onTheFlyV1ToV2Migration(onTheFlyV1ToV2Migration)
- .v1ToV2ThreadCount(v1ToV2ThreadCount)
- .v1ToV2QueueLength(v1ToV2QueueLength)
- .v1ReadFetchSize(v1ReadFetchSize)
.build();
softly.assertThat(configuration.getAclMaxRetry()).isEqualTo(aclMaxRetry);
@@ -283,10 +227,6 @@ public class CassandraConfigurationTest {
softly.assertThat(configuration.getMessageReadChunkSize()).isEqualTo(messageReadChunkSize);
softly.assertThat(configuration.getExpungeChunkSize()).isEqualTo(expungeChunkSize);
softly.assertThat(configuration.getBlobPartSize()).isEqualTo(blobPartSize);
- softly.assertThat(configuration.isOnTheFlyV1ToV2Migration()).isEqualTo(onTheFlyV1ToV2Migration);
- softly.assertThat(configuration.getV1ToV2ThreadCount()).isEqualTo(v1ToV2ThreadCount);
- softly.assertThat(configuration.getV1ToV2QueueLength()).isEqualTo(v1ToV2QueueLength);
- softly.assertThat(configuration.getV1ReadFetchSize()).isEqualTo(v1ReadFetchSize);
}
}
http://git-wip-us.apache.org/repos/asf/james-project/blob/51a1311f/dockerfiles/run/guice/cassandra-ldap/destination/conf/cassandra.properties
----------------------------------------------------------------------
diff --git a/dockerfiles/run/guice/cassandra-ldap/destination/conf/cassandra.properties b/dockerfiles/run/guice/cassandra-ldap/destination/conf/cassandra.properties
index 9a7a175..0ce3a25 100644
--- a/dockerfiles/run/guice/cassandra-ldap/destination/conf/cassandra.properties
+++ b/dockerfiles/run/guice/cassandra-ldap/destination/conf/cassandra.properties
@@ -18,6 +18,3 @@ cassandra.retryConnection.minDelay=5000
# chunk.size.message.read=100
# chunk.size.expunge=100
# mailbox.blob.part.size=102400
-# migration.v1.v2.on.the.fly=false
-# migration.v1.v2.thread.count=2
-# migration.v1.v2.queue.length=1000
http://git-wip-us.apache.org/repos/asf/james-project/blob/51a1311f/dockerfiles/run/guice/cassandra/destination/conf/cassandra.properties
----------------------------------------------------------------------
diff --git a/dockerfiles/run/guice/cassandra/destination/conf/cassandra.properties b/dockerfiles/run/guice/cassandra/destination/conf/cassandra.properties
index 61d55de..afc5915 100644
--- a/dockerfiles/run/guice/cassandra/destination/conf/cassandra.properties
+++ b/dockerfiles/run/guice/cassandra/destination/conf/cassandra.properties
@@ -27,6 +27,3 @@ cassandra.retryConnection.minDelay=5000
# chunk.size.message.read=100
# chunk.size.expunge=100
# mailbox.blob.part.size=102400
-# migration.v1.v2.on.the.fly=false
-# migration.v1.v2.thread.count=2
-# migration.v1.v2.queue.length=1000
http://git-wip-us.apache.org/repos/asf/james-project/blob/51a1311f/server/container/guice/cassandra-guice/src/main/java/org/apache/james/modules/mailbox/CassandraSessionModule.java
----------------------------------------------------------------------
diff --git a/server/container/guice/cassandra-guice/src/main/java/org/apache/james/modules/mailbox/CassandraSessionModule.java b/server/container/guice/cassandra-guice/src/main/java/org/apache/james/modules/mailbox/CassandraSessionModule.java
index a9447f9..144d5d3 100644
--- a/server/container/guice/cassandra-guice/src/main/java/org/apache/james/modules/mailbox/CassandraSessionModule.java
+++ b/server/container/guice/cassandra-guice/src/main/java/org/apache/james/modules/mailbox/CassandraSessionModule.java
@@ -95,10 +95,6 @@ public class CassandraSessionModule extends AbstractModule {
private static final String CHUNK_SIZE_MESSAGE_READ = "chunk.size.message.read";
private static final String CHUNK_SIZE_EXPUNGE = "chunk.size.expunge";
private static final String BLOB_PART_SIZE = "mailbox.blob.part.size";
- private static final String MIGRATION_V1_V2_ON_THE_FLY = "migration.v1.v2.on.the.fly";
- private static final String MIGRATION_V1_V2_THREAD_COUNT = "migration.v1.v2.thread.count";
- private static final String MIGRATION_V1_V2_QUEUE_LENGTH = "migration.v1.v2.queue.length";
- public static final String MIGRATION_V1_READ_SIZE = "migration.v1.read.fetch.size";
@Override
protected void configure() {
@@ -298,14 +294,6 @@ public class CassandraSessionModule extends AbstractModule {
propertiesConfiguration.getInteger(CHUNK_SIZE_EXPUNGE, null)))
.blobPartSize(Optional.ofNullable(
propertiesConfiguration.getInteger(BLOB_PART_SIZE, null)))
- .onTheFlyV1ToV2Migration(Optional.ofNullable(
- propertiesConfiguration.getBoolean(MIGRATION_V1_V2_ON_THE_FLY, null)))
- .v1ToV2ThreadCount(Optional.ofNullable(
- propertiesConfiguration.getInteger(MIGRATION_V1_V2_THREAD_COUNT, null)))
- .v1ToV2QueueLength(Optional.ofNullable(
- propertiesConfiguration.getInteger(MIGRATION_V1_V2_QUEUE_LENGTH, null)))
- .v1ReadFetchSize(Optional.ofNullable(
- propertiesConfiguration.getInteger(MIGRATION_V1_READ_SIZE, null)))
.build();
}
http://git-wip-us.apache.org/repos/asf/james-project/blob/51a1311f/server/container/guice/cassandra-guice/src/test/java/org/apache/james/modules/mailbox/CassandraSessionModuleTest.java
----------------------------------------------------------------------
diff --git a/server/container/guice/cassandra-guice/src/test/java/org/apache/james/modules/mailbox/CassandraSessionModuleTest.java b/server/container/guice/cassandra-guice/src/test/java/org/apache/james/modules/mailbox/CassandraSessionModuleTest.java
index 7ccc8a8..5ed9f0f 100644
--- a/server/container/guice/cassandra-guice/src/test/java/org/apache/james/modules/mailbox/CassandraSessionModuleTest.java
+++ b/server/container/guice/cassandra-guice/src/test/java/org/apache/james/modules/mailbox/CassandraSessionModuleTest.java
@@ -60,10 +60,6 @@ public class CassandraSessionModuleTest {
.messageReadChunkSize(8)
.expungeChunkSize(9)
.blobPartSize(10)
- .onTheFlyV1ToV2Migration(true)
- .v1ToV2ThreadCount(11)
- .v1ToV2QueueLength(12)
- .v1ReadFetchSize(13)
.build());
}
http://git-wip-us.apache.org/repos/asf/james-project/blob/51a1311f/server/container/guice/cassandra-guice/src/test/resources/modules/mailbox/cassandra.properties
----------------------------------------------------------------------
diff --git a/server/container/guice/cassandra-guice/src/test/resources/modules/mailbox/cassandra.properties b/server/container/guice/cassandra-guice/src/test/resources/modules/mailbox/cassandra.properties
index 54ede24..8d6c9fe 100644
--- a/server/container/guice/cassandra-guice/src/test/resources/modules/mailbox/cassandra.properties
+++ b/server/container/guice/cassandra-guice/src/test/resources/modules/mailbox/cassandra.properties
@@ -8,7 +8,3 @@ chunk.size.flags.update=7
chunk.size.message.read=8
chunk.size.expunge=9
mailbox.blob.part.size=10
-migration.v1.v2.on.the.fly=true
-migration.v1.v2.thread.count=11
-migration.v1.v2.queue.length=12
-migration.v1.read.fetch.size=13
http://git-wip-us.apache.org/repos/asf/james-project/blob/51a1311f/src/site/xdoc/server/config-cassandra.xml
----------------------------------------------------------------------
diff --git a/src/site/xdoc/server/config-cassandra.xml b/src/site/xdoc/server/config-cassandra.xml
index 6b9bf24..db5f92c 100644
--- a/src/site/xdoc/server/config-cassandra.xml
+++ b/src/site/xdoc/server/config-cassandra.xml
@@ -114,13 +114,13 @@
<dt><strong>mailbox.blob.part.size</strong></dt>
<dd>Optional. Defaults to 102400 (100KB).<br/> Controls the size of blob parts used to store messages.</dd>
<dt><strong>migration.v1.v2.on.the.fly</strong></dt>
- <dd>Optional. Defaults to false.<br/> Controls wether v1 to v2 migration should be run on the fly.</dd>
+ <dd>Only available on tag cassandra_migration_v1_to_v2. Optional. Defaults to false.<br/> Controls wether v1 to v2 migration should be run on the fly.</dd>
<dt><strong>migration.v1.v2.thread.count</strong></dt>
- <dd>Optional. Defaults to 2.<br/> Controls the number of threads used to asynchronously migrate from v1 to v2.</dd>
+ <dd>Only available on tag cassandra_migration_v1_to_v2. Optional. Defaults to 2.<br/> Controls the number of threads used to asynchronously migrate from v1 to v2.</dd>
<dt><strong>migration.v1.v2.queue.length</strong></dt>
- <dd>Optional. Defaults to 1000.<br/> Controls the queue size of v1 to v2 migration task. Drops when full.</dd>
+ <dd>Only available on tag cassandra_migration_v1_to_v2. Optional. Defaults to 1000.<br/> Controls the queue size of v1 to v2 migration task. Drops when full.</dd>
<dt><strong>migration.v1.read.fetch.size</strong></dt>
- <dd>Optional. Defaults to 10.<br/> Controls the fetch size of the request to retrieve all messages stored in V1 during the migration process.</dd>
+ <dd>Only available on tag cassandra_migration_v1_to_v2. Optional. Defaults to 10.<br/> Controls the fetch size of the request to retrieve all messages stored in V1 during the migration process.</dd>
</dl>
---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org