Skip to content

Commit

Permalink
GEODE-6503: Moving redis into a separate module
Browse files Browse the repository at this point in the history
* Moving all of the geode redis apapter code to the geode-redis module
* Moving the redis specific dependencies (netty and geo) to geode-redis
* Adding a GeodeRedisService to initialize the redis server

The geode distribution will still include redis, and gfsh start server
will still include redis on it's classpath. However, consumers of
the geode-core maven module will no longer get the redis module and its
dependencies unless they explicitly also depend on geode-redis.

This closes apache#3284
  • Loading branch information
upthewaterspout committed Mar 14, 2019
1 parent 45e945e commit b32631e
Show file tree
Hide file tree
Showing 200 changed files with 214 additions and 271 deletions.
5 changes: 5 additions & 0 deletions boms/geode-all-bom/src/test/resources/expected-pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -707,6 +707,11 @@
<artifactId>geode-rebalancer</artifactId>
<version>1.10.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.apache.geode</groupId>
<artifactId>geode-redis</artifactId>
<version>1.10.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.apache.geode</groupId>
<artifactId>geode-wan</artifactId>
Expand Down
3 changes: 3 additions & 0 deletions geode-assembly/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ dependencies {
archives project(':geode-core')
archives project(':geode-connectors')
archives project(':geode-lucene')
archives project(':geode-redis')
archives project(':geode-old-client-support')
archives project(':geode-protobuf')
archives project(':geode-protobuf-messages')
Expand Down Expand Up @@ -484,6 +485,8 @@ distributions {
from project(':geode-core').configurations.archives.allArtifacts.files
from project(':geode-lucene').configurations.runtimeClasspath
from project(':geode-lucene').configurations.archives.allArtifacts.files
from project(':geode-redis').configurations.runtimeClasspath
from project(':geode-redis').configurations.runtimeClasspath.allArtifacts.files
from project(':geode-connectors').configurations.runtimeClasspath
from project(':geode-connectors').configurations.archives.allArtifacts.files
from project(':geode-old-client-support').configurations.runtimeClasspath
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -906,6 +906,7 @@ lib/geode-dependencies.jar
lib/geode-jca-0.0.0.rar
lib/geode-json-0.0.0.jar
lib/geode-lucene-0.0.0.jar
lib/geode-redis-0.0.0.jar
lib/geode-management-0.0.0.jar
lib/geode-old-client-support-0.0.0.jar
lib/geode-protobuf-0.0.0.jar
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ geode-core-0.0.0.jar
geode-cq-0.0.0.jar
geode-json-0.0.0.jar
geode-lucene-0.0.0.jar
geode-redis-0.0.0.jar
geode-management-0.0.0.jar
geode-old-client-support-0.0.0.jar
geode-protobuf-0.0.0.jar
Expand Down
8 changes: 1 addition & 7 deletions geode-core/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -195,10 +195,7 @@ dependencies {
ext.optional = true
}
compile('io.micrometer:micrometer-core')

compile('io.netty:netty-all') {
ext.optional = true
}

compile('it.unimi.dsi:fastutil')
compile('javax.mail:javax.mail-api') {
ext.optional = true
Expand All @@ -219,7 +216,6 @@ dependencies {

compile('org.apache.logging.log4j:log4j-api')
compile('org.apache.logging.log4j:log4j-core')
compile('com.github.davidmoten:geo')

runtimeOnly('org.fusesource.jansi:jansi') {
ext.optional = true
Expand Down Expand Up @@ -311,7 +307,6 @@ dependencies {
exclude module: 'geode-core'
}
integrationTestCompile(project(':geode-concurrency-test'))
integrationTestCompile('redis.clients:jedis')
integrationTestCompile('org.apache.bcel:bcel')
integrationTestCompile('org.apache.logging.log4j:log4j-core::tests')
integrationTestCompile('org.apache.logging.log4j:log4j-core::test-sources')
Expand All @@ -332,7 +327,6 @@ dependencies {
distributedTestCompile(project(':geode-dunit')) {
exclude module: 'geode-core'
}
distributedTestCompile('redis.clients:jedis')
distributedTestCompile('pl.pragmatists:JUnitParams')
distributedTestCompile('com.jayway.jsonpath:json-path-assert')

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,6 @@ org/apache/geode/internal/cache/xmlcache/DiskStoreAttributesCreation
org/apache/geode/internal/cache/xmlcache/RegionAttributesCreation
org/apache/geode/internal/datasource/FacetsJCAConnectionManagerImpl
org/apache/geode/internal/exception/InvalidExecutionContextException
org/apache/geode/internal/hll/HyperLogLog
org/apache/geode/internal/hll/HyperLogLog$Builder
org/apache/geode/internal/hll/HyperLogLog$HyperLogLogMergeException
org/apache/geode/internal/hll/HyperLogLog$SerializationHolder
org/apache/geode/internal/hll/HyperLogLogPlus
org/apache/geode/internal/hll/HyperLogLogPlus$Builder
org/apache/geode/internal/hll/HyperLogLogPlus$Format
org/apache/geode/internal/hll/HyperLogLogPlus$HyperLogLogPlusMergeException
org/apache/geode/internal/hll/HyperLogLogPlus$SerializationHolder
org/apache/geode/internal/logging/Banner$BannerHeader
org/apache/geode/internal/logging/LogLevelUpdateOccurs
org/apache/geode/internal/logging/LogLevelUpdateScope
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2118,11 +2118,3 @@ org/apache/geode/pdx/internal/PdxType,2
fromData,109
toData,124

org/apache/geode/redis/internal/ByteArrayWrapper,2
fromData,20
toData,9

org/apache/geode/redis/internal/DoubleWrapper,2
fromData,9
toData,9

Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@

package org.apache.geode.distributed;

import org.apache.geode.redis.GeodeRedisServer;

/**
* This interface defines all the configuration properties that can be used. <U>Since</U>: Geode 1.0
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,6 @@
import org.apache.geode.internal.process.ProcessLauncherContext;
import org.apache.geode.internal.security.SecurableCommunicationChannel;
import org.apache.geode.memcached.GemFireMemcachedServer;
import org.apache.geode.redis.GeodeRedisServer;

/**
* Provides an implementation of <code>DistributionConfig</code> that knows how to read the
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,11 @@ public interface CacheService {
* @return the MBean associated with this server
*/
CacheServiceMBeanBase getMBean();

/**
* Close this service. Called when the cache is shutting down.
*/
default void close() {
// do nothing
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,6 @@
import org.apache.geode.pdx.internal.PdxInstanceFactoryImpl;
import org.apache.geode.pdx.internal.PdxInstanceImpl;
import org.apache.geode.pdx.internal.TypeRegistry;
import org.apache.geode.redis.GeodeRedisServer;

// TODO: somebody Come up with more reasonable values for {@link #DEFAULT_LOCK_TIMEOUT}, etc.
/**
Expand Down Expand Up @@ -588,11 +587,6 @@ public class GemFireCacheImpl implements InternalCache, InternalClientCache, Has
*/
private GemFireMemcachedServer memcachedServer;

/**
* Redis server is started when {@link DistributionConfig#getRedisPort()} is set
*/
private GeodeRedisServer redisServer;

/**
* {@link ExtensionPoint} support.
*
Expand Down Expand Up @@ -1169,6 +1163,12 @@ public void initialize() {
listener.cacheCreated(this);
}

if (isClient()) {
initializeClientRegionShortcuts(this);
} else {
initializeRegionShortcuts(this);
}

// set ClassPathLoader and then deploy cluster config jars
ClassPathLoader.setLatestToDefault(this.system.getConfig().getDeployWorkingDir());

Expand Down Expand Up @@ -1227,8 +1227,6 @@ public void initialize() {

startMemcachedServer();

startRedisServer();

startRestAgentServer(this);

this.isInitialized = true;
Expand Down Expand Up @@ -1298,25 +1296,6 @@ private void startMemcachedServer() {
}
}

private void startRedisServer() {
int port = this.system.getConfig().getRedisPort();
if (port != 0) {
String bindAddress = this.system.getConfig().getRedisBindAddress();
assert bindAddress != null;
if (bindAddress.equals(DistributionConfig.DEFAULT_REDIS_BIND_ADDRESS)) {
getLogger().info(
String.format("Starting GeodeRedisServer on port %s",
new Object[] {port}));
} else {
getLogger().info(
String.format("Starting GeodeRedisServer on bind address %s on port %s",
new Object[] {bindAddress, port}));
}
this.redisServer = new GeodeRedisServer(bindAddress, port);
this.redisServer.start();
}
}

@Override
public URL getCacheXmlURL() {
if (this.getMyId().getVmKind() == ClusterDistributionManager.LOCATOR_DM_TYPE) {
Expand Down Expand Up @@ -1390,11 +1369,6 @@ private void initializeDeclarativeCache()
URL url = getCacheXmlURL();
String cacheXmlDescription = this.cacheConfig.getCacheXMLDescription();
if (url == null && cacheXmlDescription == null) {
if (isClient()) {
initializeClientRegionShortcuts(this);
} else {
initializeRegionShortcuts(this);
}
initializePdxRegistry();
readyDynamicRegionFactory();
return; // nothing needs to be done
Expand Down Expand Up @@ -2204,7 +2178,7 @@ public void close(String reason, Throwable systemFailureCause, boolean keepAlive

stopMemcachedServer();

stopRedisServer();
this.stopServices();

httpService.ifPresent(HttpService::stop);

Expand Down Expand Up @@ -2416,6 +2390,16 @@ public void close(String reason, Throwable systemFailureCause, boolean keepAlive

}

private void stopServices() {
for (CacheService service : this.services.values()) {
try {
service.close();
} catch (Throwable t) {
logger.warn("Error stopping service " + service, t);
}
}
}

private void closeOffHeapEvictor() {
OffHeapEvictor evictor = this.offHeapEvictor;
if (evictor != null) {
Expand Down Expand Up @@ -2471,11 +2455,6 @@ private void stopMemcachedServer() {
}
}

private void stopRedisServer() {
if (this.redisServer != null)
this.redisServer.shutdown();
}

private void prepareDiskStoresForClose() {
String pdxDSName = TypeRegistry.getPdxDiskStoreName(this);
DiskStoreImpl pdxDiskStore = null;
Expand Down
Loading

0 comments on commit b32631e

Please sign in to comment.