Workarounds to startup DatabaseService
- shaded copycat - switched Chronicle log to InMemory log until we fix the OSGi issue Change-Id: Icf8ee8c18b518a8ee785924413681bdb61fc5037
Showing
7 changed files
with
109 additions
and
13 deletions
| ... | @@ -31,6 +31,10 @@ | ... | @@ -31,6 +31,10 @@ |
| 31 | 31 | ||
| 32 | <description>ONOS Gossip based distributed store subsystems</description> | 32 | <description>ONOS Gossip based distributed store subsystems</description> |
| 33 | 33 | ||
| 34 | + <properties> | ||
| 35 | + <copycat.version>0.4.0-SNAPSHOT</copycat.version> | ||
| 36 | + </properties> | ||
| 37 | + | ||
| 34 | <dependencies> | 38 | <dependencies> |
| 35 | <dependency> | 39 | <dependency> |
| 36 | <groupId>org.onlab.onos</groupId> | 40 | <groupId>org.onlab.onos</groupId> |
| ... | @@ -43,24 +47,25 @@ | ... | @@ -43,24 +47,25 @@ |
| 43 | <artifactId>onlab-netty</artifactId> | 47 | <artifactId>onlab-netty</artifactId> |
| 44 | <version>${project.version}</version> | 48 | <version>${project.version}</version> |
| 45 | </dependency> | 49 | </dependency> |
| 46 | - | 50 | +<!-- |
| 47 | <dependency> | 51 | <dependency> |
| 48 | <groupId>net.kuujo.copycat</groupId> | 52 | <groupId>net.kuujo.copycat</groupId> |
| 49 | <artifactId>copycat</artifactId> | 53 | <artifactId>copycat</artifactId> |
| 50 | - <version>0.4.0-SNAPSHOT</version> | 54 | + <version>${copycat.version}</version> |
| 51 | </dependency> | 55 | </dependency> |
| 52 | 56 | ||
| 53 | <dependency> | 57 | <dependency> |
| 54 | <groupId>net.kuujo.copycat</groupId> | 58 | <groupId>net.kuujo.copycat</groupId> |
| 55 | <artifactId>copycat-chronicle</artifactId> | 59 | <artifactId>copycat-chronicle</artifactId> |
| 56 | - <version>0.4.0-SNAPSHOT</version> | 60 | + <version>${copycat.version}</version> |
| 57 | </dependency> | 61 | </dependency> |
| 58 | 62 | ||
| 59 | <dependency> | 63 | <dependency> |
| 60 | <groupId>net.kuujo.copycat</groupId> | 64 | <groupId>net.kuujo.copycat</groupId> |
| 61 | <artifactId>copycat-tcp</artifactId> | 65 | <artifactId>copycat-tcp</artifactId> |
| 62 | - <version>0.4.0-SNAPSHOT</version> | 66 | + <version>${copycat.version}</version> |
| 63 | </dependency> | 67 | </dependency> |
| 68 | +--> | ||
| 64 | 69 | ||
| 65 | <dependency> | 70 | <dependency> |
| 66 | <groupId>com.fasterxml.jackson.core</groupId> | 71 | <groupId>com.fasterxml.jackson.core</groupId> |
| ... | @@ -95,6 +100,12 @@ | ... | @@ -95,6 +100,12 @@ |
| 95 | <groupId>com.hazelcast</groupId> | 100 | <groupId>com.hazelcast</groupId> |
| 96 | <artifactId>hazelcast</artifactId> | 101 | <artifactId>hazelcast</artifactId> |
| 97 | </dependency> | 102 | </dependency> |
| 103 | + | ||
| 104 | + <!-- for shaded copycat --> | ||
| 105 | + <dependency> | ||
| 106 | + <groupId>org.onlab.onos</groupId> | ||
| 107 | + <artifactId>onlab-thirdparty</artifactId> | ||
| 108 | + </dependency> | ||
| 98 | </dependencies> | 109 | </dependencies> |
| 99 | 110 | ||
| 100 | </project> | 111 | </project> | ... | ... |
| ... | @@ -64,7 +64,8 @@ import com.google.common.collect.ImmutableSet; | ... | @@ -64,7 +64,8 @@ import com.google.common.collect.ImmutableSet; |
| 64 | */ | 64 | */ |
| 65 | @Component(immediate = true) | 65 | @Component(immediate = true) |
| 66 | @Service | 66 | @Service |
| 67 | -public class ClusterMessagingProtocol implements Protocol<TcpMember> { | 67 | +public class ClusterMessagingProtocol |
| 68 | + implements DatabaseProtocolService, Protocol<TcpMember> { | ||
| 68 | 69 | ||
| 69 | private final Logger log = getLogger(getClass()); | 70 | private final Logger log = getLogger(getClass()); |
| 70 | 71 | ... | ... |
| ... | @@ -11,9 +11,8 @@ import net.kuujo.copycat.StateMachine; | ... | @@ -11,9 +11,8 @@ import net.kuujo.copycat.StateMachine; |
| 11 | import net.kuujo.copycat.cluster.TcpCluster; | 11 | import net.kuujo.copycat.cluster.TcpCluster; |
| 12 | import net.kuujo.copycat.cluster.TcpClusterConfig; | 12 | import net.kuujo.copycat.cluster.TcpClusterConfig; |
| 13 | import net.kuujo.copycat.cluster.TcpMember; | 13 | import net.kuujo.copycat.cluster.TcpMember; |
| 14 | -import net.kuujo.copycat.log.ChronicleLog; | 14 | +import net.kuujo.copycat.log.InMemoryLog; |
| 15 | import net.kuujo.copycat.log.Log; | 15 | import net.kuujo.copycat.log.Log; |
| 16 | - | ||
| 17 | import org.apache.felix.scr.annotations.Activate; | 16 | import org.apache.felix.scr.annotations.Activate; |
| 18 | import org.apache.felix.scr.annotations.Component; | 17 | import org.apache.felix.scr.annotations.Component; |
| 19 | import org.apache.felix.scr.annotations.Deactivate; | 18 | import org.apache.felix.scr.annotations.Deactivate; |
| ... | @@ -52,7 +51,7 @@ public class DatabaseManager implements DatabaseService, DatabaseAdminService { | ... | @@ -52,7 +51,7 @@ public class DatabaseManager implements DatabaseService, DatabaseAdminService { |
| 52 | protected ClusterService clusterService; | 51 | protected ClusterService clusterService; |
| 53 | 52 | ||
| 54 | @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) | 53 | @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) |
| 55 | - protected ClusterMessagingProtocol copycatMessagingProtocol; | 54 | + protected DatabaseProtocolService copycatMessagingProtocol; |
| 56 | 55 | ||
| 57 | public static final String LOG_FILE_PREFIX = "onos-copy-cat-log"; | 56 | public static final String LOG_FILE_PREFIX = "onos-copy-cat-log"; |
| 58 | 57 | ||
| ... | @@ -61,6 +60,7 @@ public class DatabaseManager implements DatabaseService, DatabaseAdminService { | ... | @@ -61,6 +60,7 @@ public class DatabaseManager implements DatabaseService, DatabaseAdminService { |
| 61 | 60 | ||
| 62 | @Activate | 61 | @Activate |
| 63 | public void activate() { | 62 | public void activate() { |
| 63 | + log.info("Starting."); | ||
| 64 | 64 | ||
| 65 | // TODO: Not every node can be part of the consensus ring. | 65 | // TODO: Not every node can be part of the consensus ring. |
| 66 | 66 | ||
| ... | @@ -88,7 +88,9 @@ public class DatabaseManager implements DatabaseService, DatabaseAdminService { | ... | @@ -88,7 +88,9 @@ public class DatabaseManager implements DatabaseService, DatabaseAdminService { |
| 88 | 88 | ||
| 89 | StateMachine stateMachine = new DatabaseStateMachine(); | 89 | StateMachine stateMachine = new DatabaseStateMachine(); |
| 90 | ControllerNode thisNode = clusterService.getLocalNode(); | 90 | ControllerNode thisNode = clusterService.getLocalNode(); |
| 91 | - Log consensusLog = new ChronicleLog(LOG_FILE_PREFIX + "_" + thisNode.id()); | 91 | + // FIXME resolve Chronicle + OSGi issue |
| 92 | + //Log consensusLog = new ChronicleLog(LOG_FILE_PREFIX + "_" + thisNode.id()); | ||
| 93 | + Log consensusLog = new InMemoryLog(); | ||
| 92 | 94 | ||
| 93 | copycat = new Copycat(stateMachine, consensusLog, cluster, copycatMessagingProtocol); | 95 | copycat = new Copycat(stateMachine, consensusLog, cluster, copycatMessagingProtocol); |
| 94 | copycat.start(); | 96 | copycat.start(); | ... | ... |
core/store/dist/src/main/java/org/onlab/onos/store/service/impl/DatabaseProtocolService.java
0 → 100644
| 1 | +package org.onlab.onos.store.service.impl; | ||
| 2 | + | ||
| 3 | +import net.kuujo.copycat.cluster.TcpMember; | ||
| 4 | +import net.kuujo.copycat.spi.protocol.Protocol; | ||
| 5 | + | ||
| 6 | +// interface required for connecting DatabaseManager + ClusterMessagingProtocol | ||
| 7 | +// TODO: Consider changing ClusterMessagingProtocol to non-Service class | ||
| 8 | +public interface DatabaseProtocolService extends Protocol<TcpMember> { | ||
| 9 | + | ||
| 10 | +} |
| 1 | +/* | ||
| 2 | + * Copyright 2014 Open Networking Laboratory | ||
| 3 | + * | ||
| 4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| 5 | + * you may not use this file except in compliance with the License. | ||
| 6 | + * You may obtain a copy of the License at | ||
| 7 | + * | ||
| 8 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
| 9 | + * | ||
| 10 | + * Unless required by applicable law or agreed to in writing, software | ||
| 11 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
| 12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| 13 | + * See the License for the specific language governing permissions and | ||
| 14 | + * limitations under the License. | ||
| 15 | + */ | ||
| 16 | + | ||
| 1 | /** | 17 | /** |
| 2 | * Distributed core state management services. | 18 | * Distributed core state management services. |
| 3 | */ | 19 | */ |
| 4 | package org.onlab.onos.store.service; | 20 | package org.onlab.onos.store.service; |
| 21 | + | ... | ... |
| ... | @@ -56,9 +56,16 @@ | ... | @@ -56,9 +56,16 @@ |
| 56 | <bundle>mvn:org.codehaus.jackson/jackson-mapper-asl/1.9.13</bundle> | 56 | <bundle>mvn:org.codehaus.jackson/jackson-mapper-asl/1.9.13</bundle> |
| 57 | 57 | ||
| 58 | <bundle>mvn:org.onlab.onos/onlab-thirdparty/1.0.0-SNAPSHOT</bundle> | 58 | <bundle>mvn:org.onlab.onos/onlab-thirdparty/1.0.0-SNAPSHOT</bundle> |
| 59 | - | 59 | +<!-- FIXME: resolce Chronicle's dependency issue |
| 60 | - <!-- FIXME fix the version before release --> | 60 | + <bundle>mvn:net.openhft/lang/6.4.6</bundle> |
| 61 | + <bundle>mvn:net.openhft/affinity/2.1.1</bundle> | ||
| 62 | + <bundle>mvn:net.openhft/chronicle/3.2.2</bundle> | ||
| 63 | +--> | ||
| 64 | +<!-- things used before shading copycat | ||
| 61 | <bundle>wrap:mvn:http://mavenrepo.onlab.us:8081/nexus/content/groups/public@id=onlab-temp!net.kuujo.copycat/copycat/0.4.0-SNAPSHOT$Bundle-SymbolicName=net.kuujo.copycat.copycat&Bundle-Version=0.4.0.SNAPSHOT</bundle> | 65 | <bundle>wrap:mvn:http://mavenrepo.onlab.us:8081/nexus/content/groups/public@id=onlab-temp!net.kuujo.copycat/copycat/0.4.0-SNAPSHOT$Bundle-SymbolicName=net.kuujo.copycat.copycat&Bundle-Version=0.4.0.SNAPSHOT</bundle> |
| 66 | + <bundle>wrap:mvn:http://mavenrepo.onlab.us:8081/nexus/content/groups/public@id=onlab-temp!net.kuujo.copycat/copycat-tcp/0.4.0-SNAPSHOT$Bundle-SymbolicName=net.kuujo.copycat.copycat-tcp&Bundle-Version=0.4.0.SNAPSHOT</bundle> | ||
| 67 | + <bundle>wrap:mvn:http://mavenrepo.onlab.us:8081/nexus/content/groups/public@id=onlab-temp!net.kuujo.copycat/copycat-chronicle/0.4.0-SNAPSHOT$Bundle-SymbolicName=net.kuujo.copycat.copycat-chronicle&Bundle-Version=0.4.0.SNAPSHOT</bundle> | ||
| 68 | +--> | ||
| 62 | </feature> | 69 | </feature> |
| 63 | 70 | ||
| 64 | <feature name="onos-thirdparty-web" version="1.0.0" | 71 | <feature name="onos-thirdparty-web" version="1.0.0" | ... | ... |
| ... | @@ -31,12 +31,43 @@ | ... | @@ -31,12 +31,43 @@ |
| 31 | 31 | ||
| 32 | <description>ONLab third-party dependencies</description> | 32 | <description>ONLab third-party dependencies</description> |
| 33 | 33 | ||
| 34 | + <!-- TODO move to root pom? --> | ||
| 35 | + <properties> | ||
| 36 | + <copycat.version>0.4.0-SNAPSHOT</copycat.version> | ||
| 37 | + </properties> | ||
| 38 | + | ||
| 34 | <dependencies> | 39 | <dependencies> |
| 35 | <dependency> | 40 | <dependency> |
| 36 | <groupId>com.googlecode.concurrent-trees</groupId> | 41 | <groupId>com.googlecode.concurrent-trees</groupId> |
| 37 | <artifactId>concurrent-trees</artifactId> | 42 | <artifactId>concurrent-trees</artifactId> |
| 38 | <version>2.4.0</version> | 43 | <version>2.4.0</version> |
| 39 | </dependency> | 44 | </dependency> |
| 45 | + | ||
| 46 | + <dependency> | ||
| 47 | + <groupId>net.kuujo.copycat</groupId> | ||
| 48 | + <artifactId>copycat</artifactId> | ||
| 49 | + <version>${copycat.version}</version> | ||
| 50 | + </dependency> | ||
| 51 | +<!-- Commented out due to Chronicle + OSGi issue | ||
| 52 | + <dependency> | ||
| 53 | + <groupId>net.kuujo.copycat</groupId> | ||
| 54 | + <artifactId>copycat-chronicle</artifactId> | ||
| 55 | + <version>${copycat.version}</version> | ||
| 56 | + </dependency> | ||
| 57 | +--> | ||
| 58 | + <dependency> | ||
| 59 | + <groupId>net.kuujo.copycat</groupId> | ||
| 60 | + <artifactId>copycat-tcp</artifactId> | ||
| 61 | + <version>${copycat.version}</version> | ||
| 62 | + </dependency> | ||
| 63 | + | ||
| 64 | +<!-- chronicle transitive dependency | ||
| 65 | + <dependency> | ||
| 66 | + <groupId>net.java.dev.jna</groupId> | ||
| 67 | + <artifactId>jna</artifactId> | ||
| 68 | + <version>4.1.0</version> | ||
| 69 | + </dependency> | ||
| 70 | +--> | ||
| 40 | </dependencies> | 71 | </dependencies> |
| 41 | 72 | ||
| 42 | <build> | 73 | <build> |
| ... | @@ -47,19 +78,36 @@ | ... | @@ -47,19 +78,36 @@ |
| 47 | <version>2.3</version> | 78 | <version>2.3</version> |
| 48 | <configuration> | 79 | <configuration> |
| 49 | <filters> | 80 | <filters> |
| 81 | + | ||
| 50 | <filter> | 82 | <filter> |
| 51 | <artifact>com.googlecode.concurrent-trees:concurrent-trees</artifact> | 83 | <artifact>com.googlecode.concurrent-trees:concurrent-trees</artifact> |
| 52 | <includes> | 84 | <includes> |
| 53 | <include>com/googlecode/**</include> | 85 | <include>com/googlecode/**</include> |
| 54 | </includes> | 86 | </includes> |
| 55 | - | ||
| 56 | </filter> | 87 | </filter> |
| 88 | + | ||
| 57 | <filter> | 89 | <filter> |
| 58 | <artifact>com.google.guava:guava</artifact> | 90 | <artifact>com.google.guava:guava</artifact> |
| 59 | <excludes> | 91 | <excludes> |
| 60 | <exclude>**</exclude> | 92 | <exclude>**</exclude> |
| 61 | </excludes> | 93 | </excludes> |
| 62 | </filter> | 94 | </filter> |
| 95 | + | ||
| 96 | + <filter> | ||
| 97 | + <artifact>net.kuujo.copycat:*</artifact> | ||
| 98 | + <includes> | ||
| 99 | + <include>net/kuujo/copycat/**</include> | ||
| 100 | + </includes> | ||
| 101 | + </filter> | ||
| 102 | +<!-- chronicle transitive dependency | ||
| 103 | + | ||
| 104 | + <filter> | ||
| 105 | + <artifact>net.java.dev.jna:*</artifact> | ||
| 106 | + <includes> | ||
| 107 | + <include>com/sun/jna/**</include> | ||
| 108 | + </includes> | ||
| 109 | + </filter> | ||
| 110 | +--> | ||
| 63 | </filters> | 111 | </filters> |
| 64 | </configuration> | 112 | </configuration> |
| 65 | <executions> | 113 | <executions> |
| ... | @@ -77,7 +125,7 @@ | ... | @@ -77,7 +125,7 @@ |
| 77 | <configuration> | 125 | <configuration> |
| 78 | <instructions> | 126 | <instructions> |
| 79 | <Export-Package> | 127 | <Export-Package> |
| 80 | - com.googlecode.concurrenttrees.* | 128 | + com.googlecode.concurrenttrees.*;net.kuujo.copycat.* |
| 81 | </Export-Package> | 129 | </Export-Package> |
| 82 | </instructions> | 130 | </instructions> |
| 83 | </configuration> | 131 | </configuration> | ... | ... |
-
Please register or login to post a comment