Skip to content

Commit f621cc7

Browse files
committed
[dvc] Config flag for subscribing on disk partitions automatically. Updated with integration test and unit test.
1 parent 0e82518 commit f621cc7

File tree

2 files changed

+12
-7
lines changed

2 files changed

+12
-7
lines changed

clients/da-vinci-client/src/main/java/com/linkedin/davinci/DaVinciBackend.java

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -399,7 +399,7 @@ private Function<String, Boolean> functionToCheckWhetherStorageEngineShouldBeKep
399399
};
400400
}
401401

402-
private synchronized void bootstrap() {
402+
protected synchronized void bootstrap() {
403403
List<AbstractStorageEngine> storageEngines =
404404
storageService.getStorageEngineRepository().getAllLocalStorageEngines();
405405
LOGGER.info("Starting bootstrap, storageEngines: {}", storageEngines);
@@ -669,10 +669,6 @@ protected void handleStoreChanged(StoreBackend storeBackend) {
669669
storeBackend.trySubscribeDaVinciFutureVersion();
670670
}
671671

672-
protected void executeBootstrapping() {
673-
bootstrap();
674-
}
675-
676672
Version getVeniceLatestNonFaultyVersion(String storeName, Set<Integer> faultyVersions) {
677673
try {
678674
return getVeniceLatestNonFaultyVersion(getStoreRepository().getStoreOrThrow(storeName), faultyVersions);

clients/da-vinci-client/src/test/java/com/linkedin/davinci/DaVinciBackendTest.java

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -256,12 +256,21 @@ public Object answer(InvocationOnMock invocation) throws Throwable {
256256

257257
// DA_VINCI_SUBSCRIBE_ON_DISK_PARTITIONS_AUTOMATICALLY == false
258258
when(mockCombinedProperties.getBoolean(anyString(), anyBoolean())).thenReturn(false);
259-
doCallRealMethod().when(backend).executeBootstrapping();
260-
backend.executeBootstrapping();
259+
doCallRealMethod().when(backend).bootstrap();
260+
backend.bootstrap();
261261

262262
ComplementSet<Integer> subscription = mockStoreBackend.getSubscription();
263263
assertTrue(subscription.contains(0));
264264
assertTrue(subscription.contains(1));
265265
assertFalse(subscription.contains(2));
266+
267+
when(mockCombinedProperties.getBoolean(anyString(), anyBoolean())).thenReturn(true);
268+
backend.bootstrap();
269+
270+
subscription = mockStoreBackend.getSubscription();
271+
assertTrue(subscription.contains(0));
272+
assertTrue(subscription.contains(1));
273+
assertTrue(subscription.contains(2));
274+
266275
}
267276
}

0 commit comments

Comments
 (0)