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

Draft: hoping to avoid keeping SecondaryIdQuery subPlans, that are not needed #3260

Merged
merged 14 commits into from
Feb 6, 2024

Conversation

awildturtok
Copy link
Collaborator

Makes acceptEvent return if the event has been consumed or not (i.e. if it wasn't excluded by an EventFilterNode). This is used in SecondaryIdQueryPlan to not keep QueryPlans that are not (yet) needed. Hopefully avoiding the creation of many redundant sub-QueryPlans.

@awildturtok awildturtok requested a review from thoniTUB January 4, 2024 13:49
Comment on lines 17 to 21
@Override
public final void acceptEvent(Bucket bucket, int event) {
public final boolean acceptEvent(Bucket bucket, int event) {
hit = true;
return true;
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Die kann man vielleicht auch abstract machen oder wenn hit wichtig ist an doAcceptEvent delegieren

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

ne die ist ja bei EventFilterNode ein no-op, deswegen hab ich sie final gemacht. das hit=true weiß ich ehrlich gesagt nicht, ob es notwendig ist, es ist ja im Endeffekt das gleiche was die LeafNode machen sollte?

Comment on lines 79 to 83
@Override
public void acceptEvent(Bucket bucket, int event) {
public boolean acceptEvent(Bucket bucket, int event) {
// Nothing to do
return true;
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Was hätte ein false hier für Auswirkungen

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 glaube irrelevant, weil es auf die AllIdsTable geht, aber es würde signalisieren, dass das event nicht verarbeitet wurde und dami kein Zustand verursacht wurde. Und im Fall von SecondaryId, der subPlan verworfen werden kann.

Copy link
Collaborator

@thoniTUB thoniTUB left a comment

Choose a reason for hiding this comment

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

Die Test laufen noch nicht durch, vielleicht wird an einer stelle noch nicht richtig das Concume zurückgemeldet

@@ -220,7 +220,7 @@ private ConceptQueryPlan createChild(QueryExecutionContext currentContext, Bucke
ConceptQueryPlan plan;

// Try to reuse old child plan first before allocating new ones
if((plan = childPlanReusePool.poll()) == null) {
if ((plan = childPlanReusePool.poll()) == null) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Warum den poll nicht schon in Zeile 220 machen?

@awildturtok
Copy link
Collaborator Author

Die Test laufen noch nicht durch, vielleicht wird an einer stelle noch nicht richtig das Concume zurückgemeldet

Nein, tragischer: Ein Ergebnis ist jetzt richtiger als davor :/

@awildturtok awildturtok marked this pull request as ready for review January 18, 2024 15:49
@awildturtok
Copy link
Collaborator Author

@thoniTUB ich habe hier ziemlich rumgefriemelt und Filter weiter aufgedröselt

@awildturtok awildturtok requested a review from thoniTUB January 18, 2024 15:51
@@ -1,5 +1,4 @@
result,secondary,dates
a,f_a3,"{2024-06-30/2025-06-30,2026-06-30/2026-06-30}"
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

dass die Person drin war, war eine unfeinheit der QueryEngine.

wir haben zwei Tabellen jeweils wird verlangt den 3. Eintrag == 1 zu haben.

Tabelle mit SecondaryId:
a,f_a3,1.01,"2014-06-30/2015-06-30","a" => EventFilterNode auf SecondaryId Ebene sagt nein.

Tabelle ohne SecondaryId hat die Person definitiv einen Eintrag. Da Konzeptknoten intern verodern ist die SecondaryId f_a3 ausgegeben worden. Das war so eigentlich nie gewollt, ich hatte nur keine Ahnung wie genau ich das implementieren würde. Scheint das ganze jetzt zumindest für EventFilterNode gelöst zu haben.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Okay, ich sehe den Fehler

@@ -42,7 +42,10 @@ public void nextTable(QueryExecutionContext ctx, Table currentTable) {
public void nextBlock(Bucket bucket) {
}

public abstract void acceptEvent(Bucket bucket, int event);
/**
* @implSpec returning false signals that the event may be discarded.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Bitte die Doku nach bessern. So weiß ich gerade im Context vom dem PR was die intention ist, z.B.:

A return value of true means ... and can be used to ...
False means ...

@awildturtok awildturtok requested a review from thoniTUB January 22, 2024 15:02
@@ -11,4 +11,6 @@ public class QueryConfig {
private ThreadPoolDefinition executionPool = new ThreadPoolDefinition();

private Duration oldQueriesTime = Duration.days(30);

private int maxSecondaryIdSubPlans = 30;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Ich denke, es wäre besser, wenn man das dynamischer ein stellen kann. Sonst ist zur Erprobung und für Einzelfälle ein Neustart nötig

@@ -217,10 +225,14 @@ private boolean isOfInterest(Bucket bucket) {
*/
private ConceptQueryPlan createChild(QueryExecutionContext currentContext, Bucket currentBucket) {

ConceptQueryPlan plan;
if (childPerKey.size() >= subPlanLimit){
throw new ConqueryError.ExecutionProcessingError();//TODO proper message
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
throw new ConqueryError.ExecutionProcessingError();//TODO proper message
throw new ConqueryError.ExecutionProcessingError("Insert Coin");

😃

@@ -8,11 +8,10 @@

@AllArgsConstructor
@ToString
public abstract class FilterNode<FILTER_VALUE> extends EventIterating {
public abstract sealed class FilterNode<FILTER_VALUE> extends EventIterating permits EventFilterNode, AggregationResultFilterNode {
Copy link
Collaborator

Choose a reason for hiding this comment

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

benutzen wir schon irgendwo java 17 (Preview) switch with pattern matching oder warum sealing 👀

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

ne, aber ich hab die harte annahme, dass es nur EventFilter oder AggregationResultFilter gibt, in den Code gesteckt. Deswegen muss ich die Klasse sealen.

@awildturtok awildturtok requested a review from thoniTUB February 5, 2024 13:13
@awildturtok awildturtok merged commit 70dc817 into develop Feb 6, 2024
6 checks passed
@delete-merged-branch delete-merged-branch bot deleted the feature/dont-create-subquery-if-not-included branch February 6, 2024 15:07
@awildturtok
Copy link
Collaborator Author

Rudimentary performance comparisons showed that the fastest queries were a bit slower than those of the reference implementation, but slowest queries were always faster than reference implementation and showed no spiking behaviour, which the reference implementation had for especially large secondaryIds.

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