[
https://issues.apache.org/jira/browse/BEAM-5496?focusedWorklogId=155478&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-155478
]
ASF GitHub Bot logged work on BEAM-5496:
----------------------------------------
Author: ASF GitHub Bot
Created on: 17/Oct/18 16:21
Start Date: 17/Oct/18 16:21
Worklog Time Spent: 10m
Work Description: lukecwik commented on a change in pull request #6701:
[BEAM-5496] Fixes bug of MqttIO fails to deserialize checkpoint
URL: https://github.com/apache/beam/pull/6701#discussion_r226001900
##########
File path:
sdks/java/io/mqtt/src/main/java/org/apache/beam/sdk/io/mqtt/MqttIO.java
##########
@@ -335,8 +339,26 @@ public void finalizeCheckpoint() {
// set an empty list to messages when deserialize
private void readObject(java.io.ObjectInputStream stream)
throws IOException, ClassNotFoundException {
+ stream.defaultReadObject();
messages = new ArrayList<>();
}
+
+ @Override
+ public boolean equals(Object other) {
+ if (other instanceof MqttCheckpointMark){
Review comment:
nit: use guard style statements (simplifies code readability):
```
if (!(other instanceof MqttCheckpointMark)) {
return false;
}
MqttCheckpointMark that = (MqttCheckpointMark)other;
return this.clientId.equals(that.clientId) &&
this.oldestMessageTimestamp.equals(that.oldestMessageTimestamp);
```
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
Issue Time Tracking
-------------------
Worklog Id: (was: 155478)
> MqttIO fails to deserialize checkpoint
> --------------------------------------
>
> Key: BEAM-5496
> URL: https://issues.apache.org/jira/browse/BEAM-5496
> Project: Beam
> Issue Type: Bug
> Components: io-java-mqtt
> Reporter: Luke Cwik
> Assignee: Island Chen
> Priority: Major
> Time Spent: 50m
> Remaining Estimate: 0h
>
> Source of bug report:
> [https://lists.apache.org/thread.html/3de5a946bcb539dea9f18a31f712d6af5b66f9fbb6b01eed452c5afb@%3Cdev.beam.apache.org%3E]
>
> There is a bug of the built-in MqttIO, please check the
> <https://github.com/apache/beam/blob/master/sdks/java/io/mqtt/src/main/java/org/apache/beam/sdk/io/mqtt/MqttIO.java#L336>,
> this readObject() method forget to invoke the "stream.defaultReadObject()"
> method.
>
> {code:java}
> // set an empty list to messages when deserialize
> private void readObject(java.io.ObjectInputStream stream)
> throws IOException, ClassNotFoundException {
> messages = new ArrayList<>();
> }{code}
>
> So there is an exception while the runner tried to deserialize the checkpoint
> object.
> {code:java}
> java.lang.RuntimeException: org.apache.beam.sdk.coders.CoderException: 95
> unexpected extra bytes after decoding
> org.apache.beam.sdk.io.mqtt.MqttIO$MqttCheckpointMark@6764e219
> at
> org.apache.beam.runners.direct.DirectRunner$DirectPipelineResult.waitUntilFinish(DirectRunner.java:340)
> ...{code}
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)