Skip to content

Commit

Permalink
improve performance for consistency
Browse files Browse the repository at this point in the history
  • Loading branch information
thoniTUB committed Dec 11, 2024
1 parent 6a8e16b commit 21cfd8e
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import com.bakdata.conquery.models.datasets.Table;
import com.bakdata.conquery.models.datasets.concepts.Concept;
import com.bakdata.conquery.models.identifiable.NamespacedStorageProvider;
import com.bakdata.conquery.models.identifiable.ids.Id;
import com.bakdata.conquery.models.identifiable.ids.specific.ConceptId;
import com.bakdata.conquery.models.identifiable.ids.specific.DatasetId;
import com.bakdata.conquery.models.identifiable.ids.specific.ImportId;
Expand All @@ -22,6 +23,8 @@ public interface NamespacedStorage extends ConqueryStorage, NamespacedStoragePro

Stream<Import> getAllImports();

Stream<ImportId> getAllImportIds();

void updateImport(Import imp);

void removeImport(ImportId id);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,11 @@ private Import getImportFromStorage(ImportId id) {
return imports.get(id);
}

@Override
public Stream<ImportId> getAllImportIds() {
return imports.getAllKeys().map(ImportId.class::cast);
}

@Override
public Stream<Import> getAllImports() {
return imports.getAll();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,15 @@ public class RequestConsistency extends WorkerMessage {

@Override
public void react(Worker context) throws Exception {
log.info("BEGIN Gather consistency information");
// Gather ImportIds
Set<ImportId> workerImports = context.getStorage().getAllImports().map(Import::getId).collect(Collectors.toSet());
Set<ImportId> workerImports = context.getStorage().getAllImportIds().collect(Collectors.toSet());

// Gather BucketIds
Set<BucketId> workerBuckets = context.getStorage().getAllBuckets().map(Bucket::getId).collect(Collectors.toSet());
Set<BucketId> workerBuckets = context.getStorage().getAllBucketIds().collect(Collectors.toSet());

// Send report
context.send(new ReportConsistency(context.getInfo().getId(), workerImports, workerBuckets));
log.debug("FINISHED Gather consistency information");
}
}

0 comments on commit 21cfd8e

Please sign in to comment.