Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HADOOP-16488 Deprecated JsonSerialization and move it out of hadoop-c… #1222

Open
wants to merge 1 commit into
base: trunk
Choose a base branch
from

Conversation

Apache9
Copy link
Contributor

@Apache9 Apache9 commented Aug 4, 2019

…ommon

@Apache9
Copy link
Contributor Author

Apache9 commented Aug 4, 2019

Ping @steveloughran @jojochuang . This is the first try. Not finished yet. The approach is to introduce a GsonSerialization, and use it to replace the JsonSerialization. And now the difficulty is that, we use the jackson annotation in many places, so I still need sometime to find out how to deal with these annotations. And for hadoop-aws, maybe we can just move copy some code for JsonSerialization there, as the java sdk for aws depends on jackson so it is useless to purge the jackson dependency for it.

@@ -57,9 +57,13 @@
* {@code org.apache.hadoop.registry.client.binding.JsonSerDeser},
* which is now a subclass of this class.
* @param <T> Type to marshal.
* @deprecated Avoid using this class any more, as jackson has

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

whitespace:end of line


import static org.apache.commons.lang3.StringUtils.isBlank;
import static org.apache.commons.lang3.StringUtils.isNotBlank;

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

your IDE is moving imports around which is shouldn't; this always makes backporting of patches to a key class harder. Can you leave out all changes to the imports except for those classes added/removed

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there an import order rule? I checked several files but can not find the pattern, static import can be anywhere, and no alphabetical order...

dumpGenerator.writeStartArray();
dumpGenerator.flush();
JsonWriter jsonWriter = new JsonWriter(out);
jsonWriter.beginObject().name("properties").beginArray().flush();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we have tests for this writing of configs? If not, they're needed first

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have, but as you said below, if we purge jackson completely, there is no way to ensure that the json format is not changed, as in tests we also use gson...

