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:
PARTITION_MIGRATE_START(slotId, sourceNodeId)— single frame.- For each chunk
c ∈ [0, totalChunks):- Source registers an ACK waiter for
(target, slotId, c). - Source sends
PARTITION_MIGRATE_DATAwith value =[chunkSeq 4B][totalChunks 4B][serialized batch]. - Source waits up to
ACK_TIMEOUTfor aPARTITION_MIGRATE_DATA_ACK(slotId, chunkSeq)from target. On timeout it retries up toMAX_ATTEMPTStimes, then aborts the whole slot migration.
- Source registers an ACK waiter for
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.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final DurationDefault ACK timeout for a single chunk.static final intDefault per-chunk batch size (entry count).static final intDefault max attempts per chunk before aborting. -
Constructor Summary
ConstructorsConstructorDescriptionTcpMigrationDataSender(TcpServer tcpServer, PartitionMigrationManager migrationManager, String sourceNodeId) TcpMigrationDataSender(TcpServer tcpServer, PartitionMigrationManager migrationManager, String sourceNodeId, int chunkEntries, Duration ackTimeout, int maxAttempts) -
Method Summary
Modifier and TypeMethodDescriptionbooleansendPartitionData(String targetNode, int partitionId, Map<String, Map<String, PartitionMigrationPipeline.MigratedEntry>> mapEntries)
-
Field Details
-
DEFAULT_CHUNK_ENTRIES
public static final int DEFAULT_CHUNK_ENTRIESDefault per-chunk batch size (entry count).- See Also:
-
ACK_TIMEOUT
Default ACK timeout for a single chunk. -
MAX_ATTEMPTS
public static final int MAX_ATTEMPTSDefault max attempts per chunk before aborting.- See Also:
-
-
Constructor Details
-
TcpMigrationDataSender
public TcpMigrationDataSender(TcpServer tcpServer, PartitionMigrationManager migrationManager, String sourceNodeId) -
TcpMigrationDataSender
public TcpMigrationDataSender(TcpServer tcpServer, PartitionMigrationManager migrationManager, String sourceNodeId, int chunkEntries, Duration ackTimeout, int maxAttempts)
-
-
Method Details
-
sendPartitionData
public boolean sendPartitionData(String targetNode, int partitionId, Map<String, Map<String, PartitionMigrationPipeline.MigratedEntry>> mapEntries) - Specified by:
sendPartitionDatain interfacePartitionMigrationPipeline.MigrationDataSender
-