void applyMigration ( InternalPartitionImpl partition , MigrationInfo migrationInfo ) { final PartitionReplica [ ] members = Arrays . copyOf ( partition . getReplicas ( ) , InternalPartition . MAX_REPLICA_COUNT ) ; if ( migrationInfo . getSourceCurrentReplicaIndex ( ) > - 1 ) { members [ migrationInfo . getSourceCurrentReplicaIndex ( ) ] = null ; } if ( migrationInfo . getDestinationCurrentReplicaIndex ( ) > - 1 ) { members [ migrationInfo . getDestinationCurrentReplicaIndex ( ) ] = null ; } members [ migrationInfo . getDestinationNewReplicaIndex ( ) ] = migrationInfo . getDestination ( ) ; if ( migrationInfo . getSourceNewReplicaIndex ( ) > - 1 ) { members [ migrationInfo . getSourceNewReplicaIndex ( ) ] = migrationInfo . getSource ( ) ; } partition . setReplicas ( members ) ; }
Mutates the partition state and applies the migration .