Skip to content

Commit

Permalink
[dvc] Config flag for subscribing on disk partitions automatically. U…
Browse files Browse the repository at this point in the history
…pdated with integration test and unit test.
  • Loading branch information
kristyelee committed Feb 5, 2025
1 parent 0e82518 commit 9f36693
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -399,7 +399,7 @@ private Function<String, Boolean> functionToCheckWhetherStorageEngineShouldBeKep
};
}

private synchronized void bootstrap() {
final synchronized void bootstrap() {
List<AbstractStorageEngine> storageEngines =
storageService.getStorageEngineRepository().getAllLocalStorageEngines();
LOGGER.info("Starting bootstrap, storageEngines: {}", storageEngines);
Expand Down Expand Up @@ -669,10 +669,6 @@ protected void handleStoreChanged(StoreBackend storeBackend) {
storeBackend.trySubscribeDaVinciFutureVersion();
}

protected void executeBootstrapping() {
bootstrap();
}

Version getVeniceLatestNonFaultyVersion(String storeName, Set<Integer> faultyVersions) {
try {
return getVeniceLatestNonFaultyVersion(getStoreRepository().getStoreOrThrow(storeName), faultyVersions);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -256,12 +256,21 @@ public Object answer(InvocationOnMock invocation) throws Throwable {

// DA_VINCI_SUBSCRIBE_ON_DISK_PARTITIONS_AUTOMATICALLY == false
when(mockCombinedProperties.getBoolean(anyString(), anyBoolean())).thenReturn(false);
doCallRealMethod().when(backend).executeBootstrapping();
backend.executeBootstrapping();
doCallRealMethod().when(backend).bootstrap();
backend.bootstrap();

ComplementSet<Integer> subscription = mockStoreBackend.getSubscription();
assertTrue(subscription.contains(0));
assertTrue(subscription.contains(1));
assertFalse(subscription.contains(2));

// DA_VINCI_SUBSCRIBE_ON_DISK_PARTITIONS_AUTOMATICALLY == true
when(mockCombinedProperties.getBoolean(anyString(), anyBoolean())).thenReturn(true);
backend.bootstrap();

subscription = mockStoreBackend.getSubscription();
assertTrue(subscription.contains(0));
assertTrue(subscription.contains(1));
assertTrue(subscription.contains(2));
}
}

0 comments on commit 9f36693

Please sign in to comment.