@@ -171,7 +171,7 @@ public synchronized CompletableFuture<AutomqGetPartitionSnapshotResponse> snapsh
171171 long finalSessionEpoch = sessionEpoch ;
172172 CompletableFuture <Void > collectPartitionSnapshotsCf ;
173173 if (!requestCommit && inflightCommitCfSet .isEmpty ()) {
174- collectPartitionSnapshotsCf = collectPartitionSnapshots (resp );
174+ collectPartitionSnapshotsCf = collectPartitionSnapshots (requestVersion , resp );
175175 } else {
176176 collectPartitionSnapshotsCf = CompletableFuture .completedFuture (null );
177177 }
@@ -203,15 +203,15 @@ public synchronized boolean expired() {
203203 return time .milliseconds () - lastGetSnapshotsTimestamp > 60000 ;
204204 }
205205
206- private CompletableFuture <Void > collectPartitionSnapshots (AutomqGetPartitionSnapshotResponseData resp ) {
206+ private CompletableFuture <Void > collectPartitionSnapshots (short requestVersion , AutomqGetPartitionSnapshotResponseData resp ) {
207207 Map <Uuid , List <PartitionSnapshot >> topic2partitions = new HashMap <>();
208208 List <CompletableFuture <Void >> completeCfList = COMPLETE_CF_LIST_LOCAL .get ();
209209 completeCfList .clear ();
210210 removed .forEach (partition -> {
211211 PartitionSnapshotVersion version = synced .remove (partition );
212212 if (version != null ) {
213213 List <PartitionSnapshot > partitionSnapshots = topic2partitions .computeIfAbsent (partition .topicId ().get (), topic -> new ArrayList <>());
214- partitionSnapshots .add (snapshot (partition , version , null , completeCfList ));
214+ partitionSnapshots .add (snapshot (requestVersion , partition , version , null , completeCfList ));
215215 }
216216 });
217217 removed .clear ();
@@ -221,7 +221,7 @@ private CompletableFuture<Void> collectPartitionSnapshots(AutomqGetPartitionSnap
221221 if (!Objects .equals (p .version , oldVersion )) {
222222 List <PartitionSnapshot > partitionSnapshots = topic2partitions .computeIfAbsent (p .partition .topicId ().get (), topic -> new ArrayList <>());
223223 PartitionSnapshotVersion newVersion = p .version .copy ();
224- PartitionSnapshot partitionSnapshot = snapshot (p .partition , oldVersion , newVersion , completeCfList );
224+ PartitionSnapshot partitionSnapshot = snapshot (requestVersion , p .partition , oldVersion , newVersion , completeCfList );
225225 partitionSnapshots .add (partitionSnapshot );
226226 synced .put (p .partition , newVersion );
227227 }
@@ -239,7 +239,7 @@ private CompletableFuture<Void> collectPartitionSnapshots(AutomqGetPartitionSnap
239239 return retCf ;
240240 }
241241
242- private PartitionSnapshot snapshot (Partition partition , PartitionSnapshotVersion oldVersion ,
242+ private PartitionSnapshot snapshot (short requestVersion , Partition partition , PartitionSnapshotVersion oldVersion ,
243243 PartitionSnapshotVersion newVersion , List <CompletableFuture <Void >> completeCfList ) {
244244 if (newVersion == null ) {
245245 // partition is closed
@@ -268,7 +268,9 @@ private PartitionSnapshot snapshot(Partition partition, PartitionSnapshotVersion
268268 if (includeSegments ) {
269269 snapshot .setLogMetadata (logMetadata (src .logMeta ()));
270270 }
271- snapshot .setLastTimestampOffset (timestampOffset (src .lastTimestampOffset ()));
271+ if (requestVersion > ZERO_ZONE_V0_REQUEST_VERSION ) {
272+ snapshot .setLastTimestampOffset (timestampOffset (src .lastTimestampOffset ()));
273+ }
272274 return snapshot ;
273275 });
274276 }
0 commit comments