poorbarcode commented on code in PR #130:
URL: 
https://github.com/apache/flink-connector-pulsar/pull/130#discussion_r4332554659


##########
flink-connector-pulsar/src/main/java/org/apache/flink/connector/pulsar/sink/committer/MessageIdPojo.java:
##########
@@ -0,0 +1,103 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.flink.connector.pulsar.sink.committer;
+
+import org.apache.flink.annotation.PublicEvolving;
+
+import java.util.Objects;
+
+/** A POJO representation of Pulsar message ID used for serialization. */
+@PublicEvolving

Review Comment:
   MessageIdPojo is now @Internal. TxnIdPojo and PulsarCommittablePojo were 
removed because the binary serializer no longer needs them.



##########
flink-connector-pulsar/src/main/java/org/apache/flink/connector/pulsar/sink/committer/PulsarCommittable.java:
##########
@@ -31,41 +33,58 @@ public class PulsarCommittable {
     /** The transaction id. */
     private final TxnID txnID;
 
-    /** The topic name with partition information. */
-    private final String topic;
+    private final Map<String, MessageIdPojo> latestPublishedMessages;
 
-    public PulsarCommittable(TxnID txnID, String topic) {
+    private final int version;
+
+    public PulsarCommittable(TxnID txnID, Map<String, MessageIdPojo> 
latestPublishedMessages) {
+        this.txnID = txnID;
+        this.latestPublishedMessages = latestPublishedMessages;
+        this.version = 2;
+    }
+
+    // This constructor should only be used by PulsarCommittableSerializer.
+    @Deprecated
+    public PulsarCommittable(TxnID txnID) {
         this.txnID = txnID;
-        this.topic = topic;
+        this.latestPublishedMessages = Collections.emptyMap();
+        this.version = 1;
     }
 
     public TxnID getTxnID() {
         return txnID;
     }
 
-    public String getTopic() {
-        return topic;
+    public Map<String, MessageIdPojo> getLatestPublishedMessages() {
+        return latestPublishedMessages;
+    }
+
+    public int getVersion() {
+        return version;
     }
 
     @Override
     public boolean equals(Object o) {
-        if (this == o) {
-            return true;
-        }
-        if (o == null || getClass() != o.getClass()) {
+        if (!(o instanceof PulsarCommittable)) {
             return false;
         }
         PulsarCommittable that = (PulsarCommittable) o;
-        return Objects.equals(txnID, that.txnID) && Objects.equals(topic, 
that.topic);
+        return Objects.equals(txnID, that.txnID)
+                && Objects.equals(latestPublishedMessages, 
that.latestPublishedMessages);
     }
 
     @Override
     public int hashCode() {
-        return Objects.hash(txnID, topic);
+        return Objects.hash(txnID, latestPublishedMessages);
     }
 
     @Override
     public String toString() {
-        return "PulsarCommittable{" + "txnID=" + txnID + ", topic='" + topic + 
'\'' + '}';
+        return "PulsarCommittable{"
+                + "txnID="
+                + txnID
+                + ", latestPublishedMessages="
+                + latestPublishedMessages

Review Comment:
   Added MessageIdPojo.toString() so committer logs show its fields rather than 
an identity hash.



##########
flink-connector-pulsar/src/main/java/org/apache/flink/connector/pulsar/sink/writer/topic/ProducerRegister.java:
##########
@@ -273,17 +267,17 @@ private void configPulsarCrypto(ProducerBuilder<?> 
builder) {
     }
 
     /**
-     * Get the cached topic-related transaction. Or create a new transaction 
after checkpointing.
+     * Get the transaction for the current checkpoint, or create one after 
checkpointing.
+     *
+     * @param topic Used only for the message builder; transactions may span 
topics.

Review Comment:
   Removed the unused topic parameter from the transaction creation method.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to