@Test public void testPickupFromIncompleteCopy() { Map<String, ResolverResult> dirLayerMappings; try (FDBRecordContext context = database.openContext()) { dirLayerMappings = seedDirectoryLayer(context, primary, 34); } ResolverMappingReplicator incompleteReplicator = new ResolverMappingReplicator(primary, 10); incompleteReplicator.copyTo(replica); try (FDBRecordContext context = database.openContext()) { List<CompletableFuture<Boolean>> existsFutures = new ArrayList<>(); for (Map.Entry<String, ResolverResult> entry : dirLayerMappings.entrySet()) { existsFutures.add(replica.read(context, entry.getKey()).thenApply(Optional::isPresent)); } List<Boolean> results = AsyncUtil.getAll(existsFutures).join(); long presentValues = results.stream().filter(a -> a).count(); assertThat(presentValues, is(34L)); } Map<String, ResolverResult> newMappings; try (FDBRecordContext context = database.openContext()) { newMappings = seedDirectoryLayer(context, primary, 66); } Map<String, ResolverResult> totalMappings = ImmutableMap.<String, ResolverResult>builder() .putAll(dirLayerMappings) .putAll(newMappings) .build(); ResolverMappingReplicator completeReplicator = new ResolverMappingReplicator(primary, 10); completeReplicator.copyTo(replica); assertContainsMappings(replica, totalMappings); }
public void copyTo(LocatableResolver replica) { runner.asyncToSync(FDBStoreTimer.Waits.WAIT_LOCATABLE_RESOLVER_MAPPING_COPY, copyToAsync(replica)); }
ResolverMappingReplicator implements AutoCloseable { public void copyTo(LocatableResolver replica) { runner.asyncToSync(FDBStoreTimer.Waits.WAIT_LOCATABLE_RESOLVER_MAPPING_COPY, copyToAsync(replica)); } }
ResolverMappingReplicator implements AutoCloseable { public void copyTo(LocatableResolver replica) { runner.asyncToSync(FDBStoreTimer.Waits.WAIT_LOCATABLE_RESOLVER_MAPPING_COPY, copyToAsync(replica)); } ResolverMappingReplicator(@Nonnull LocatableResolver primary);  ResolverMappingReplicator(@Nonnull LocatableResolver primary,
                                     final int transactionRowLimit);  ResolverMappingReplicator(@Nonnull LocatableResolver primary,
                                     final int transactionRowLimit,
                                     final long transactionTimeLimitMillis); }
ResolverMappingReplicator implements AutoCloseable { public void copyTo(LocatableResolver replica) { runner.asyncToSync(FDBStoreTimer.Waits.WAIT_LOCATABLE_RESOLVER_MAPPING_COPY, copyToAsync(replica)); } ResolverMappingReplicator(@Nonnull LocatableResolver primary);  ResolverMappingReplicator(@Nonnull LocatableResolver primary,
                                     final int transactionRowLimit);  ResolverMappingReplicator(@Nonnull LocatableResolver primary,
                                     final int transactionRowLimit,
                                     final long transactionTimeLimitMillis); @Override void close(); void copyTo(LocatableResolver replica); CompletableFuture<Void> copyToAsync(@Nonnull final LocatableResolver replica); @Override String toString(); }
ResolverMappingReplicator implements AutoCloseable { public void copyTo(LocatableResolver replica) { runner.asyncToSync(FDBStoreTimer.Waits.WAIT_LOCATABLE_RESOLVER_MAPPING_COPY, copyToAsync(replica)); } ResolverMappingReplicator(@Nonnull LocatableResolver primary);  ResolverMappingReplicator(@Nonnull LocatableResolver primary,
                                     final int transactionRowLimit);  ResolverMappingReplicator(@Nonnull LocatableResolver primary,
                                     final int transactionRowLimit,
                                     final long transactionTimeLimitMillis); @Override void close(); void copyTo(LocatableResolver replica); CompletableFuture<Void> copyToAsync(@Nonnull final LocatableResolver replica); @Override String toString();  }