2 Aralık 2022 Cuma

HazelcastAPI MigrationManager Sınıfı

Giriş
Şu satırı dahil ederiz
import com.hazelcast.internal.partition.impl.MigrationManager;
Açıklaması şöyle
A membership change will stop any ongoing migrations. After members list is updated on all members, master member rebalances partitions.
Bir hata mesajı şöyle
WARNING com.hazelcast.internal.partition.impl.MigrationManager — partitionId=2052 is completely lost!
Rebalance İşlemi Sırasında Map İşlemleri Yavaşlayabilir
Açıklaması şöyle. 
We do not allow mutating ops (eg map.put) on partitions that are being migrated, so they have to be retried until either a new owner exists and migration is done or they timeout. Read ops are not blocked on migrating partitions, so they go through as usual. The caveat for both read-only & mutating operations is that the data migration itself is also executed on the partition thread, and it involves copying the partition data in order to be sent over the network socket to the migration target. Starting with 5.1, we are able to break up migrating data into chunks to avoid having too much data to send in a single packet - default chunk size is 250MB.
Yani yazma işlemi PartitionMigratingException fırlatır. Bu exception retryable exception olduğu için invocation/operation altyapısı tekrar dener.

void onShutdownRequest metodu - Member member
Şöyle tetiklenir
HazelcastInstance instance = ...;
instance.shutdown();
Açıklama şöyle
After replica performs MigrationCommitOperation(), it calls the listeners' onMigrationCommit() method asynchronously.
 Master tarafındaki akış şöyle
//Clears the migration queue and triggers the control task. Called on the master node.
//Bir ControlTask yaratır
MigrationManager.triggerControlTask()

//Bir RepairPartitionTableTask yaratır
/**
 * Task scheduled on the master node to fetch and repair the latest partition table.
 * It will first check if we need to fetch the new partition table and schedule a task to do so, along with a new
 * ControlTask to be executed afterwards. If we don't need to fetch the partition table it will send a
 * RepairPartitionTableTask to repair the existing partition table.
 * Invoked on the master node. It will acquire the partition service lock.
 *
 * @see InternalPartitionServiceImpl#isFetchMostRecentPartitionTableTaskRequired()
 */
private class ControlTask implements MigrationRunnable {
}

//Bir RedoPartitioningTask yaratır
/**
 * Checks if the partition table needs repairing once the partitions 
 * have been initialized (assigned).
 * This means that it will:
 * - Remove unknown addresses from the partition table
 * - Promote the partition replicas if necessary (the partition owner is missing)
 *
 * If the promotions are successful, schedules the RedoPartitioningTask. 
 * If the process was not successful
 * it will trigger a ControlTask to restart the partition table repair process.
 *
 * Invoked on the master node. Acquires partition service lock when scheduling 
 * the tasks on the migration queue.
 */
private class RepairPartitionTableTask implements MigrationRunnable {
}
//Bir MigrationPlanTask yaratır
/**
 * Invoked on the master node. Rearranges the partition table if there is 
 * no recent activity in the cluster after
 * this task has been scheduled, schedules migrations and syncs the partition state.
 * Also schedules a {@link ProcessShutdownRequestsTask}. 
 * Acquires partition service lock.
 */
class RedoPartitioningTask implements MigrationRunnable {
}
//Bir AsyncMigrationTask yaratır ve 
//AsyncMigrationTask'ın bitmesini bekler
class MigrationPlanTask {
}
/**
 * Invoked on the master node to migrate a partition (excluding promotions).
 * It will execute the {@link MigrationRequestOperation} on the partition owner.
 */
private class AsyncMigrationTask {

  migrationOperationSucceeded() //-> MigrationCommitOperation gönderir
  migrationOperationFailed () -> 
}
Diğer üyedeki akış şöyle
/**
 * Sent from the master node to the partition owner.
 *
 * It will perform the migration by preparing the migration
 * operations and sending them to the destination.
 *
 * A response with a value equal to 
 * Boolean#TRUE indicates a successful migration.
 * 
 * It runs on the migration source and transfers the partition
 * with multiple shots. It divides the partition data into
 * fragments and send a group of fragments within each shot.
 * 
 *
 * @since 5.1 If chunked migration is enabled,
 * it also subdivides fragments into chunks.
 */
public class MigrationRequestOperation extends BaseMigrationOperation {
}
//executeBeforeMigrations metodu

//WANMigrationAwarePublisher nesnelerinin
// onMigrationStart()
//metodunu tetikler
//Sonra asenkron olarak MigrationOperation nesnesini çalıştırır. 
//MigrationOperation nesnesinini döndürdüğü TRUE, FALSE sonucu master'a gönderir. 
//Master bu değere bakara commit veya rollback yapar.

/**
 * Migration operation used by Hazelcast version 3.9.
 * 
 * It runs on the migration destination and applies the received
 * fragments. Sent by the partition owner to the migration
 * destination to start the migration process on the destination.
 * Contains the operations which will be executed on the destination
 * node to migrate the data and the replica versions to be set.
 */
public class MigrationOperation extends BaseMigrationOperation implements TargetAware {
}
/**
 * Sent by the master node to commit a migration on the migration destination.
 * It updates the partition table on the migration destination and finalizes 
 * the migration.
 */
public class MigrationCommitOperation extends AbstractPartitionOperation 
  implements MigrationCycleOperation {
}
/**
 * Invoked locally on the source or destination of the migration to finalize the migration.
 * This will notify the MigrationAwareServices that the migration finished, updates 
 * the replica versions,
 * clears the migration flag and notifies the node engine when successful.
 * There might be ongoing concurrent finalization operations for different partitions.
 */
public final class FinalizeMigrationOperation extends AbstractPartitionOperation
        implements PartitionAwareOperation, MigrationCycleOperation {

Bu da gidip WANMigrationAwarePublisher nesnesinin
  onMigrationCommit()
metodunu tetikler

Hiç yorum yok:

Yorum Gönder

THIRD-PARTY.txt Dosyası

Kullanılan harici kütüphanelerin sürümleri bu dosyada Dosyanın yolu şöyle hazelcast/licenses/THIRD-PARTY.txt