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

All-Queries-Endpoint fails on uninitialied queries #3570

Merged
merged 7 commits into from
Sep 26, 2024

Conversation

thoniTUB
Copy link
Collaborator

@thoniTUB thoniTUB commented Sep 19, 2024

ERROR [2024-09-19 22:01:54]	i.d.j.e.LoggingExceptionMapper	user.81ac8d69-f2a6-4cf8-bf61-292453a3f44b	Error handling a request: ac5e6b1e3510bfab
java.lang.NullPointerException: Cannot invoke "com.bakdata.conquery.models.config.ConqueryConfig.getPreprocessor()" because "config" is null
	at com.bakdata.conquery.models.query.PrintSettings.<init>(PrintSettings.java:69)
	at com.bakdata.conquery.models.query.PrintSettings.<init>(PrintSettings.java:62)
	at com.bakdata.conquery.models.config.ExcelResultProvider.generateResultURLs(ExcelResultProvider.java:77)
	at com.bakdata.conquery.apiv1.QueryProcessor.lambda$getResultAssets$4(QueryProcessor.java:175)
	at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:197)
	at java.base/java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1625)
	at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509)
	at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499)
	at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:575)
	at java.base/java.util.stream.AbstractPipeline.evaluateToArrayNode(AbstractPipeline.java:260)
	at java.base/java.util.stream.ReferencePipeline.toArray(ReferencePipeline.java:616)
	at java.base/java.util.stream.ReferencePipeline.toArray(ReferencePipeline.java:622)
	at java.base/java.util.stream.ReferencePipeline.toList(ReferencePipeline.java:627)
	at com.bakdata.conquery.apiv1.QueryProcessor.getResultAssets(QueryProcessor.java:184)
	at com.bakdata.conquery.apiv1.QueryProcessor.lambda$getQueriesFiltered$3(QueryProcessor.java:132)
	at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:197)
	at java.base/java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:179)
	at java.base/java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:179)
	at java.base/java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:179)
	at java.base/java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:179)
	at java.base/java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:179)
	at java.base/java.util.concurrent.ConcurrentHashMap$ValueSpliterator.forEachRemaining(ConcurrentHashMap.java:3612)
	at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509)
	at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499)
	at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:921)
	at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
	at java.base/java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:682)
	at com.bakdata.conquery.resources.api.DatasetQueryResource.getAllQueries(DatasetQueryResource.java:95)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

@thoniTUB
Copy link
Collaborator Author

This is cause by the last release persisting execution states, which led to parts of the code assuming an execution was initialized.

Copy link
Collaborator

@awildturtok awildturtok left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sind nur unstimmigkeiten die aber nicht problematisch sind

@@ -525,7 +538,7 @@ public Stream<Map<String, String>> resolveEntities(Subject subject, List<FilterV
throw new ConqueryError.ExecutionProcessingTimeoutError();
}

if (execution.getState() == ExecutionState.FAILED) {
if (execution.getState(namespace.getExecutionManager()) == ExecutionState.FAILED) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wäre es nicht möglich den executionManager schon in der execution zu haben? Dann sparst du dir das wiederholte reingeben

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ist jetzt injected

final ExternalTaskState formState = state.getApi().getFormState(externalTaskId);

updateStatus(formState, executionManager);
Optional<ExternalState> state = this.executionManager.tryGetResult(this.getId());
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

du verwendest hier this.executionManager obwohl du einen reingegeben bekommst. => bitte überarbeiten

if (!(state instanceof DistributedState distributedState)) {
throw new IllegalStateException("Expected execution '%s' to be of type %s, but was %s".formatted(execution.getId(), DistributedState.class, state.getClass()));
}
distributedState.results.put(result.getWorkerId(), result.getResults());

// If all known workers have returned a result, the query is DONE.
if (distributedState.allResultsArrived(getWorkerHandler(execution.getDataset().getId()).getAllWorkerIds())) {

DistributedExecutionManager.DistributedState previousState = getResult(id);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nicht benutzt?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Habe ich auf geräumt, auch die nachfolgende Zeile war nicht mehr nötig

private static URI getPostQueryURI(StandaloneSupport conquery) {
return HierarchyHelper.hierarchicalPath(conquery.defaultApiURIBuilder(), DatasetQueryResource.class, "postQuery")
.buildFromMap(Map.of(
"dataset", conquery.getDataset().getId()
));
}

private static URI getAllQueriesURI(StandaloneSupport conquery) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cool


assertThat(support.getMetaStorage().getAllExecutions().size()).as("Executions after restart").isEqualTo(numberOfExecutions);

List<OverviewExecutionStatus> allQueries = IntegrationUtils.getAllQueries(support, 200);
assertThat(allQueries).size().isEqualTo(1);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🥇

awildturtok
awildturtok previously approved these changes Sep 23, 2024
@awildturtok awildturtok merged commit 141d390 into master Sep 26, 2024
3 checks passed
@thoniTUB
Copy link
Collaborator Author

@awildturtok Danke, muss ich hier nochmal nacharbeiten?

@thoniTUB thoniTUB deleted the fix/queries-overview-endpoint branch October 2, 2024 10:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants