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

Feature/extract execution synchronization #3519

Merged
merged 14 commits into from
Aug 27, 2024

Conversation

thoniTUB
Copy link
Collaborator

@thoniTUB thoniTUB commented Aug 8, 2024

Next step towards caching: remove synchronization object from persistable ManagedExecution to the ExecutionManager.

@thoniTUB thoniTUB requested a review from awildturtok August 8, 2024 10:02
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.

Ich muss mir das nochmal anschauen

…re/extract-execution-synchronization

# Conflicts:
#	backend/src/test/java/com/bakdata/conquery/util/support/TestConquery.java
query.finish(ExecutionState.DONE);
if (finishedWorkers.equals(getWorkerHandler(execution).getAllWorkerIds())) {
execution.finish(ExecutionState.DONE, this);
clearLockInternalExecution(execution.getId());
Copy link
Collaborator

Choose a reason for hiding this comment

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

ist das nicht eher teil von finish?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

habs zu finish gepackt

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

habs in die finish methoden gepackt

Comment on lines 204 to 214
public void clearLockInternalExecution(ManagedExecutionId id) {
R result = Objects.requireNonNull(executionResults.getIfPresent(id), "Cannot clear lock on absent execution result");

result.getExecutingLock().countDown();
}

public void clearLockExternalExecution(ManagedExecutionId id) {
ExternalResult result = Objects.requireNonNull(externalExecutionResults.getIfPresent(id), "Cannot clear lock on absent execution result");

result.getExecutingLock().countDown();
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

warum sind die unterschiedlich?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Ich schaue ob ich die alle unter ein Dach bringen kann

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Schwierig, executionResults ist parametrizert, damit jeweils der Sql/ DistributedExecutiomanager ohne casting auf das Result zugreifen kann.

Da die Externen Results reinzumischen bringt nichts.

Comment on lines 227 to 232
if (execution instanceof InternalExecution<?>) {
result = executionResults.getIfPresent(id);
}
else {
result = externalExecutionResults.getIfPresent(id);
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

this is funny

Copy link
Collaborator

Choose a reason for hiding this comment

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

die Result Klasse musst du noch komplett aufräumen glaube ich, das ist etwas strange

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

ich hab sie jetzt umbenannt, aber an sich nichts geändert. Kannst du mir einen Tipp geben, was dich stört?

Copy link
Collaborator

Choose a reason for hiding this comment

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

annst du mir einen Tipp geben, was dich stört?

In der Klasse waren sehr viele instanceof calls. Der hier spezifisch irritiert mich, weil du 2 identitsch konfigurierte Caches gleich benutzt, aber auf die Execution Klasse unterscheidest. Wenn die Klassen sich keine Logik Teilen kannst du dann einfach hard-casten, sonst würde ich es eben in eine gemeinsame Klasse stecken.

@thoniTUB thoniTUB requested a review from awildturtok August 22, 2024 14:17
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.

Ich verliere beim lesen des Execution Managers leider komplett den überblick durch die ganzen instanceof calls

…onization' into feature/extract-execution-synchronization

# Conflicts:
#	backend/src/main/java/com/bakdata/conquery/models/worker/Namespace.java
…re/extract-execution-synchronization

# Conflicts:
#	backend/src/main/java/com/bakdata/conquery/mode/local/LocalNamespaceHandler.java
#	backend/src/main/java/com/bakdata/conquery/models/query/preview/EntityPreviewExecution.java
#	backend/src/main/java/com/bakdata/conquery/sql/conquery/SqlExecutionManager.java
#	backend/src/test/java/com/bakdata/conquery/integration/json/FormTest.java
#	backend/src/test/java/com/bakdata/conquery/io/result/ResultTestUtil.java
#	backend/src/test/java/com/bakdata/conquery/io/result/excel/ExcelResultRenderTest.java
@thoniTUB thoniTUB requested a review from awildturtok August 27, 2024 08:06

log.info("Executing Query[{}] in Dataset[{}]", execution.getQueryId(), execution.getDataset());

addState(execution.getId(), new DistributedState(new ConcurrentHashMap<>(), new CountDownLatch(1)));
Copy link
Collaborator

Choose a reason for hiding this comment

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

kannst du das nicht in einen default Constructor oder creator von DistributedState packen?

Comment on lines +204 to +219
public ExecutionState awaitDone(ManagedExecution execution, int time, TimeUnit unit) {
ManagedExecutionId id = execution.getId();
ExecutionState state = execution.getState();
if (state != ExecutionState.RUNNING) {
return state;
}

State result = executionStates.getIfPresent(id);

if (result == null) {
throw new IllegalStateException("Execution is running, but no result is registered");
}
Uninterruptibles.awaitUninterruptibly(result.getExecutingLock(), time, unit);

return execution.getState();
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

sauber, danke

@thoniTUB thoniTUB enabled auto-merge August 27, 2024 11:05
@thoniTUB thoniTUB merged commit c178dfa into develop Aug 27, 2024
6 checks passed
@thoniTUB thoniTUB deleted the feature/extract-execution-synchronization branch October 2, 2024 10:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants