Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[da-vinci][dvc] Dropping unassigned partitions #1332

Draft
wants to merge 10 commits into
base: main
Choose a base branch
from
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,7 @@ public DaVinciBackend(
String pid = Utils.getPid();
String instanceSuffix =
configLoader.getCombinedProperties().getString(PUSH_STATUS_INSTANCE_NAME_SUFFIX, (pid == null ? "NA" : pid));
// Current instance name.
String instanceName = Utils.getHostName() + "_" + instanceSuffix;

// Fetch latest update schema's protocol ID for Push Status Store from Router.
Expand Down Expand Up @@ -474,6 +475,11 @@ private synchronized void bootstrap() {
AbstractStorageEngine storageEngine = storageService.getStorageEngine(versionTopic);
aggVersionedStorageEngineStats.setStorageEngine(versionTopic, storageEngine);
StoreBackend storeBackend = getStoreOrThrow(storeName);
ComplementSet<Integer> subscription = storeBackend.getSubscription();
ComplementSet<Integer> unassignedPartitionSet = ComplementSet.newSet(subscription);
// Set of partitions that are not included in the submitted set of partitions.
unassignedPartitionSet.removeAll(ComplementSet.newSet(partitions));
subscription.removeAll(unassignedPartitionSet);
storeBackend.subscribe(ComplementSet.newSet(partitions), Optional.of(version));
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,10 @@ public StoreBackendStats getStats() {
return stats;
}

public ComplementSet<Integer> getSubscription() {
return subscription;
}

public ReferenceCounted<VersionBackend> getDaVinciCurrentVersion() {
return daVinciCurrentVersionRef.get();
}
Expand Down Expand Up @@ -154,6 +158,7 @@ synchronized CompletableFuture<Void> subscribe(
// Recreate store config that was potentially deleted by unsubscribe.
config.store();
}

subscription.addAll(partitions);

if (daVinciFutureVersion == null) {
Expand Down
Loading