diff --git a/hbase-assembly/pom.xml b/hbase-assembly/pom.xml index 4aab1b19a0d..550a7c80f02 100644 --- a/hbase-assembly/pom.xml +++ b/hbase-assembly/pom.xml @@ -175,6 +175,11 @@ hbase-shell ${project.version} + + org.apache.hbase + hbase-external-blockcache + ${project.version} + org.apache.hbase hbase-testing-util diff --git a/hbase-assembly/src/main/assembly/hadoop-two-compat.xml b/hbase-assembly/src/main/assembly/hadoop-two-compat.xml index ba28251bb52..9ef624c028a 100644 --- a/hbase-assembly/src/main/assembly/hadoop-two-compat.xml +++ b/hbase-assembly/src/main/assembly/hadoop-two-compat.xml @@ -46,6 +46,7 @@ org.apache.hbase:hbase-server org.apache.hbase:hbase-shell org.apache.hbase:hbase-thrift + org.apache.hbase:hbase-external-blockcache diff --git a/hbase-external-blockcache/pom.xml b/hbase-external-blockcache/pom.xml new file mode 100644 index 00000000000..b2ee4dcb009 --- /dev/null +++ b/hbase-external-blockcache/pom.xml @@ -0,0 +1,382 @@ + + + + 4.0.0 + + hbase + org.apache.hbase + 1.3.0-SNAPSHOT + .. + + hbase-external-blockcache + Apache HBase - External Block Cache + + HBase module that provides out of process block cache. + Currently Memcached is the reference implementation for external block cache. + + External block caches allow HBase to take advantage of other more complex caches that can live + longer than the HBase regionserver process and are not necessarily tied to a single computer + life time. However external block caches add in extra operational overhead. + + + + + + src/main/resources/ + + hbase-default.xml + + + + + + src/test/resources/META-INF/ + META-INF/ + + NOTICE + + true + + + + + org.apache.maven.plugins + maven-site-plugin + + true + + + + + maven-assembly-plugin + + true + + + + org.codehaus.mojo + build-helper-maven-plugin + + + + versionInfo-source + generate-sources + + add-source + + + + ${project.build.directory}/generated-sources/java + + + + + + + maven-surefire-plugin + + + + listener + org.apache.hadoop.hbase.ResourceCheckerJUnitListener + + + + + + + secondPartTestsExecution + test + + test + + + true + + + + + + + org.apache.maven.plugins + maven-source-plugin + + true + + src/main/java + ${project.build.outputDirectory}/META-INF + + + + + + + + + org.eclipse.m2e + lifecycle-mapping + 1.0.0 + + + + + + org.apache.maven.plugins + maven-antrun-plugin + [${maven.antrun.version}] + + run + + + + + + + + + org.apache.maven.plugins + maven-dependency-plugin + [2.8,) + + build-classpath + + + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + [3.2,) + + compile + + + + + + + + + + + + + + + + + org.apache.hbase + hbase-server + + + net.spy + spymemcached + true + + + + + + + apache-release + + + + org.apache.maven.plugins + maven-resources-plugin + + + license-javadocs + prepare-package + + copy-resources + + + ${project.build.directory}/apidocs + + + src/main/javadoc/META-INF/ + META-INF/ + + NOTICE + + true + + + + + + + + + + + + skipCommonTests + + + skipCommonTests + + + + true + + + + + + hadoop-1.1 + + + + hadoop.profile1.1 + + + + + org.apache.hadoop + hadoop-core + + + + + + + hadoop-1.0 + + + hadoop.profile + 1.0 + + + + + org.apache.hadoop + hadoop-core + + + commons-io + commons-io + + + + + + + hadoop-2.0 + + + + !hadoop.profile + + + + + org.apache.hadoop + hadoop-common + + + + + + maven-dependency-plugin + + + create-mrapp-generated-classpath + generate-test-resources + + build-classpath + + + + ${project.build.directory}/test-classes/mrapp-generated-classpath + + + + + + + + + + + hadoop-3.0 + + + hadoop.profile + 3.0 + + + + 3.0-SNAPSHOT + + + + org.apache.hadoop + hadoop-common + + + + + + maven-dependency-plugin + + + create-mrapp-generated-classpath + generate-test-resources + + build-classpath + + + + ${project.build.directory}/test-classes/mrapp-generated-classpath + + + + + + + + + diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/MemcachedBlockCache.java b/hbase-external-blockcache/src/main/java/org/apache/hadoop/hbase/io/hfile/MemcachedBlockCache.java similarity index 100% rename from hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/MemcachedBlockCache.java rename to hbase-external-blockcache/src/main/java/org/apache/hadoop/hbase/io/hfile/MemcachedBlockCache.java diff --git a/hbase-server/pom.xml b/hbase-server/pom.xml index c3d160b5a63..b3c906361dd 100644 --- a/hbase-server/pom.xml +++ b/hbase-server/pom.xml @@ -531,11 +531,7 @@ io.netty netty-all - - net.spy - spymemcached - true - + org.apache.htrace diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/CacheConfig.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/CacheConfig.java index ee2d001f2bb..2b76b880214 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/CacheConfig.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/CacheConfig.java @@ -139,9 +139,16 @@ public class CacheConfig { * This is used for config. */ private static enum ExternalBlockCaches { - memcached(MemcachedBlockCache.class); + memcached("org.apache.hadoop.hbase.io.hfile.MemcachedBlockCache"); // TODO(eclark): Consider more. Redis, etc. Class clazz; + ExternalBlockCaches(String clazzName) { + try { + clazz = (Class) Class.forName(clazzName); + } catch (ClassNotFoundException cnef) { + clazz = null; + } + } ExternalBlockCaches(Class clazz) { this.clazz = clazz; } @@ -572,7 +579,12 @@ public class CacheConfig { try { klass = ExternalBlockCaches.valueOf(c.get(EXTERNAL_BLOCKCACHE_CLASS_KEY, "memcache")).clazz; } catch (IllegalArgumentException exception) { - klass = c.getClass(EXTERNAL_BLOCKCACHE_CLASS_KEY, MemcachedBlockCache.class); + try { + klass = c.getClass(EXTERNAL_BLOCKCACHE_CLASS_KEY, Class.forName( + "org.apache.hadoop.hbase.io.hfile.MemcachedBlockCache")); + } catch (ClassNotFoundException e) { + return null; + } } // Now try and create an instance of the block cache. diff --git a/pom.xml b/pom.xml index 6e64cd7c97f..aef5dc245b8 100644 --- a/pom.xml +++ b/pom.xml @@ -67,6 +67,7 @@ hbase-testing-util hbase-annotations hbase-checkstyle + hbase-external-blockcache hbase-shaded