loserwang1024 commented on code in PR #2321:
URL: https://github.com/apache/fluss/pull/2321#discussion_r2670651108
##########
fluss-flink/fluss-flink-common/src/main/java/org/apache/fluss/flink/source/state/FlussSourceEnumeratorStateSerializer.java:
##########
@@ -78,24 +100,29 @@ public byte[] serialize(SourceEnumeratorState state)
throws IOException {
out.writeInt(tableBucket.getBucket());
}
// write assigned partitions
- out.writeInt(state.getAssignedPartitions().size());
- for (Map.Entry<Long, String> entry :
state.getAssignedPartitions().entrySet()) {
+ out.writeInt(assignedPartitions.size());
+ for (Map.Entry<Long, String> entry : assignedPartitions.entrySet()) {
out.writeLong(entry.getKey());
out.writeUTF(entry.getValue());
}
+ }
+ @VisibleForTesting
+ protected byte[] serializeV0(SourceEnumeratorState state) throws
IOException {
+ final DataOutputSerializer out = SERIALIZER_CACHE.get();
+ serializeAssignBucketAndPartitions(
+ out, state.getAssignedBuckets(),
state.getAssignedPartitions());
if (lakeSource != null) {
serializeRemainingHybridLakeFlussSplits(out, state);
}
-
final byte[] result = out.getCopyOfBuffer();
out.clear();
return result;
}
@Override
public SourceEnumeratorState deserialize(int version, byte[] serialized)
throws IOException {
- if (version != VERSION_0) {
+ if (version != VERSION_0 && version != CURRENT_VERSION) {
Review Comment:
I understand it. But in your follower comment "for VERSION_1 and later"
maybe inconsistency.
<img width="952" height="280" alt="image"
src="https://github.com/user-attachments/assets/7c1eebec-fbf2-43d3-824b-b4a943ce0340"
/>
Maybe you can use `switch.. case` as kafka does. It's more clear
<img width="508" height="669" alt="image"
src="https://github.com/user-attachments/assets/d3d851f7-11aa-4464-bdcc-fdecae52b12c"
/>
--
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]