Class TcpMigrationDataSender

java.lang.Object
com.loomcache.server.cluster.TcpMigrationDataSender
All Implemented Interfaces:
PartitionMigrationPipeline.MigrationDataSender

public final class TcpMigrationDataSender extends Object implements PartitionMigrationPipeline.MigrationDataSender
PartitionMigrationPipeline.MigrationDataSender that ships partition data to a target node over TCP with per-chunk ACK + retry (Session 10 ESC-12).

Protocol:

  1. PARTITION_MIGRATE_START(slotId, sourceNodeId) — single frame.
  2. For each chunk c ∈ [0, totalChunks):
    • Source registers an ACK waiter for (target, slotId, c).
    • Source sends PARTITION_MIGRATE_DATA with value = [chunkSeq 4B][totalChunks 4B][serialized batch].
    • Source waits up to ACK_TIMEOUT for a PARTITION_MIGRATE_DATA_ACK(slotId, chunkSeq) from target. On timeout it retries up to MAX_ATTEMPTS times, then aborts the whole slot migration.
  3. PARTITION_MIGRATE_COMPLETE(slotId, sourceNodeId) — single frame.

Target-side applies chunks idempotently via PartitionMigrationManager.onMigrateData(int, String, int, int, byte[]), dedupes re-delivered chunks by the applied-chunk high-water mark, and re-ACKs duplicates so the source can unstick if an earlier ACK was dropped.