Skip to content

fix(sql): Bugfixes for sql matching stats - #3915

Merged
awildturtok merged 8 commits into
developfrom
fix/bugfixes-sql-matching-stats
Aug 10, 2026
Merged

fix(sql): Bugfixes for sql matching stats#3915
awildturtok merged 8 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 thread backend/src/main/java/com/bakdata/conquery/mode/local/LocalNamespaceHandler.java Outdated
}
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

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.

Mir ging es hier darum, dass die Exception vermutlich doppelt geloggt wird.
Einmal hier und dann durch den rethrow nochmals an anderer Stelle sodass man in den Logs zweimal fast den selben Stacktrace hat, was verwirrend ist. Deshalb die Exception wrappen mit einer (z.B.) RuntimeException wrappen, die aber als Message die momentane Log-Message hat

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

@awildturtok
awildturtok requested a review from thoniTUB August 5, 2026 09:22
@awildturtok awildturtok changed the title bugfixes for sql matching stats fix(sql): Bugfixes for sql matching stats Aug 5, 2026
}
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.

Mir ging es hier darum, dass die Exception vermutlich doppelt geloggt wird.
Einmal hier und dann durch den rethrow nochmals an anderer Stelle sodass man in den Logs zweimal fast den selben Stacktrace hat, was verwirrend ist. Deshalb die Exception wrappen mit einer (z.B.) RuntimeException wrappen, die aber als Message die momentane Log-Message hat

Comment on lines +77 to +81
for (Map.Entry<ConceptId, ListenableFuture<?>> conceptState : jobsByConcept.entrySet()) {
if (conceptState.getValue().state().equals(Future.State.FAILED)) {
log.warn("FAILED to collect SQL matching stats for {}", conceptState.getKey(), conceptState.getValue().exceptionNow());
}
}

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.

Da du schon ListenableFutures benutzt und das logging keine Seiteneffekte hat, kannst du auch einfach einen Callback registrieren und muss hier nicht loopen

@awildturtok
awildturtok enabled auto-merge (squash) August 10, 2026 10:08
@awildturtok
awildturtok requested a review from thoniTUB August 10, 2026 10:08
try {
log.debug("TEST connecting to {}", connection.getJdbcConnectionUrl());
if (dataSource.getConnection().isValid(100)) {
if (dataSource.getConnection().isValid(1000)) {

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.

Die 1000 ist ein Timeout oder?

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.

genau, der geht hier aber nur auf die connection. Denke, wenn die Verbindung nach 1sek nicht als valide aufgebaut werden kann ist da was kaputt

@awildturtok
awildturtok merged commit 2f3f257 into develop Aug 10, 2026
11 checks passed
@thoniTUB thoniTUB added the bug label Aug 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants