@Override public Operation prepareReplicationOperation(PartitionReplicationEvent event) { int partitionId = event.getPartitionId(); DurableExecutorPartitionContainer partitionContainer = partitionContainers[partitionId]; return partitionContainer.prepareReplicationOperation(event.getReplicaIndex()); }
@Nullable @Override public Operation prepareReplicationOperation(@Nonnull PartitionReplicationEvent event) { int partitionId = event.getPartitionId(); SequencerPartition partition = partitions.get(partitionId); if (partition == null) { return null; } PartitionReplication partitionReplication = partition.createPartitionReplication(); return new SequencerReplicationOperation(partitionReplication); }
private PartitionReplicationEvent getPartitionReplicationEvent() { return new PartitionReplicationEvent(migrationInfo.getPartitionId(), migrationInfo.getDestinationNewReplicaIndex()); }
private PartitionReplicationEvent getPartitionReplicationEvent() { return new PartitionReplicationEvent(migrationInfo.getPartitionId(), migrationInfo.getDestinationNewReplicaIndex()); }
@Override public Collection<ServiceNamespace> getAllServiceNamespaces(PartitionReplicationEvent event) { int partitionId = event.getPartitionId(); LockStoreContainer container = containers[partitionId]; return container.getAllNamespaces(event.getReplicaIndex()); }
final Collection<ServiceNamespace> retainAndGetNamespaces() { PartitionReplicationEvent event = new PartitionReplicationEvent(partitionId, 0); Collection<FragmentedMigrationAwareService> services = nodeEngine.getServices(FragmentedMigrationAwareService.class); Set<ServiceNamespace> namespaces = new HashSet<ServiceNamespace>(); for (FragmentedMigrationAwareService service : services) { Collection<ServiceNamespace> serviceNamespaces = service.getAllServiceNamespaces(event); if (serviceNamespaces != null) { namespaces.addAll(serviceNamespaces); } } namespaces.add(NonFragmentedServiceNamespace.INSTANCE); PartitionReplicaManager replicaManager = partitionService.getReplicaManager(); replicaManager.retainNamespaces(partitionId, namespaces); return replicaManager.getNamespaces(partitionId); }
@Override public Collection<ServiceNamespace> getAllServiceNamespaces(PartitionReplicationEvent event) { MultiMapPartitionContainer partitionContainer = partitionContainers[event.getPartitionId()]; if (partitionContainer == null) { return null; } return partitionContainer.getAllNamespaces(event.getReplicaIndex()); }
final Collection<ServiceNamespace> retainAndGetNamespaces() { PartitionReplicationEvent event = new PartitionReplicationEvent(partitionId, 0); Collection<FragmentedMigrationAwareService> services = nodeEngine.getServices(FragmentedMigrationAwareService.class); Set<ServiceNamespace> namespaces = new HashSet<ServiceNamespace>(); for (FragmentedMigrationAwareService service : services) { Collection<ServiceNamespace> serviceNamespaces = service.getAllServiceNamespaces(event); if (serviceNamespaces != null) { namespaces.addAll(serviceNamespaces); } } namespaces.add(NonFragmentedServiceNamespace.INSTANCE); PartitionReplicaManager replicaManager = partitionService.getReplicaManager(); replicaManager.retainNamespaces(partitionId, namespaces); return replicaManager.getNamespaces(partitionId); }
@Override public Collection<ServiceNamespace> getAllServiceNamespaces(PartitionReplicationEvent event) { CachePartitionSegment segment = segments[event.getPartitionId()]; return segment.getAllNamespaces(event.getReplicaIndex()); }
/** * Send responses for first number of {@code permits} namespaces and remove them from the list. */ private void sendOperationsForNamespaces(int permits) { InternalPartitionServiceImpl partitionService = getService(); try { PartitionReplicationEvent event = new PartitionReplicationEvent(getPartitionId(), getReplicaIndex()); Iterator<ServiceNamespace> iterator = namespaces.iterator(); for (int i = 0; i < permits; i++) { ServiceNamespace namespace = iterator.next(); Collection<Operation> operations; if (NonFragmentedServiceNamespace.INSTANCE.equals(namespace)) { operations = createNonFragmentedReplicationOperations(event); } else { operations = createFragmentReplicationOperations(event, namespace); } sendOperations(operations, namespace); iterator.remove(); } } finally { partitionService.getReplicaManager().releaseReplicaSyncPermits(permits); } }
@Override public Collection<ServiceNamespace> getAllServiceNamespaces(PartitionReplicationEvent event) { CachePartitionSegment segment = segments[event.getPartitionId()]; return segment.getAllNamespaces(event.getReplicaIndex()); }
/** * Send responses for first number of {@code permits} namespaces and remove them from the list. */ private void sendOperationsForNamespaces(int permits) { InternalPartitionServiceImpl partitionService = getService(); try { PartitionReplicationEvent event = new PartitionReplicationEvent(getPartitionId(), getReplicaIndex()); Iterator<ServiceNamespace> iterator = namespaces.iterator(); for (int i = 0; i < permits; i++) { ServiceNamespace namespace = iterator.next(); Collection<Operation> operations; if (NonFragmentedServiceNamespace.INSTANCE.equals(namespace)) { operations = createNonFragmentedReplicationOperations(event); } else { operations = createFragmentReplicationOperations(event, namespace); } sendOperations(operations, namespace); iterator.remove(); } } finally { partitionService.getReplicaManager().releaseReplicaSyncPermits(permits); } }
@Override public Collection<ServiceNamespace> getAllServiceNamespaces(PartitionReplicationEvent event) { MultiMapPartitionContainer partitionContainer = partitionContainers[event.getPartitionId()]; if (partitionContainer == null) { return null; } return partitionContainer.getAllNamespaces(event.getReplicaIndex()); }
@Override public Operation prepareReplicationOperation(PartitionReplicationEvent event) { int partitionId = event.getPartitionId(); DurableExecutorPartitionContainer partitionContainer = partitionContainers[partitionId]; return partitionContainer.prepareReplicationOperation(event.getReplicaIndex()); }
@Override public Operation prepareReplicationOperation(PartitionReplicationEvent event) { if (event.getReplicaIndex() > 1) { return null; } Container container = containers[event.getPartitionId()]; Map<String, Integer> data = container.toMigrationData(); return data.isEmpty() ? null : new CounterMigrationOperation(data); }
@Override public Operation prepareReplicationOperation(PartitionReplicationEvent e) { if (e.getReplicaIndex() > 1) { return null; } Container container = containers[e.getPartitionId()]; Map<String, Integer> migrationData = container.toMigrationData(); if (migrationData.isEmpty()) { return null; } return new CounterMigrationOperation(migrationData); }
@Override public Collection<ServiceNamespace> getAllServiceNamespaces(PartitionReplicationEvent event) { int partitionId = event.getPartitionId(); LockStoreContainer container = containers[partitionId]; return container.getAllNamespaces(event.getReplicaIndex()); }
@Override public Collection<ServiceNamespace> getAllServiceNamespaces(PartitionReplicationEvent event) { return containers[event.getPartitionId()].getAllNamespaces(event.getReplicaIndex()); }
@Override public Collection<ServiceNamespace> getAllServiceNamespaces(PartitionReplicationEvent event) { return containers[event.getPartitionId()].getAllNamespaces(event.getReplicaIndex()); }
@Override public Operation prepareReplicationOperation(PartitionReplicationEvent event) { if (event.getReplicaIndex() > 1) { return null; } Container container = containers[event.getPartitionId()]; Map<String, Integer> data = container.toMigrationData(); return data.isEmpty() ? null : new CounterMigrationOperation(data); }