Skip to content

bugfixes for sql matching stats - #3915

Open
awildturtok wants to merge 5 commits into
developfrom
fix/bugfixes-sql-matching-stats
Open

bugfixes for sql matching stats#3915
awildturtok wants to merge 5 commits into
developfrom
fix/bugfixes-sql-matching-stats

Conversation

@awildturtok

Copy link
Copy Markdown
Collaborator

No description provided.

@awildturtok
awildturtok requested a review from thoniTUB as a code owner July 9, 2026 09:30
@awildturtok
awildturtok force-pushed the fix/bugfixes-sql-matching-stats branch from 7d52893 to d679125 Compare July 9, 2026 09:55
Comment on lines -103 to -106
loadNamespaces();

loadMetaStorage();

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Wenn du das verschiebst, kann es gut sein, dass du die nachfolgenden Zeilen auch noch verschieben musst

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Muss mal schauen, ob es neustarts überlebt, aber sah bisher tatsächlich so aus. Hatte den branch schon ausführlich verwendet um matching stats zu testen

connection.getConnection()
);
} catch (Exception e) {
log.error("Failed to load namespaceStorage for {}", namespaceStorage.getDataset(), e);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Kannst du hier namespaceStorage.getDataset() aufrufen, wenn der Storage gefailed ist? Das sieht falsch aus

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Guter Punkt, danke

}
catch (SQLException exception) {
log.error("FAILED connecting to {}", connection.getJdbcConnectionUrl(), exception);
throw exception;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Dadurch muss beim Startup die Datenbank schon verfügbar sein und kann nicht erst verzögert bereit sein. Ist für kubernetes okay, da der Pod dann neugestartet werden kann, aber du könntest auch die Exception mit der neuen Message wrappen als Cause un dann würde der Exception nicht doppelt geloggt werden (Ich gehe davon aus, dass die Exception dann nochmal geloggt wird )

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Für mich ist das schon Anforderung der Anwendung, dass SQL verfügbar ist, wenn es startet? Siehst du das anders? Mir gehts auch darum, dass ein falsches Passwort den Start abbricht, statt erst später beim Anfrage ausführen (also ggf. gar nicht) knallt

import java.util.concurrent.TimeUnit;

@Slf4j
@Data

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Kannst du hier noch die @EqualsAndHashCode(callSuper=?) ergänzen, um die Compiler Warnings wegzumachen

}
try {
someJob.get(30, TimeUnit.SECONDS);
} catch (Exception e) {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Spezifischer: catch (TimeoutException e) ?

Comment on lines +50 to +53
if (!(concept instanceof TreeConcept)) {
continue;
}
jobsByConcept.put(concept.getId(), matchingStats.collectMatchingStatsForConcept((TreeConcept) concept, executorService, 5));

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Suggested change
if (!(concept instanceof TreeConcept)) {
continue;
}
jobsByConcept.put(concept.getId(), matchingStats.collectMatchingStatsForConcept((TreeConcept) concept, executorService, 5));
if (concept instanceof TreeConcept treeConcept) {
jobsByConcept.put(concept.getId(), matchingStats.collectMatchingStatsForConcept(treeConcept, executorService, 5));
}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Magicnumber 5!

Comment on lines +37 to +39
@Min(1)
@Builder.Default
private int matchingStatsWorkers = 5;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Wird glaube ich noch nicht genutzt, im backend/src/main/java/com/bakdata/conquery/mode/local/UpdateMatchingStatsSqlJob.java hast du noch die 5 als Magicnumber

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Doch, die wird verwendet und ist eine andere magic number. Aber ja kann die retries auch konfigurieren

Comment on lines +61 to +64
/**
* collect unique fields used/defined in the expressions.
*/
private static List<Field<?>> collectAllFields(List<CTCondition.ConceptConditions> conceptConditions) {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Suggested change
/**
* collect unique fields used/defined in the expressions.
*/
private static List<Field<?>> collectAllFields(List<CTCondition.ConceptConditions> conceptConditions) {
/**
* collect unique fields used/defined in the expressions.
*/
private static List<Field<?>> collectReferencedFields(List<CTCondition.ConceptConditions> conceptConditions) {


Stopwatch stopwatch = Stopwatch.createStarted();
MatchingStats stats = new MatchingStats();
stats.putEntry("sql", entry.getValue());

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Dass der Entry hier "sql" heißt, sollte das nicht aus einer Konstante kommen?

DialectBundle dialectBundle,
DSLContext dslContext,
SqlExecutionService executionService, Clock clock
SqlExecutionService executionService, Clock clock, String defaultPrimaryColumn

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Suggested change
SqlExecutionService executionService, Clock clock, String defaultPrimaryColumn
SqlExecutionService executionService,
Clock clock,
String defaultPrimaryColumn

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