@steveloughran
Copy link
Contributor

  1. your IDE has gone overboard with reorganising the imports, which makes reviewing too hard. can you revert those changes so there's something more minimal.
  2. If we can move all internal code off json serialization then there's no need to retain that class at all. it's private and not AFAIK used externally (it only got moved from hadoop-registry to hadoop-common with Hadoop 3.1, after all.

. And for hadoop-aws, maybe we can just move copy some code for JsonSerialization there, as the java sdk for aws depends on jackson so it is useless to purge the jackson dependency for it.

AWS SDK is shaded; their problem. We need to get hadoop-aws off it, which is doable.

Hadoop-registry is the origin of this code; need to review that to make sure the records persistet can be marshalled without problems

For all the changes, I think we should add tests verifying consistent loading of existing classes first. That is: we save the current .json files as test resources and verify that they can be loaded with the new code. That's a good practise anyway, isn't it?

@Apache9
Copy link
Contributor Author

Apache9 commented Aug 5, 2019

For all the changes, I think we should add tests verifying consistent loading of existing classes first. That is: we save the current .json files as test resources and verify that they can be loaded with the new code. That's a good practise anyway, isn't it?

This seems to be a good idea. Will have a try after I finish purging the jackson stuff.

Thanks.

@@ -57,9 +57,13 @@
* {@code org.apache.hadoop.registry.client.binding.JsonSerDeser},
* which is now a subclass of this class.
* @param <T> Type to marshal.
* @deprecated Avoid using this class any more, as jackson has

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

whitespace:end of line

@@ -57,9 +57,13 @@
* {@code org.apache.hadoop.registry.client.binding.JsonSerDeser},
* which is now a subclass of this class.
* @param <T> Type to marshal.
* @deprecated Avoid using this class any more, as jackson has

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

whitespace:end of line

@@ -57,9 +57,13 @@
* {@code org.apache.hadoop.registry.client.binding.JsonSerDeser},
* which is now a subclass of this class.
* @param <T> Type to marshal.
* @deprecated Avoid using this class any more, as jackson has

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

whitespace:end of line

@@ -57,9 +57,13 @@
* {@code org.apache.hadoop.registry.client.binding.JsonSerDeser},
* which is now a subclass of this class.
* @param <T> Type to marshal.
* @deprecated Avoid using this class any more, as jackson has

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

whitespace:end of line

@@ -57,9 +57,13 @@
* {@code org.apache.hadoop.registry.client.binding.JsonSerDeser},
* which is now a subclass of this class.
* @param <T> Type to marshal.
* @deprecated Avoid using this class any more, as jackson has

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

whitespace:end of line

@@ -57,9 +57,13 @@
* {@code org.apache.hadoop.registry.client.binding.JsonSerDeser},
* which is now a subclass of this class.
* @param <T> Type to marshal.
* @deprecated Avoid using this class any more, as jackson has

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

whitespace:end of line

@hadoop-yetus
Copy link

💔 -1 overall

Vote Subsystem Runtime Comment
0 reexec 45 Docker mode activated.
_ Prechecks _
+1 dupname 1 No case conflicting files found.
+1 @author 0 The patch does not contain any @author tags.
+1 test4tests 0 The patch appears to include 2 new or modified test files.
_ trunk Compile Tests _
0 mvndep 24 Maven dependency ordering for branch
+1 mvninstall 1070 trunk passed
+1 compile 1061 trunk passed
+1 checkstyle 148 trunk passed
+1 mvnsite 315 trunk passed
+1 shadedclient 1216 branch has no errors when building and testing our client artifacts.
+1 javadoc 255 trunk passed
0 spotbugs 50 Used deprecated FindBugs config; considering switching to SpotBugs.
0 findbugs 24 branch/hadoop-project no findbugs output file (findbugsXml.xml)
_ Patch Compile Tests _
0 mvndep 24 Maven dependency ordering for patch
+1 mvninstall 225 the patch passed
+1 compile 1030 the patch passed
-1 javac 1030 root generated 13 new + 1475 unchanged - 0 fixed = 1488 total (was 1475)
-0 checkstyle 138 root: The patch generated 5 new + 358 unchanged - 3 fixed = 363 total (was 361)
+1 mvnsite 318 the patch passed
-1 whitespace 0 The patch has 1 line(s) that end in whitespace. Use git apply --whitespace=fix <<patch_file>>. Refer https://git-scm.com/docs/git-apply
+1 xml 3 The patch has no ill-formed XML file.
+1 shadedclient 654 patch has no errors when building and testing our client artifacts.
+1 javadoc 244 the patch passed
0 findbugs 25 hadoop-project has no data from findbugs
_ Other Tests _
+1 unit 19 hadoop-project in the patch passed.
-1 unit 489 hadoop-common in the patch failed.
-1 unit 120 hadoop-kms in the patch failed.
+1 unit 56 hadoop-registry in the patch passed.
+1 unit 118 hadoop-hdfs-client in the patch passed.
+1 unit 333 hadoop-mapreduce-client-core in the patch passed.
+1 unit 81 hadoop-aws in the patch passed.
+1 unit 89 hadoop-azure in the patch passed.
+1 asflicense 46 The patch does not generate ASF License warnings.
9029
Reason Tests
Failed junit tests hadoop.security.token.delegation.web.TestWebDelegationToken
hadoop.crypto.key.kms.server.TestKMS
Subsystem Report/Notes
Docker Client=19.03.1 Server=19.03.1 base: https://builds.apache.org/job/hadoop-multibranch/job/PR-1222/7/artifact/out/Dockerfile
GITHUB PR #1222
Optional Tests dupname asflicense compile javac javadoc mvninstall mvnsite unit shadedclient xml findbugs checkstyle
uname Linux ac3154978eef 4.4.0-138-generic #164-Ubuntu SMP Tue Oct 2 17:16:02 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
Build tool maven
Personality personality/hadoop.sh
git revision trunk / 69ddb36
Default Java 1.8.0_222
javac https://builds.apache.org/job/hadoop-multibranch/job/PR-1222/7/artifact/out/diff-compile-javac-root.txt
checkstyle https://builds.apache.org/job/hadoop-multibranch/job/PR-1222/7/artifact/out/diff-checkstyle-root.txt
whitespace https://builds.apache.org/job/hadoop-multibranch/job/PR-1222/7/artifact/out/whitespace-eol.txt
unit https://builds.apache.org/job/hadoop-multibranch/job/PR-1222/7/artifact/out/patch-unit-hadoop-common-project_hadoop-common.txt
unit https://builds.apache.org/job/hadoop-multibranch/job/PR-1222/7/artifact/out/patch-unit-hadoop-common-project_hadoop-kms.txt
Test Results https://builds.apache.org/job/hadoop-multibranch/job/PR-1222/7/testReport/
Max. process+thread count 1610 (vs. ulimit of 5500)
modules C: hadoop-project hadoop-common-project/hadoop-common hadoop-common-project/hadoop-kms hadoop-common-project/hadoop-registry hadoop-hdfs-project/hadoop-hdfs-client hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core hadoop-tools/hadoop-aws hadoop-tools/hadoop-azure U: .
Console output https://builds.apache.org/job/hadoop-multibranch/job/PR-1222/7/console
versions git=2.7.4 maven=3.3.9 findbugs=3.1.0-RC1
Powered by Apache Yetus 0.10.0 http://yetus.apache.org

This message was automatically generated.

@apache apache deleted a comment from hadoop-yetus Aug 26, 2019
@apache apache deleted a comment from hadoop-yetus Aug 26, 2019
@apache apache deleted a comment from hadoop-yetus Aug 26, 2019
@apache apache deleted a comment from hadoop-yetus Aug 26, 2019
@apache apache deleted a comment from hadoop-yetus Aug 26, 2019
@apache apache deleted a comment from hadoop-yetus Aug 26, 2019
@@ -18,14 +18,18 @@

package org.apache.hadoop.conf;

import static org.apache.commons.lang3.StringUtils.isBlank;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these should go at the bottom; imports should be as unchanged as possible


import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.regex.PatternSyntaxException;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and similarly, dont reorder stuff even when its wrong...it makes backporting too hard

@@ -57,9 +57,13 @@
* {@code org.apache.hadoop.registry.client.binding.JsonSerDeser},
* which is now a subclass of this class.
* @param <T> Type to marshal.
* @deprecated Avoid using this class any more, as jackson has

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

whitespace:end of line

@hadoop-yetus
Copy link

💔 -1 overall

Vote Subsystem Runtime Comment
0 reexec 42 Docker mode activated.
_ Prechecks _
+1 dupname 1 No case conflicting files found.
+1 @author 0 The patch does not contain any @author tags.
+1 test4tests 0 The patch appears to include 2 new or modified test files.
_ trunk Compile Tests _
0 mvndep 28 Maven dependency ordering for branch
+1 mvninstall 1085 trunk passed
+1 compile 1077 trunk passed
+1 checkstyle 152 trunk passed
+1 mvnsite 394 trunk passed
+1 shadedclient 1292 branch has no errors when building and testing our client artifacts.
+1 javadoc 297 trunk passed
0 spotbugs 65 Used deprecated FindBugs config; considering switching to SpotBugs.
0 findbugs 26 branch/hadoop-project no findbugs output file (findbugsXml.xml)
_ Patch Compile Tests _
0 mvndep 24 Maven dependency ordering for patch
+1 mvninstall 258 the patch passed
+1 compile 1013 the patch passed
-1 javac 1013 root generated 13 new + 1475 unchanged - 0 fixed = 1488 total (was 1475)
-0 checkstyle 163 root: The patch generated 5 new + 359 unchanged - 3 fixed = 364 total (was 362)
+1 mvnsite 385 the patch passed
-1 whitespace 0 The patch has 1 line(s) that end in whitespace. Use git apply --whitespace=fix <<patch_file>>. Refer https://git-scm.com/docs/git-apply
+1 xml 4 The patch has no ill-formed XML file.
+1 shadedclient 693 patch has no errors when building and testing our client artifacts.
+1 javadoc 316 the patch passed
0 findbugs 30 hadoop-project has no data from findbugs
_ Other Tests _
+1 unit 30 hadoop-project in the patch passed.
-1 unit 541 hadoop-common in the patch failed.
-1 unit 125 hadoop-kms in the patch failed.
+1 unit 61 hadoop-registry in the patch passed.
+1 unit 129 hadoop-hdfs-client in the patch passed.
+1 unit 338 hadoop-mapreduce-client-core in the patch passed.
+1 unit 97 hadoop-aws in the patch passed.
+1 unit 87 hadoop-azure in the patch passed.
+1 asflicense 50 The patch does not generate ASF License warnings.
9693
Reason Tests
Failed junit tests hadoop.security.token.delegation.web.TestWebDelegationToken
hadoop.crypto.key.kms.server.TestKMS
Subsystem Report/Notes
Docker Client=19.03.1 Server=19.03.1 base: https://builds.apache.org/job/hadoop-multibranch/job/PR-1222/8/artifact/out/Dockerfile
GITHUB PR #1222
Optional Tests dupname asflicense compile javac javadoc mvninstall mvnsite unit shadedclient xml findbugs checkstyle
uname Linux 1b03f0abcfe3 4.15.0-58-generic #64-Ubuntu SMP Tue Aug 6 11:12:41 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
Build tool maven
Personality personality/hadoop.sh
git revision trunk / 3329257
Default Java 1.8.0_222
javac https://builds.apache.org/job/hadoop-multibranch/job/PR-1222/8/artifact/out/diff-compile-javac-root.txt
checkstyle https://builds.apache.org/job/hadoop-multibranch/job/PR-1222/8/artifact/out/diff-checkstyle-root.txt
whitespace https://builds.apache.org/job/hadoop-multibranch/job/PR-1222/8/artifact/out/whitespace-eol.txt
unit https://builds.apache.org/job/hadoop-multibranch/job/PR-1222/8/artifact/out/patch-unit-hadoop-common-project_hadoop-common.txt
unit https://builds.apache.org/job/hadoop-multibranch/job/PR-1222/8/artifact/out/patch-unit-hadoop-common-project_hadoop-kms.txt
Test Results https://builds.apache.org/job/hadoop-multibranch/job/PR-1222/8/testReport/
Max. process+thread count 1664 (vs. ulimit of 5500)
modules C: hadoop-project hadoop-common-project/hadoop-common hadoop-common-project/hadoop-kms hadoop-common-project/hadoop-registry hadoop-hdfs-project/hadoop-hdfs-client hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core hadoop-tools/hadoop-aws hadoop-tools/hadoop-azure U: .
Console output https://builds.apache.org/job/hadoop-multibranch/job/PR-1222/8/console
versions git=2.7.4 maven=3.3.9 findbugs=3.1.0-RC1
Powered by Apache Yetus 0.10.0 http://yetus.apache.org

This message was automatically generated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants