From 6ee5a73e0e91a2ef27753a32c576835e951d8119 Mon Sep 17 00:00:00 2001 From: Thomas White Date: Fri, 19 Aug 2011 17:26:42 +0000 Subject: [PATCH] HADOOP-7264. Bump avro version to at least 1.4.1. Contributed by Alejandro Abdelnur git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1159699 13f79535-47bb-0310-9956-ffa450edef68 --- hadoop-common/CHANGES.txt | 3 ++ hadoop-common/pom.xml | 42 ++++++++++--------- .../io/serializer/avro/AvroSerialization.java | 5 ++- .../org/apache/hadoop/ipc/AvroRpcEngine.java | 6 +-- .../hadoop/ipc/AvroSpecificRpcEngine.java | 4 +- .../AvroSpecificTestProtocol.avpr | 0 .../io/serializer => }/avro/avroRecord.avsc | 0 .../org/apache/hadoop/io/AvroTestUtil.java | 11 ++--- .../apache/hadoop/ipc/AvroTestProtocol.java | 2 +- .../org/apache/hadoop/ipc/TestAvroRpc.java | 6 +-- hadoop-project/pom.xml | 22 ++++++---- 11 files changed, 57 insertions(+), 44 deletions(-) rename hadoop-common/src/test/{java/org/apache/hadoop/ipc => avro}/AvroSpecificTestProtocol.avpr (100%) rename hadoop-common/src/test/{java/org/apache/hadoop/io/serializer => }/avro/avroRecord.avsc (100%) diff --git a/hadoop-common/CHANGES.txt b/hadoop-common/CHANGES.txt index 33b81f1b60..147d4d6f8b 100644 --- a/hadoop-common/CHANGES.txt +++ b/hadoop-common/CHANGES.txt @@ -328,6 +328,9 @@ Trunk (unreleased changes) HADOOP-7555. Add a eclipse-generated files to .gitignore. (atm) + HADOOP-7264. Bump avro version to at least 1.4.1. (Alejandro Abdelnur via + tomwhite) + OPTIMIZATIONS HADOOP-7333. Performance improvement in PureJavaCrc32. (Eric Caspole diff --git a/hadoop-common/pom.xml b/hadoop-common/pom.xml index eb10c0d50c..f432e4a9a5 100644 --- a/hadoop-common/pom.xml +++ b/hadoop-common/pom.xml @@ -219,10 +219,15 @@ test - org.apache.hadoop + org.apache.avro avro compile + + org.apache.avro + avro-ipc + compile + net.sf.kosmosfs kfs @@ -322,6 +327,23 @@ ${basedir}/dev-support/findbugsExcludeFile.xml + + org.apache.avro + avro-maven-plugin + + + generate-avro-test-sources + generate-test-sources + + schema + protocol + + + + + ${project.build.directory}/generated-test-sources/java + + org.apache.maven.plugins maven-antrun-plugin @@ -359,24 +381,6 @@ - - - - - - - - - - - - - - - - - - diff --git a/hadoop-common/src/main/java/org/apache/hadoop/io/serializer/avro/AvroSerialization.java b/hadoop-common/src/main/java/org/apache/hadoop/io/serializer/avro/AvroSerialization.java index 27bb255696..1d5c068886 100644 --- a/hadoop-common/src/main/java/org/apache/hadoop/io/serializer/avro/AvroSerialization.java +++ b/hadoop-common/src/main/java/org/apache/hadoop/io/serializer/avro/AvroSerialization.java @@ -28,6 +28,7 @@ import org.apache.avro.io.DatumReader; import org.apache.avro.io.DatumWriter; import org.apache.avro.io.DecoderFactory; +import org.apache.avro.io.EncoderFactory; import org.apache.hadoop.classification.InterfaceAudience; import org.apache.hadoop.classification.InterfaceStability; import org.apache.hadoop.conf.Configured; @@ -93,7 +94,7 @@ public void close() throws IOException { @Override public void open(OutputStream out) throws IOException { outStream = out; - encoder = new BinaryEncoder(out); + encoder = EncoderFactory.get().binaryEncoder(out, encoder); } @Override @@ -127,7 +128,7 @@ public T deserialize(T t) throws IOException { @Override public void open(InputStream in) throws IOException { inStream = in; - decoder = DecoderFactory.defaultFactory().createBinaryDecoder(in, null); + decoder = DecoderFactory.get().binaryDecoder(in, decoder); } } diff --git a/hadoop-common/src/main/java/org/apache/hadoop/ipc/AvroRpcEngine.java b/hadoop-common/src/main/java/org/apache/hadoop/ipc/AvroRpcEngine.java index 180e7811b1..5ab379c1da 100644 --- a/hadoop-common/src/main/java/org/apache/hadoop/ipc/AvroRpcEngine.java +++ b/hadoop-common/src/main/java/org/apache/hadoop/ipc/AvroRpcEngine.java @@ -34,9 +34,9 @@ import org.apache.avro.ipc.Responder; import org.apache.avro.ipc.Transceiver; -import org.apache.avro.reflect.ReflectRequestor; -import org.apache.avro.reflect.ReflectResponder; -import org.apache.avro.specific.SpecificRequestor; +import org.apache.avro.ipc.reflect.ReflectRequestor; +import org.apache.avro.ipc.reflect.ReflectResponder; +import org.apache.avro.ipc.specific.SpecificRequestor; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.hadoop.classification.InterfaceStability; diff --git a/hadoop-common/src/main/java/org/apache/hadoop/ipc/AvroSpecificRpcEngine.java b/hadoop-common/src/main/java/org/apache/hadoop/ipc/AvroSpecificRpcEngine.java index c5d1fe16e6..995a13a9c7 100644 --- a/hadoop-common/src/main/java/org/apache/hadoop/ipc/AvroSpecificRpcEngine.java +++ b/hadoop-common/src/main/java/org/apache/hadoop/ipc/AvroSpecificRpcEngine.java @@ -22,8 +22,8 @@ import org.apache.avro.ipc.Responder; import org.apache.avro.ipc.Transceiver; -import org.apache.avro.specific.SpecificRequestor; -import org.apache.avro.specific.SpecificResponder; +import org.apache.avro.ipc.specific.SpecificRequestor; +import org.apache.avro.ipc.specific.SpecificResponder; import org.apache.hadoop.classification.InterfaceStability; /** diff --git a/hadoop-common/src/test/java/org/apache/hadoop/ipc/AvroSpecificTestProtocol.avpr b/hadoop-common/src/test/avro/AvroSpecificTestProtocol.avpr similarity index 100% rename from hadoop-common/src/test/java/org/apache/hadoop/ipc/AvroSpecificTestProtocol.avpr rename to hadoop-common/src/test/avro/AvroSpecificTestProtocol.avpr diff --git a/hadoop-common/src/test/java/org/apache/hadoop/io/serializer/avro/avroRecord.avsc b/hadoop-common/src/test/avro/avroRecord.avsc similarity index 100% rename from hadoop-common/src/test/java/org/apache/hadoop/io/serializer/avro/avroRecord.avsc rename to hadoop-common/src/test/avro/avroRecord.avsc diff --git a/hadoop-common/src/test/java/org/apache/hadoop/io/AvroTestUtil.java b/hadoop-common/src/test/java/org/apache/hadoop/io/AvroTestUtil.java index 8fad425052..e3e885ad12 100644 --- a/hadoop-common/src/test/java/org/apache/hadoop/io/AvroTestUtil.java +++ b/hadoop-common/src/test/java/org/apache/hadoop/io/AvroTestUtil.java @@ -18,15 +18,16 @@ package org.apache.hadoop.io; -import java.io.IOException; +import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.lang.reflect.Type; import org.apache.avro.Schema; +import org.apache.avro.io.BinaryEncoder; +import org.apache.avro.io.EncoderFactory; import org.apache.avro.reflect.ReflectData; import org.apache.avro.reflect.ReflectDatumWriter; import org.apache.avro.reflect.ReflectDatumReader; -import org.apache.avro.io.BinaryEncoder; import org.apache.avro.io.DecoderFactory; import static junit.framework.TestCase.assertEquals; @@ -47,11 +48,11 @@ public static void testReflect(Object value, Type type, String schema) // check that value is serialized correctly ReflectDatumWriter writer = new ReflectDatumWriter(s); ByteArrayOutputStream out = new ByteArrayOutputStream(); - writer.write(value, new BinaryEncoder(out)); + writer.write(value, EncoderFactory.get().directBinaryEncoder(out, null)); ReflectDatumReader reader = new ReflectDatumReader(s); Object after = - reader.read(null, DecoderFactory.defaultFactory().createBinaryDecoder( - out.toByteArray(), null)); + reader.read(null, + DecoderFactory.get().binaryDecoder(out.toByteArray(), null)); assertEquals(value, after); } diff --git a/hadoop-common/src/test/java/org/apache/hadoop/ipc/AvroTestProtocol.java b/hadoop-common/src/test/java/org/apache/hadoop/ipc/AvroTestProtocol.java index 5e0a30f3dc..d5d73962e3 100644 --- a/hadoop-common/src/test/java/org/apache/hadoop/ipc/AvroTestProtocol.java +++ b/hadoop-common/src/test/java/org/apache/hadoop/ipc/AvroTestProtocol.java @@ -18,7 +18,7 @@ package org.apache.hadoop.ipc; -import org.apache.avro.ipc.AvroRemoteException; +import org.apache.avro.AvroRemoteException; @SuppressWarnings("serial") public interface AvroTestProtocol { diff --git a/hadoop-common/src/test/java/org/apache/hadoop/ipc/TestAvroRpc.java b/hadoop-common/src/test/java/org/apache/hadoop/ipc/TestAvroRpc.java index d8ffdc91ef..7f7c510ab4 100644 --- a/hadoop-common/src/test/java/org/apache/hadoop/ipc/TestAvroRpc.java +++ b/hadoop-common/src/test/java/org/apache/hadoop/ipc/TestAvroRpc.java @@ -28,7 +28,7 @@ import junit.framework.Assert; import junit.framework.TestCase; -import org.apache.avro.ipc.AvroRemoteException; +import org.apache.avro.AvroRemoteException; import org.apache.avro.util.Utf8; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -189,7 +189,7 @@ private void testSpecific(boolean secure) throws Exception { (AvroSpecificTestProtocol)RPC.getProxy(AvroSpecificTestProtocol.class, 0, addr, conf); - Utf8 echo = proxy.echo(new Utf8("hello world")); + CharSequence echo = proxy.echo("hello world"); assertEquals("hello world", echo.toString()); int intResult = proxy.add(1, 2); @@ -210,7 +210,7 @@ public int add(int arg1, int arg2) throws AvroRemoteException { } @Override - public Utf8 echo(Utf8 msg) throws AvroRemoteException { + public CharSequence echo(CharSequence msg) throws AvroRemoteException { return msg; } diff --git a/hadoop-project/pom.xml b/hadoop-project/pom.xml index 3cc455a848..77415fc930 100644 --- a/hadoop-project/pom.xml +++ b/hadoop-project/pom.xml @@ -312,7 +312,7 @@ org.codehaus.jackson jackson-mapper-asl - 1.5.2 + 1.6.9 org.aspectj @@ -325,15 +325,14 @@ 1.8.5 - org.apache.hadoop + org.apache.avro avro - 1.3.2 - - - org.apache.ant - ant - - + 1.5.2 + + + org.apache.avro + avro-ipc + 1.5.2 net.sf.kosmosfs @@ -446,6 +445,11 @@ maven-deploy-plugin 2.5 + + org.apache.avro + avro-maven-plugin + 1.5.2 +