You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@james.apache.org by rc...@apache.org on 2020/10/14 02:31:37 UTC
[james-project] 11/22: JAMES-3409 Migration for MailboxPath V3
This is an automated email from the ASF dual-hosted git repository.
rcordier pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/james-project.git
commit 8a3dad0162a118acb3e8c68ffdf6c0edb626a07a
Author: Benoit Tellier <bt...@linagora.com>
AuthorDate: Wed Jul 29 17:45:28 2020 +0700
JAMES-3409 Migration for MailboxPath V3
---
.../versions/CassandraSchemaVersionManager.java | 2 +-
.../mail/migration/MailboxPathV3Migration.java | 139 +++++++++++++++++++++
...athV3MigrationTaskAdditionalInformationDTO.java | 89 +++++++++++++
.../migration/MailboxPathV3MigrationTaskDTO.java | 59 +++++++++
...ailboxPathV3MigrationTaskSerializationTest.java | 52 ++++++++
.../mail/migration/MailboxPathV3MigrationTest.java | 100 +++++++++++++++
.../modules/webadmin/CassandraRoutesModule.java | 3 +
7 files changed, 443 insertions(+), 1 deletion(-)
diff --git a/backends-common/cassandra/src/main/java/org/apache/james/backends/cassandra/versions/CassandraSchemaVersionManager.java b/backends-common/cassandra/src/main/java/org/apache/james/backends/cassandra/versions/CassandraSchemaVersionManager.java
index 516fbd3..e38037a 100644
--- a/backends-common/cassandra/src/main/java/org/apache/james/backends/cassandra/versions/CassandraSchemaVersionManager.java
+++ b/backends-common/cassandra/src/main/java/org/apache/james/backends/cassandra/versions/CassandraSchemaVersionManager.java
@@ -36,7 +36,7 @@ import reactor.core.publisher.Mono;
public class CassandraSchemaVersionManager {
public static final SchemaVersion MIN_VERSION = new SchemaVersion(5);
- public static final SchemaVersion MAX_VERSION = new SchemaVersion(7);
+ public static final SchemaVersion MAX_VERSION = new SchemaVersion(8);
public static final SchemaVersion DEFAULT_VERSION = MIN_VERSION;
private static final Logger LOGGER = LoggerFactory.getLogger(CassandraSchemaVersionManager.class);
diff --git a/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/mail/migration/MailboxPathV3Migration.java b/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/mail/migration/MailboxPathV3Migration.java
new file mode 100644
index 0000000..910c61f
--- /dev/null
+++ b/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/mail/migration/MailboxPathV3Migration.java
@@ -0,0 +1,139 @@
+/****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one *
+ * or more contributor license agreements. See the NOTICE file *
+ * distributed with this work for additional information *
+ * regarding copyright ownership. The ASF licenses this file *
+ * to you under the Apache License, Version 2.0 (the *
+ * "License"); you may not use this file except in compliance *
+ * with the License. You may obtain a copy of the License at *
+ * *
+ * http://www.apache.org/licenses/LICENSE-2.0 *
+ * *
+ * Unless required by applicable law or agreed to in writing, *
+ * software distributed under the License is distributed on an *
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY *
+ * KIND, either express or implied. See the License for the *
+ * specific language governing permissions and limitations *
+ * under the License. *
+ ****************************************************************/
+
+package org.apache.james.mailbox.cassandra.mail.migration;
+
+import java.time.Clock;
+import java.time.Instant;
+import java.util.Optional;
+
+import javax.inject.Inject;
+
+import org.apache.james.backends.cassandra.migration.Migration;
+import org.apache.james.mailbox.cassandra.mail.CassandraIdAndPath;
+import org.apache.james.mailbox.cassandra.mail.CassandraMailboxDAO;
+import org.apache.james.mailbox.cassandra.mail.CassandraMailboxPathV2DAO;
+import org.apache.james.mailbox.cassandra.mail.CassandraMailboxPathV3DAO;
+import org.apache.james.task.Task;
+import org.apache.james.task.TaskExecutionDetails;
+import org.apache.james.task.TaskType;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import reactor.core.publisher.Mono;
+
+public class MailboxPathV3Migration implements Migration {
+
+ static class MailboxPathV3MigrationTask implements Task {
+ private final MailboxPathV3Migration migration;
+
+ MailboxPathV3MigrationTask(MailboxPathV3Migration migration) {
+ this.migration = migration;
+ }
+
+ @Override
+ public Result run() throws InterruptedException {
+ return migration.runTask();
+ }
+
+ @Override
+ public TaskType type() {
+ return TYPE;
+ }
+
+ @Override
+ public Optional<TaskExecutionDetails.AdditionalInformation> details() {
+ return Optional.of(migration.getAdditionalInformation());
+ }
+ }
+
+ public static class AdditionalInformation implements TaskExecutionDetails.AdditionalInformation {
+ private final long remainingCount;
+ private final long initialCount;
+ private final Instant timestamp;
+
+ public AdditionalInformation(long remainingCount, long initialCount, Instant timestamp) {
+ this.remainingCount = remainingCount;
+ this.initialCount = initialCount;
+ this.timestamp = timestamp;
+ }
+
+ public long getRemainingCount() {
+ return remainingCount;
+ }
+
+ public long getInitialCount() {
+ return initialCount;
+ }
+
+ @Override
+ public Instant timestamp() {
+ return timestamp;
+ }
+ }
+
+ public static final Logger LOGGER = LoggerFactory.getLogger(MailboxPathV3Migration.class);
+ public static final TaskType TYPE = TaskType.of("cassandra-mailbox-path-v3-migration");
+ private final CassandraMailboxPathV2DAO daoV2;
+ private final CassandraMailboxPathV3DAO daoV3;
+ private final CassandraMailboxDAO mailboxDAO;
+ private final long initialCount;
+
+ @Inject
+ public MailboxPathV3Migration(CassandraMailboxPathV2DAO daoV2, CassandraMailboxPathV3DAO daoV3, CassandraMailboxDAO mailboxDAO) {
+ this.daoV2 = daoV2;
+ this.daoV3 = daoV3;
+ this.mailboxDAO = mailboxDAO;
+ this.initialCount = getCurrentCount();
+ }
+
+ @Override
+ public void apply() {
+ daoV2.listAll()
+ .flatMap(this::migrate)
+ .doOnError(t -> LOGGER.error("Error while performing migration", t))
+ .blockLast();
+ }
+
+ private Mono<Void> migrate(CassandraIdAndPath idAndPath) {
+ return mailboxDAO.retrieveMailbox(idAndPath.getCassandraId())
+ .flatMap(mailbox -> daoV3.save(mailbox)
+ .then(daoV2.delete(mailbox.generateAssociatedPath())))
+ .onErrorResume(error -> handleErrorMigrate(idAndPath, error))
+ .then();
+ }
+
+ private Mono<Void> handleErrorMigrate(CassandraIdAndPath idAndPath, Throwable throwable) {
+ LOGGER.error("Error while performing migration for path {}", idAndPath.getMailboxPath(), throwable);
+ return Mono.empty();
+ }
+
+ @Override
+ public Task asTask() {
+ return new MailboxPathV3MigrationTask(this);
+ }
+
+ AdditionalInformation getAdditionalInformation() {
+ return new AdditionalInformation(getCurrentCount(), initialCount, Clock.systemUTC().instant());
+ }
+
+ private Long getCurrentCount() {
+ return daoV2.listAll().count().block();
+ }
+}
diff --git a/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/mail/migration/MailboxPathV3MigrationTaskAdditionalInformationDTO.java b/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/mail/migration/MailboxPathV3MigrationTaskAdditionalInformationDTO.java
new file mode 100644
index 0000000..acb62c9
--- /dev/null
+++ b/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/mail/migration/MailboxPathV3MigrationTaskAdditionalInformationDTO.java
@@ -0,0 +1,89 @@
+/****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one *
+ * or more contributor license agreements. See the NOTICE file *
+ * distributed with this work for additional information *
+ * regarding copyright ownership. The ASF licenses this file *
+ * to you under the Apache License, Version 2.0 (the *
+ * "License"); you may not use this file except in compliance *
+ * with the License. You may obtain a copy of the License at *
+ * *
+ * http://www.apache.org/licenses/LICENSE-2.0 *
+ * *
+ * Unless required by applicable law or agreed to in writing, *
+ * software distributed under the License is distributed on an *
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY *
+ * KIND, either express or implied. See the License for the *
+ * specific language governing permissions and limitations *
+ * under the License. *
+ ****************************************************************/
+
+package org.apache.james.mailbox.cassandra.mail.migration;
+
+import java.time.Instant;
+
+import org.apache.james.json.DTOModule;
+import org.apache.james.server.task.json.dto.AdditionalInformationDTO;
+import org.apache.james.server.task.json.dto.AdditionalInformationDTOModule;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+public class MailboxPathV3MigrationTaskAdditionalInformationDTO implements AdditionalInformationDTO {
+
+ private static MailboxPathV3MigrationTaskAdditionalInformationDTO fromDomainObject(MailboxPathV3Migration.AdditionalInformation additionalInformation, String type) {
+ return new MailboxPathV3MigrationTaskAdditionalInformationDTO(
+ type,
+ additionalInformation.getRemainingCount(),
+ additionalInformation.getInitialCount(),
+ additionalInformation.timestamp()
+ );
+ }
+
+ public static final AdditionalInformationDTOModule<MailboxPathV3Migration.AdditionalInformation, MailboxPathV3MigrationTaskAdditionalInformationDTO> MODULE =
+ DTOModule
+ .forDomainObject(MailboxPathV3Migration.AdditionalInformation.class)
+ .convertToDTO(MailboxPathV3MigrationTaskAdditionalInformationDTO.class)
+ .toDomainObjectConverter(MailboxPathV3MigrationTaskAdditionalInformationDTO::toDomainObject)
+ .toDTOConverter(MailboxPathV3MigrationTaskAdditionalInformationDTO::fromDomainObject)
+ .typeName(MailboxPathV3Migration.TYPE.asString())
+ .withFactory(AdditionalInformationDTOModule::new);
+
+ private final String type;
+ private final long remainingCount;
+ private final long initialCount;
+ private final Instant timestamp;
+
+ public MailboxPathV3MigrationTaskAdditionalInformationDTO(@JsonProperty("type") String type,
+ @JsonProperty("remainingCount") long remainingCount,
+ @JsonProperty("initialCount") long initialCount,
+ @JsonProperty("timestamp") Instant timestamp) {
+ this.type = type;
+ this.remainingCount = remainingCount;
+ this.initialCount = initialCount;
+ this.timestamp = timestamp;
+ }
+
+ public long getRemainingCount() {
+ return remainingCount;
+ }
+
+ public long getInitialCount() {
+ return initialCount;
+ }
+
+ @Override
+ public Instant getTimestamp() {
+ return timestamp;
+ }
+
+ @Override
+ public String getType() {
+ return type;
+ }
+
+ private MailboxPathV3Migration.AdditionalInformation toDomainObject() {
+ return new MailboxPathV3Migration.AdditionalInformation(
+ remainingCount,
+ initialCount,
+ timestamp);
+ }
+}
diff --git a/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/mail/migration/MailboxPathV3MigrationTaskDTO.java b/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/mail/migration/MailboxPathV3MigrationTaskDTO.java
new file mode 100644
index 0000000..9683ec9
--- /dev/null
+++ b/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/mail/migration/MailboxPathV3MigrationTaskDTO.java
@@ -0,0 +1,59 @@
+/****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one *
+ * or more contributor license agreements. See the NOTICE file *
+ * distributed with this work for additional information *
+ * regarding copyright ownership. The ASF licenses this file *
+ * to you under the Apache License, Version 2.0 (the *
+ * "License"); you may not use this file except in compliance *
+ * with the License. You may obtain a copy of the License at *
+ * *
+ * http://www.apache.org/licenses/LICENSE-2.0 *
+ * *
+ * Unless required by applicable law or agreed to in writing, *
+ * software distributed under the License is distributed on an *
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY *
+ * KIND, either express or implied. See the License for the *
+ * specific language governing permissions and limitations *
+ * under the License. *
+ ****************************************************************/
+
+package org.apache.james.mailbox.cassandra.mail.migration;
+
+import java.util.function.Function;
+
+import org.apache.james.json.DTOModule;
+import org.apache.james.server.task.json.dto.TaskDTO;
+import org.apache.james.server.task.json.dto.TaskDTOModule;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+public class MailboxPathV3MigrationTaskDTO implements TaskDTO {
+
+ private static MailboxPathV3MigrationTaskDTO fromDomainObject(MailboxPathV3Migration.MailboxPathV3MigrationTask task, String type) {
+ return new MailboxPathV3MigrationTaskDTO(type);
+ }
+
+ public static final Function<MailboxPathV3Migration, TaskDTOModule<MailboxPathV3Migration.MailboxPathV3MigrationTask, MailboxPathV3MigrationTaskDTO>> MODULE = (migration) ->
+ DTOModule
+ .forDomainObject(MailboxPathV3Migration.MailboxPathV3MigrationTask.class)
+ .convertToDTO(MailboxPathV3MigrationTaskDTO.class)
+ .toDomainObjectConverter(dto -> dto.toDomainObject(migration))
+ .toDTOConverter(MailboxPathV3MigrationTaskDTO::fromDomainObject)
+ .typeName(MailboxPathV3Migration.TYPE.asString())
+ .withFactory(TaskDTOModule::new);
+
+ private final String type;
+
+ public MailboxPathV3MigrationTaskDTO(@JsonProperty("type") String type) {
+ this.type = type;
+ }
+
+ @Override
+ public String getType() {
+ return type;
+ }
+
+ private MailboxPathV3Migration.MailboxPathV3MigrationTask toDomainObject(MailboxPathV3Migration migration) {
+ return new MailboxPathV3Migration.MailboxPathV3MigrationTask(migration);
+ }
+}
diff --git a/mailbox/cassandra/src/test/java/org/apache/james/mailbox/cassandra/mail/migration/MailboxPathV3MigrationTaskSerializationTest.java b/mailbox/cassandra/src/test/java/org/apache/james/mailbox/cassandra/mail/migration/MailboxPathV3MigrationTaskSerializationTest.java
new file mode 100644
index 0000000..9bf660a
--- /dev/null
+++ b/mailbox/cassandra/src/test/java/org/apache/james/mailbox/cassandra/mail/migration/MailboxPathV3MigrationTaskSerializationTest.java
@@ -0,0 +1,52 @@
+/****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one *
+ * or more contributor license agreements. See the NOTICE file *
+ * distributed with this work for additional information *
+ * regarding copyright ownership. The ASF licenses this file *
+ * to you under the Apache License, Version 2.0 (the *
+ * "License"); you may not use this file except in compliance *
+ * with the License. You may obtain a copy of the License at *
+ * *
+ * http://www.apache.org/licenses/LICENSE-2.0 *
+ * *
+ * Unless required by applicable law or agreed to in writing, *
+ * software distributed under the License is distributed on an *
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY *
+ * KIND, either express or implied. See the License for the *
+ * specific language governing permissions and limitations *
+ * under the License. *
+ ****************************************************************/
+
+package org.apache.james.mailbox.cassandra.mail.migration;
+
+import static org.mockito.Mockito.mock;
+
+import java.time.Instant;
+
+import org.apache.james.JsonSerializationVerifier;
+import org.junit.jupiter.api.Test;
+
+class MailboxPathV3MigrationTaskSerializationTest {
+ private static final Instant TIMESTAMP = Instant.parse("2018-11-13T12:00:55Z");
+ private static final MailboxPathV3Migration MIGRATION = mock(MailboxPathV3Migration.class);
+ private static final MailboxPathV3Migration.MailboxPathV3MigrationTask TASK = new MailboxPathV3Migration.MailboxPathV3MigrationTask(MIGRATION);
+ private static final String SERIALIZED_TASK = "{\"type\": \"cassandra-mailbox-path-v3-migration\"}";
+ private static final MailboxPathV3Migration.AdditionalInformation DETAILS = new MailboxPathV3Migration.AdditionalInformation(42L, 10, TIMESTAMP);
+ private static final String SERIALIZED_ADDITIONAL_INFORMATION = "{\"type\": \"cassandra-mailbox-path-v3-migration\", \"remainingCount\":42,\"initialCount\":10, \"timestamp\":\"2018-11-13T12:00:55Z\"}";
+
+ @Test
+ void taskShouldBeSerializable() throws Exception {
+ JsonSerializationVerifier.dtoModule(MailboxPathV3MigrationTaskDTO.MODULE.apply(MIGRATION))
+ .bean(TASK)
+ .json(SERIALIZED_TASK)
+ .verify();
+ }
+
+ @Test
+ void additionalInformationShouldBeSerializable() throws Exception {
+ JsonSerializationVerifier.dtoModule(MailboxPathV3MigrationTaskAdditionalInformationDTO.MODULE)
+ .bean(DETAILS)
+ .json(SERIALIZED_ADDITIONAL_INFORMATION)
+ .verify();
+ }
+}
diff --git a/mailbox/cassandra/src/test/java/org/apache/james/mailbox/cassandra/mail/migration/MailboxPathV3MigrationTest.java b/mailbox/cassandra/src/test/java/org/apache/james/mailbox/cassandra/mail/migration/MailboxPathV3MigrationTest.java
new file mode 100644
index 0000000..e0c7108
--- /dev/null
+++ b/mailbox/cassandra/src/test/java/org/apache/james/mailbox/cassandra/mail/migration/MailboxPathV3MigrationTest.java
@@ -0,0 +1,100 @@
+/****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one *
+ * or more contributor license agreements. See the NOTICE file *
+ * distributed with this work for additional information *
+ * regarding copyright ownership. The ASF licenses this file *
+ * to you under the Apache License, Version 2.0 (the *
+ * "License"); you may not use this file except in compliance *
+ * with the License. You may obtain a copy of the License at *
+ * *
+ * http://www.apache.org/licenses/LICENSE-2.0 *
+ * *
+ * Unless required by applicable law or agreed to in writing, *
+ * software distributed under the License is distributed on an *
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY *
+ * KIND, either express or implied. See the License for the *
+ * specific language governing permissions and limitations *
+ * under the License. *
+ ****************************************************************/
+
+package org.apache.james.mailbox.cassandra.mail.migration;
+
+import org.apache.james.backends.cassandra.CassandraCluster;
+import org.apache.james.backends.cassandra.CassandraClusterExtension;
+import org.apache.james.backends.cassandra.components.CassandraModule;
+import org.apache.james.backends.cassandra.utils.CassandraUtils;
+import org.apache.james.backends.cassandra.versions.CassandraSchemaVersionModule;
+import org.apache.james.core.Username;
+import org.apache.james.mailbox.cassandra.ids.CassandraId;
+import org.apache.james.mailbox.cassandra.mail.CassandraMailboxDAO;
+import org.apache.james.mailbox.cassandra.mail.CassandraMailboxPathDAOImpl;
+import org.apache.james.mailbox.cassandra.mail.CassandraMailboxPathV2DAO;
+import org.apache.james.mailbox.cassandra.mail.CassandraMailboxPathV3DAO;
+import org.apache.james.mailbox.cassandra.modules.CassandraAclModule;
+import org.apache.james.mailbox.cassandra.modules.CassandraMailboxModule;
+import org.apache.james.mailbox.model.Mailbox;
+import org.apache.james.mailbox.model.MailboxPath;
+import org.apache.james.mailbox.model.UidValidity;
+import org.assertj.core.api.SoftAssertions;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.RegisterExtension;
+
+class MailboxPathV3MigrationTest {
+
+ private static final MailboxPath MAILBOX_PATH_1 = MailboxPath.forUser(Username.of("bob"), "Important");
+ private static final UidValidity UID_VALIDITY_1 = UidValidity.of(452);
+ private static final CassandraId MAILBOX_ID_1 = CassandraId.timeBased();
+ private static final Mailbox MAILBOX = new Mailbox(MAILBOX_PATH_1, UID_VALIDITY_1, MAILBOX_ID_1);
+
+
+ public static final CassandraModule MODULES = CassandraModule.aggregateModules(
+ CassandraMailboxModule.MODULE,
+ CassandraAclModule.MODULE,
+ CassandraSchemaVersionModule.MODULE);
+
+ @RegisterExtension
+ static CassandraClusterExtension cassandraCluster = new CassandraClusterExtension(MODULES);
+
+ private CassandraMailboxPathDAOImpl daoV1;
+ private CassandraMailboxPathV2DAO daoV2;
+ private CassandraMailboxPathV3DAO daoV3;
+ private CassandraMailboxDAO mailboxDAO;
+
+ @BeforeEach
+ void setUp(CassandraCluster cassandra) {
+ daoV1 = new CassandraMailboxPathDAOImpl(
+ cassandra.getConf(),
+ cassandra.getTypesProvider(),
+ CassandraUtils.WITH_DEFAULT_CONFIGURATION,
+ cassandraCluster.getCassandraConsistenciesConfiguration());
+ daoV2 = new CassandraMailboxPathV2DAO(
+ cassandra.getConf(),
+ CassandraUtils.WITH_DEFAULT_CONFIGURATION,
+ cassandraCluster.getCassandraConsistenciesConfiguration());
+ daoV3 = new CassandraMailboxPathV3DAO(
+ cassandra.getConf(),
+ CassandraUtils.WITH_DEFAULT_CONFIGURATION,
+ cassandraCluster.getCassandraConsistenciesConfiguration());
+
+ mailboxDAO = new CassandraMailboxDAO(
+ cassandra.getConf(),
+ cassandra.getTypesProvider(),
+ cassandraCluster.getCassandraConsistenciesConfiguration());
+ }
+
+ @Test
+ void migrationTaskShouldMoveDataToMostRecentDao() {
+ daoV2.save(MAILBOX_PATH_1, MAILBOX_ID_1).block();
+ mailboxDAO.save(MAILBOX).block();
+
+ new MailboxPathV3Migration(daoV2, daoV3, mailboxDAO).apply();
+
+ SoftAssertions softly = new SoftAssertions();
+ softly.assertThat(daoV1.retrieveId(MAILBOX_PATH_1).blockOptional()).isEmpty();
+ softly.assertThat(daoV2.retrieveId(MAILBOX_PATH_1).blockOptional()).isEmpty();
+ softly.assertThat(daoV3.retrieve(MAILBOX_PATH_1).blockOptional())
+ .contains(MAILBOX);
+ softly.assertAll();
+ }
+}
\ No newline at end of file
diff --git a/server/container/guice/cassandra-guice/src/main/java/org/apache/james/modules/webadmin/CassandraRoutesModule.java b/server/container/guice/cassandra-guice/src/main/java/org/apache/james/modules/webadmin/CassandraRoutesModule.java
index 23a4f0a..90e8911 100644
--- a/server/container/guice/cassandra-guice/src/main/java/org/apache/james/modules/webadmin/CassandraRoutesModule.java
+++ b/server/container/guice/cassandra-guice/src/main/java/org/apache/james/modules/webadmin/CassandraRoutesModule.java
@@ -26,6 +26,7 @@ import org.apache.james.backends.cassandra.versions.CassandraSchemaVersionManage
import org.apache.james.backends.cassandra.versions.SchemaTransition;
import org.apache.james.backends.cassandra.versions.SchemaVersion;
import org.apache.james.mailbox.cassandra.mail.migration.MailboxPathV2Migration;
+import org.apache.james.mailbox.cassandra.mail.migration.MailboxPathV3Migration;
import org.apache.james.rrt.cassandra.migration.MappingsSourcesMigration;
import org.apache.james.webadmin.Routes;
import org.apache.james.webadmin.routes.CassandraMailboxMergingRoutes;
@@ -40,6 +41,7 @@ import com.google.inject.name.Names;
public class CassandraRoutesModule extends AbstractModule {
private static final SchemaTransition FROM_V5_TO_V6 = SchemaTransition.to(new SchemaVersion(6));
private static final SchemaTransition FROM_V6_TO_V7 = SchemaTransition.to(new SchemaVersion(7));
+ private static final SchemaTransition FROM_V7_TO_V8 = SchemaTransition.to(new SchemaVersion(8));
@Override
protected void configure() {
@@ -57,6 +59,7 @@ public class CassandraRoutesModule extends AbstractModule {
MapBinder<SchemaTransition, Migration> allMigrationClazzBinder = MapBinder.newMapBinder(binder(), SchemaTransition.class, Migration.class);
allMigrationClazzBinder.addBinding(FROM_V5_TO_V6).to(MailboxPathV2Migration.class);
allMigrationClazzBinder.addBinding(FROM_V6_TO_V7).to(MappingsSourcesMigration.class);
+ allMigrationClazzBinder.addBinding(FROM_V7_TO_V8).to(MailboxPathV3Migration.class);
bind(SchemaVersion.class)
.annotatedWith(Names.named(CassandraMigrationService.LATEST_VERSION))
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@james.apache.org
For additional commands, e-mail: notifications-help@james.apache.org