You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flink.apache.org by tr...@apache.org on 2018/10/19 13:47:01 UTC
[flink] branch master updated (657fa5c -> d2480af)
This is an automated email from the ASF dual-hosted git repository.
trohrmann pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/flink.git.
from 657fa5c [FLINK-10608][avro] Add exclusion for generated avro files
new 0e2c4a8 [FLINK-10412] toString field in AbstractID should be transient to avoid been serialized
new d2480af [FLINK-10412] Add test to ensure that improved AbstractID can be deserialized
The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
.../java/org/apache/flink/util/AbstractID.java | 2 +-
.../java/org/apache/flink/util/AbstractIDTest.java | 30 +++++++++++++++++++++
.../test/resources/abstractID-with-toString-field | Bin 0 -> 126 bytes
.../resources/abstractID-with-toString-field-set | Bin 0 -> 160 bytes
4 files changed, 31 insertions(+), 1 deletion(-)
create mode 100644 flink-core/src/test/resources/abstractID-with-toString-field
create mode 100644 flink-core/src/test/resources/abstractID-with-toString-field-set
[flink] 02/02: [FLINK-10412] Add test to ensure that improved
AbstractID can be deserialized
Posted by tr...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
trohrmann pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/flink.git
commit d2480af40f5145d865196a95ec58a415482d8cff
Author: Till Rohrmann <tr...@apache.org>
AuthorDate: Mon Oct 8 10:10:46 2018 +0200
[FLINK-10412] Add test to ensure that improved AbstractID can be deserialized
This closes #6755.
---
.../java/org/apache/flink/util/AbstractIDTest.java | 30 +++++++++++++++++++++
.../test/resources/abstractID-with-toString-field | Bin 0 -> 126 bytes
.../resources/abstractID-with-toString-field-set | Bin 0 -> 160 bytes
3 files changed, 30 insertions(+)
diff --git a/flink-core/src/test/java/org/apache/flink/util/AbstractIDTest.java b/flink-core/src/test/java/org/apache/flink/util/AbstractIDTest.java
index 93def48..e0c4422 100644
--- a/flink-core/src/test/java/org/apache/flink/util/AbstractIDTest.java
+++ b/flink-core/src/test/java/org/apache/flink/util/AbstractIDTest.java
@@ -22,7 +22,12 @@ import org.apache.flink.core.testutils.CommonTestUtils;
import org.junit.Test;
+import java.io.InputStream;
+
+import static org.hamcrest.Matchers.equalTo;
+import static org.hamcrest.Matchers.is;
import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertThat;
import static org.junit.Assert.assertTrue;
/**
@@ -101,6 +106,31 @@ public class AbstractIDTest extends TestLogger {
assertCompare(id8, id10, -1);
}
+ /**
+ * FLINK-10412 marks the {@link AbstractID#toString} field as transient. This tests ensures
+ * that {@link AbstractID} which have been serialized with the toString field can still
+ * be deserialized. For that purpose the files abstractID-with-toString-field and
+ * abstractID-with-toString-field-set have been created with the serialized data.
+ */
+ @Test
+ public void testOldAbstractIDDeserialization() throws Exception {
+ final long lowerPart = 42L;
+ final long upperPart = 1337L;
+ final AbstractID expectedAbstractId = new AbstractID(lowerPart, upperPart);
+
+ final String resourceName1 = "abstractID-with-toString-field";
+ try (final InputStream resourceAsStream = getClass().getClassLoader().getResourceAsStream(resourceName1)) {
+ final AbstractID deserializedAbstractId = InstantiationUtil.deserializeObject(resourceAsStream, getClass().getClassLoader());
+ assertThat(deserializedAbstractId, is(equalTo(expectedAbstractId)));
+ }
+
+ final String resourceName2 = "abstractID-with-toString-field-set";
+ try (final InputStream resourceAsStream = getClass().getClassLoader().getResourceAsStream(resourceName2)) {
+ final AbstractID deserializedAbstractId = InstantiationUtil.deserializeObject(resourceAsStream, getClass().getClassLoader());
+ assertThat(deserializedAbstractId, is(equalTo(expectedAbstractId)));
+ }
+ }
+
private static void assertCompare(AbstractID a, AbstractID b, int signum) {
int cmpAB = a.compareTo(b);
int cmpBA = b.compareTo(a);
diff --git a/flink-core/src/test/resources/abstractID-with-toString-field b/flink-core/src/test/resources/abstractID-with-toString-field
new file mode 100644
index 0000000..92564b4
Binary files /dev/null and b/flink-core/src/test/resources/abstractID-with-toString-field differ
diff --git a/flink-core/src/test/resources/abstractID-with-toString-field-set b/flink-core/src/test/resources/abstractID-with-toString-field-set
new file mode 100644
index 0000000..bdf9b81
Binary files /dev/null and b/flink-core/src/test/resources/abstractID-with-toString-field-set differ
[flink] 01/02: [FLINK-10412] toString field in AbstractID should be
transient to avoid been serialized
Posted by tr...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
trohrmann pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/flink.git
commit 0e2c4a81a8209cf357eee0183f7546e0e24b11d0
Author: yanghua <ya...@gmail.com>
AuthorDate: Tue Sep 25 12:51:51 2018 +0800
[FLINK-10412] toString field in AbstractID should be transient to avoid been serialized
---
flink-core/src/main/java/org/apache/flink/util/AbstractID.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/flink-core/src/main/java/org/apache/flink/util/AbstractID.java b/flink-core/src/main/java/org/apache/flink/util/AbstractID.java
index 41083c6..b7be21a 100644
--- a/flink-core/src/main/java/org/apache/flink/util/AbstractID.java
+++ b/flink-core/src/main/java/org/apache/flink/util/AbstractID.java
@@ -47,7 +47,7 @@ public class AbstractID implements Comparable<AbstractID>, java.io.Serializable
protected final long lowerPart;
/** The memoized value returned by toString(). */
- private String toString;
+ private transient String toString;
// --------------------------------------------------------------------------------------------