private int sendSingleBackup(BackupAwareOperation backupAwareOp, InternalPartition partition, long[] replicaVersions, int syncBackups) { // Since there is only one replica, replica index is `1` return sendSingleBackup(backupAwareOp, partition, replicaVersions, syncBackups, 1); }
private int sendSingleBackup(BackupAwareOperation backupAwareOp, InternalPartition partition, long[] replicaVersions, int syncBackups) { // Since there is only one replica, replica index is `1` return sendSingleBackup(backupAwareOp, partition, replicaVersions, syncBackups, 1); }
private int makeBackups(BackupAwareOperation backupAwareOp, int partitionId, long[] replicaVersions, int syncBackups, int asyncBackups) { int sendSyncBackups; int totalBackups = syncBackups + asyncBackups; InternalPartitionService partitionService = node.getPartitionService(); InternalPartition partition = partitionService.getPartition(partitionId); if (totalBackups == 1) { sendSyncBackups = sendSingleBackup(backupAwareOp, partition, replicaVersions, syncBackups); } else { sendSyncBackups = sendMultipleBackups(backupAwareOp, partition, replicaVersions, syncBackups, totalBackups); } return sendSyncBackups; }
private int makeBackups(BackupAwareOperation backupAwareOp, int partitionId, long[] replicaVersions, int syncBackups, int asyncBackups) { int sendSyncBackups; int totalBackups = syncBackups + asyncBackups; InternalPartitionService partitionService = node.getPartitionService(); InternalPartition partition = partitionService.getPartition(partitionId); if (totalBackups == 1) { sendSyncBackups = sendSingleBackup(backupAwareOp, partition, replicaVersions, syncBackups); } else { sendSyncBackups = sendMultipleBackups(backupAwareOp, partition, replicaVersions, syncBackups, totalBackups); } return sendSyncBackups; }
private int sendMultipleBackups(BackupAwareOperation backupAwareOp, InternalPartition partition, long[] replicaVersions, int syncBackups, int totalBackups) { int sendSyncBackups = 0; Operation backupOp = getBackupOperation(backupAwareOp); if (!(backupOp instanceof TargetAware)) { // optimize common case: serialize operation once and send to multiple targets Data backupOpData = nodeEngine.getSerializationService().toData(backupOp); for (int replicaIndex = 1; replicaIndex <= totalBackups; replicaIndex++) { Address target = partition.getReplicaAddress(replicaIndex); if (target == null) { continue; } assertNoBackupOnPrimaryMember(partition, target); boolean isSyncBackup = replicaIndex <= syncBackups; Backup backup = newBackup(backupAwareOp, backupOpData, replicaVersions, replicaIndex, isSyncBackup); outboundOperationHandler.send(backup, target); if (isSyncBackup) { sendSyncBackups++; } } } else { for (int replicaIndex = 1; replicaIndex <= totalBackups; replicaIndex++) { int syncBackupSent = sendSingleBackup(backupAwareOp, partition, replicaVersions, syncBackups, replicaIndex); sendSyncBackups += syncBackupSent; } } return sendSyncBackups; }
int syncBackupSent = sendSingleBackup(backupAwareOp, partition, replicaVersions, syncBackups, replicaIndex); sendSyncBackups += syncBackupSent;