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

Merge Release #3632

Merged
merged 44 commits into from
Dec 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
e9ce331
Bump commons-io:commons-io from 2.11.0 to 2.14.0 in /backend
dependabot[bot] Oct 3, 2024
107b9ea
remove explicit resonse builders
thoniTUB Oct 16, 2024
560194b
remove positive number check from InputRange
thoniTUB Sep 11, 2024
7dee2cd
Merge branch 'refs/heads/develop' into feature/allow-negative-range-i…
thoniTUB Oct 28, 2024
0741086
adds cypress test for negative filter value
thoniTUB Oct 28, 2024
60ed8ba
prettier
thoniTUB Nov 5, 2024
e8f70b8
Merge branch 'develop' into feature/allow-negative-range-in-filter
thoniTUB Nov 5, 2024
d7c109b
Merge pull request #3611 from ingef/feature/allow-negative-range-in-f…
thoniTUB Nov 5, 2024
2c7b198
Merge branch 'develop' into dependabot/maven/backend/commons-io-commo…
thoniTUB Nov 7, 2024
9c76e36
Merge pull request #3589 from ingef/dependabot/maven/backend/commons-…
thoniTUB Nov 7, 2024
970be5f
use openapi gen jaxrs-jersey
thoniTUB Nov 8, 2024
48d11e9
use openapi gen jaxrs-spec
thoniTUB Nov 8, 2024
1fe2398
wip register formbackend
thoniTUB Nov 8, 2024
93b9caf
adds workaround to remove metrics of closed client
thoniTUB Nov 11, 2024
568dd00
review changes
thoniTUB Nov 11, 2024
e0dc145
Merge pull request #3617 from ingef/feature/api-formbackend-management
thoniTUB Nov 12, 2024
3c49cfa
Multi mapping string selects (#3613)
awildturtok Nov 19, 2024
a3c89db
Bump commons-io:commons-io from 2.14.0 to 2.18.0 (#3620)
dependabot[bot] Nov 20, 2024
4c959fc
Merge branch 'develop' into reintegrate-main
thoniTUB Nov 27, 2024
fef7c7b
Merge pull request #3625 from ingef/reintegrate-main
thoniTUB Nov 28, 2024
589bb1a
show connector/table when referencing a filter
thoniTUB Nov 28, 2024
fe8e705
adds e2e test for concept list resolve
thoniTUB Nov 29, 2024
94cbd57
adds e2e test for filter value resolve
thoniTUB Nov 29, 2024
04fb322
prettier and revert '>' in single text element
thoniTUB Nov 29, 2024
7a125d4
Merge pull request #3626 from ingef/feature/display-connector-name
thoniTUB Nov 29, 2024
27cccc8
set html language dynamically
thoniTUB Nov 29, 2024
f77b42d
prettier
thoniTUB Nov 29, 2024
c6d6526
Merge pull request #3627 from ingef/fix/html-lang
thoniTUB Dec 2, 2024
6005966
Merge branch 'develop' into reintegrate-main
thoniTUB Dec 3, 2024
d917f20
Merge pull request #3628 from ingef/reintegrate-main
awildturtok Dec 3, 2024
0d3fa4c
check against connectorId instead of table id
thoniTUB Dec 3, 2024
c1dad12
refactors some usages of Id#resolve:
awildturtok Dec 3, 2024
da100fe
initialize extractor once
awildturtok Dec 3, 2024
15cc8c6
cleanup reference usage with TableExportQuery
awildturtok Dec 3, 2024
aa33821
format
awildturtok Dec 3, 2024
7ddc6cf
Merge pull request #3630 from ingef/fix/use-get-where-failure-allowed
thoniTUB Dec 4, 2024
7a9940c
Merge branch 'develop' into fix/check-connectorId
thoniTUB Dec 4, 2024
04ebe47
Merge branch 'release' into fix/check-connectorId
thoniTUB Dec 4, 2024
6e7652f
Merge pull request #3631 from ingef/fix/check-connectorId
thoniTUB Dec 4, 2024
29cb0f4
Merge branch 'release' into fix/clean-up-resources
thoniTUB Dec 4, 2024
d44859e
Merge pull request #3605 from ingef/fix/clean-up-resources
thoniTUB Dec 4, 2024
ecb0f6b
short circuit empty date field and preventing time consuming and log …
thoniTUB Dec 5, 2024
7e67c01
fixes typos
thoniTUB Dec 9, 2024
330fd61
Merge pull request #3634 from ingef/fix/entity-upload-NPE-slowdown
thoniTUB Dec 9, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
59 changes: 53 additions & 6 deletions backend/pom.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

Expand All @@ -15,6 +15,8 @@
<apache-poi.version>5.2.2</apache-poi.version>
<apache-arrow.version>16.0.0</apache-arrow.version>
<apache-parquet.version>1.12.3</apache-parquet.version>
<prometheus-metrics.version>1.2.1</prometheus-metrics.version>
<openapi-generator.version>7.9.0</openapi-generator.version>
</properties>

<build>
Expand Down Expand Up @@ -75,6 +77,36 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.openapitools</groupId>
<artifactId>openapi-generator-maven-plugin</artifactId>
<version>${openapi-generator.version}</version>
<executions>
<execution>
<id>openapi-admin</id>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<inputSpec>${project.basedir}/src/main/resources/openapi/admin-openapi.json</inputSpec>
<!-- Don't use jaxrs-jersey here because it does not allow dependency injection -->
<generatorName>jaxrs-spec</generatorName>
<modelsToGenerate>ApiResponse</modelsToGenerate>
<packageName>com.bakdata.conquery</packageName>
<!-- This package name is used by EndpointTestHelper to filter out openapi specs -->
<apiPackage>com.bakdata.conquery.models.api.openapi</apiPackage>
<modelPackage>com.bakdata.conquery.models.config</modelPackage>
<configOptions>
<!-- The implementation of these interfaces actually allows us to use DI (not possible with jaxrs-jersey) -->
<interfaceOnly>true</interfaceOnly>
<sourceFolder>src/main/java</sourceFolder>
<generateSupportingFiles>false</generateSupportingFiles>
<useJakartaEe>true</useJakartaEe>
</configOptions>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>

Expand Down Expand Up @@ -123,7 +155,7 @@
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.11.0</version>
<version>2.18.0</version>
</dependency>
<dependency>
<groupId>com.univocity</groupId>
Expand Down Expand Up @@ -383,17 +415,32 @@
<dependency>
<groupId>io.prometheus</groupId>
<artifactId>prometheus-metrics-simpleclient-bridge</artifactId>
<version>1.2.1</version>
<version>${prometheus-metrics.version}</version>
</dependency>
<dependency>
<groupId>io.prometheus</groupId>
<artifactId>prometheus-metrics-exporter-servlet-jakarta</artifactId>
<version>1.2.1</version>
<version>${prometheus-metrics.version}</version>
</dependency>
<dependency>
<groupId>io.prometheus</groupId>
<artifactId>prometheus-metrics-core</artifactId>
<version>1.2.1</version>
<version>${prometheus-metrics.version}</version>
</dependency>
<dependency>
<groupId>org.openapitools</groupId>
<artifactId>openapi-generator-maven-plugin</artifactId>
<version>${openapi-generator.version}</version>
</dependency>
<dependency>
<groupId>io.swagger.core.v3</groupId>
<artifactId>swagger-integration-jakarta</artifactId>
<version>2.2.25</version>
</dependency>
<dependency>
<groupId>io.swagger.core.v3</groupId>
<artifactId>swagger-jaxrs2-jakarta</artifactId>
<version>2.2.25</version>
</dependency>
<dependency>
<groupId>org.awaitility</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ public boolean isSearchDisabled() {
public TrieSearch<FrontendValue> createTrieSearch(IndexConfig config) throws IndexCreationException {

final URI resolvedURI = FileUtil.getResolvedUri(config.getBaseUrl(), getFilePath());
log.trace("Resolved filter template reference url for search '{}': {}", this.getId(), resolvedURI);
log.trace("Resolved filter template reference url for search '{}': {}", getId(), resolvedURI);

final FrontendValueIndex search = indexService.getIndex(new FrontendValueIndexKey(
resolvedURI,
Expand All @@ -101,7 +101,7 @@ public TrieSearch<FrontendValue> createTrieSearch(IndexConfig config) throws Ind
config.getSearchSplitChars()
));

return search;
return search.getDelegate();
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,35 +107,41 @@ public class QueryProcessor {
private Validator validator;


public Stream<ExecutionStatus> getAllQueries(Dataset dataset, HttpServletRequest req, Subject subject, boolean allProviders) {
public Stream<? extends ExecutionStatus> getAllQueries(Dataset dataset, HttpServletRequest req, Subject subject, boolean allProviders) {
final Stream<ManagedExecution> allQueries = storage.getAllExecutions();

return getQueriesFiltered(dataset.getId(), RequestAwareUriBuilder.fromRequest(req), subject, allQueries, allProviders);
}

public Stream<ExecutionStatus> getQueriesFiltered(DatasetId datasetId, UriBuilder uriBuilder, Subject subject, Stream<ManagedExecution> allQueries, boolean allProviders) {
public Stream<? extends ExecutionStatus> getQueriesFiltered(DatasetId datasetId, UriBuilder uriBuilder, Subject subject, Stream<ManagedExecution> allQueries, boolean allProviders) {

return allQueries
// The following only checks the dataset, under which the query was submitted, but a query can target more that
// one dataset.
.filter(q -> q.getDataset().equals(datasetId))
// to exclude subtypes from somewhere else
.filter(QueryProcessor::canFrontendRender)
.filter(Predicate.not(ManagedExecution::isSystem))
.filter(q -> {
ExecutionState state = q.getState();
return state == ExecutionState.NEW || state == ExecutionState.DONE;
}
)
.filter(q -> subject.isPermitted(q, Ability.READ))
.map(mq -> {
final OverviewExecutionStatus status = mq.buildStatusOverview(subject);

if (mq.isReadyToDownload()) {
status.setResultUrls(getResultAssets(config.getResultProviders(), mq, uriBuilder, allProviders));
}
return status;
});
// The following only checks the dataset, under which the query was submitted, but a query can target more that
// one dataset.
.filter(q -> q.getDataset().equals(datasetId))
// to exclude subtypes from somewhere else
.filter(QueryProcessor::canFrontendRender)
.filter(Predicate.not(ManagedExecution::isSystem))
.filter(q -> {
ExecutionState state = q.getState();
return state == ExecutionState.NEW || state == ExecutionState.DONE;
})
.filter(q -> subject.isPermitted(q, Ability.READ))
.map(mq -> {
try {
final OverviewExecutionStatus status = mq.buildStatusOverview(subject);

if (mq.isReadyToDownload()) {
status.setResultUrls(getResultAssets(config.getResultProviders(), mq, uriBuilder, allProviders));
}
return status;
}
catch (Exception e) {
log.error("FAILED building status for {}", mq, e);
}
return null;
})
.filter(Objects::nonNull);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ private static Map<ColumnId, Integer> calculateColumnPositions(
for (Column column : table.getConnector().resolve().getResolvedTable().getColumns()) {

// ValidityDates are handled separately in column=0
if (validityDates.stream().anyMatch(vd -> vd.containsColumn(column))) {
if (validityDates.stream().anyMatch(vd -> vd.containsColumn(column.getId()))) {
continue;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,10 +148,11 @@ public String defaultLabel(Locale locale) {
builder.append(" ");

for (ConceptElementId<?> id : elements) {
ConceptElement<?> conceptElement = id.resolve();
if (conceptElement.equals(getConcept())) {
if (id.equals(getConceptId())) {
continue;
}

ConceptElement<?> conceptElement = id.resolve();
builder.append(conceptElement.getLabel()).append("+");
}

Expand Down Expand Up @@ -274,9 +275,7 @@ public RequiredEntities collectRequiredEntities(QueryExecutionContext context) {
final Set<ConnectorId> connectors = getTables().stream().map(CQTable::getConnector).collect(Collectors.toSet());

return new RequiredEntities(context.getBucketManager()
.getEntitiesWithConcepts(getElements().stream()
.<ConceptElement<?>>map(ConceptElementId::resolve)
.toList(),
.getEntitiesWithConcepts(getElements(),
connectors, context.getDateRestriction()));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,11 @@ public void readDates(String value, DateReader dateReader, CDateSet out) {
DATE_SET {
@Override
public void readDates(String value, DateReader dateReader, CDateSet out) {
out.addAll(dateReader.parseToCDateSet(value));
CDateSet parsed = dateReader.parseToCDateSet(value);
if (parsed == null ) {
return;
}
out.addAll(parsed);
}
},
ALL {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import com.bakdata.conquery.models.identifiable.mapping.ExternalId;
import com.bakdata.conquery.util.DateReader;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;

@Slf4j
public class EntityResolverUtil {
Expand All @@ -41,7 +42,7 @@ public static CDateSet[] readDates(String[][] values, List<String> format, DateR
but can also don't contribute to any date aggregation.
*/
if (dateFormats.stream().allMatch(Objects::isNull)) {
// Initialize empty
// Initialize empty, so all lines appear als resolved
for (int row = 0; row < values.length; row++) {
out[row] = CDateSet.createEmpty();
}
Expand All @@ -59,10 +60,19 @@ public static CDateSet[] readDates(String[][] values, List<String> format, DateR
if (dateFormat == null) {
continue;
}
dateFormat.readDates(values[row][col], dateReader, dates);
String value = values[row][col];

if (StringUtils.isBlank(value)) {
log.trace("Found blank/null value in {}/{} (row/col)", row,col);
continue;
}

dateFormat.readDates(value, dateReader, dates);
}

if (dates.isEmpty()) {
// Don't set an empty dateset here, because this flags the line as: unresolvedDate
// TODO It might be better to set an empty dateset nonetheless, because it seems to be intentionally empty, as we had no problem while parsing a value
continue;
}

Expand All @@ -73,7 +83,9 @@ public static CDateSet[] readDates(String[][] values, List<String> format, DateR
out[row].addAll(dates);
}
catch (Exception e) {
log.warn("Failed to parse Date from {}", row, e);
// If a value is not parsable, it is included in the exceptions cause message (see DateReader)
log.trace("Failed to parse Date in row {}", row, e);
// This catch causes `out[row]` to remain `null` which later flags this line as: unresolvedDate
}
}

Expand Down Expand Up @@ -142,6 +154,7 @@ public static String tryResolveId(String[] row, List<Function<String[], External
*/
public static Map<String, String>[] readExtras(String[][] values, List<String> format) {
final String[] names = values[0];
@SuppressWarnings("unchecked")
final Map<String, String>[] extrasByRow = new Map[values.length];


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
import com.bakdata.conquery.tasks.QueryCleanupTask;
import com.bakdata.conquery.tasks.ReloadMetaStorageTask;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.google.common.base.Throwables;
import io.dropwizard.core.setup.Environment;
import io.dropwizard.lifecycle.Managed;
import lombok.Getter;
Expand All @@ -53,12 +52,11 @@ public class ManagerNode implements Managed {
public static final String DEFAULT_NAME = "manager";

private final String name;

private final List<ResourcesProvider> providers = new ArrayList<>();
private Validator validator;
private AdminServlet admin;
private AuthorizationController authController;
private ScheduledExecutorService maintenanceService;
private final List<ResourcesProvider> providers = new ArrayList<>();
@Delegate(excludes = Managed.class)
private Manager manager;

Expand Down Expand Up @@ -88,7 +86,8 @@ public void run(Manager manager) throws InterruptedException {
formScanner = new FormScanner(config);


config.initialize(this);
// Init all plugins
config.getPlugins().forEach(pluginConfig -> pluginConfig.initialize(this));


// Initialization of internationalization
Expand Down Expand Up @@ -127,34 +126,11 @@ public void run(Manager manager) throws InterruptedException {
}
}

try {
formScanner.execute(null, null);
}
catch (Exception e) {
Throwables.throwIfUnchecked(e);
throw new RuntimeException(e);
}
formScanner.execute(null, null);

registerTasks(manager, environment, config);
}

private void registerTasks(Manager manager, Environment environment, ConqueryConfig config) {
environment.admin().addTask(formScanner);
environment.admin().addTask(
new QueryCleanupTask(getMetaStorage(), Duration.of(
config.getQueries().getOldQueriesTime().getQuantity(),
config.getQueries().getOldQueriesTime().getUnit().toChronoUnit()
)));

environment.admin().addTask(new PermissionCleanupTask(getMetaStorage()));
manager.getAdminTasks().forEach(environment.admin()::addTask);
environment.admin().addTask(new ReloadMetaStorageTask(getMetaStorage()));

final ShutdownTask shutdown = new ShutdownTask();
environment.admin().addTask(shutdown);
environment.lifecycle().addServerLifecycleListener(shutdown);
}

private void configureApiServlet(ConqueryConfig config, Environment environment) {
ResourceConfig jerseyConfig = environment.jersey().getResourceConfig();
RESTServer.configure(config, jerseyConfig);
Expand All @@ -171,14 +147,6 @@ protected void configure() {
jerseyConfig.register(PathParamInjector.class);
}

private void loadMetaStorage() {
log.info("Opening MetaStorage");
getMetaStorage().openStores(getInternalMapperFactory().createManagerPersistenceMapper(getDatasetRegistry(), getMetaStorage()), getEnvironment().metrics());
log.info("Loading MetaStorage");
getMetaStorage().loadData();
log.info("MetaStorage loaded {}", getMetaStorage());
}

@SneakyThrows(InterruptedException.class)
public void loadNamespaces() {

Expand All @@ -203,6 +171,31 @@ public void loadNamespaces() {
}
}

private void loadMetaStorage() {
log.info("Opening MetaStorage");
getMetaStorage().openStores(getInternalMapperFactory().createManagerPersistenceMapper(getDatasetRegistry(), getMetaStorage()), getEnvironment().metrics());
log.info("Loading MetaStorage");
getMetaStorage().loadData();
log.info("MetaStorage loaded {}", getMetaStorage());
}

private void registerTasks(Manager manager, Environment environment, ConqueryConfig config) {
environment.admin().addTask(formScanner);
environment.admin().addTask(
new QueryCleanupTask(getMetaStorage(), Duration.of(
config.getQueries().getOldQueriesTime().getQuantity(),
config.getQueries().getOldQueriesTime().getUnit().toChronoUnit()
)));

environment.admin().addTask(new PermissionCleanupTask(getMetaStorage()));
manager.getAdminTasks().forEach(environment.admin()::addTask);
environment.admin().addTask(new ReloadMetaStorageTask(getMetaStorage()));

final ShutdownTask shutdown = new ShutdownTask();
environment.admin().addTask(shutdown);
environment.lifecycle().addServerLifecycleListener(shutdown);
}

@Override
public void start() throws Exception {
manager.start();
Expand Down
Loading
Loading