Skip to content

Commit

Permalink
fix(jdbc): always include deleted the the logs and metrics queries
Browse files Browse the repository at this point in the history
Even if not needed to be sure we use the correct index.
  • Loading branch information
loicmathieu committed Oct 15, 2024
1 parent f838f58 commit 2f56df4
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,10 @@ public Integer purge(Execution execution) {
DSLContext context = DSL.using(configuration);

return context.delete(this.jdbcRepository.getTable())
.where(field("execution_id", String.class).eq(execution.getId()))
// The deleted field is not used, so ti will always be false.
// We add it here to be sure to use the correct index.
.where(field("deleted", Boolean.class).eq(false))
.and(field("execution_id", String.class).eq(execution.getId()))
.execute();
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,10 @@ public Integer purge(Execution execution) {
DSLContext context = DSL.using(configuration);

return context.delete(this.jdbcRepository.getTable())
.where(field("execution_id", String.class).eq(execution.getId()))
// The deleted field is not used, so ti will always be false.
// We add it here to be sure to use the correct index.
.where(field("deleted", Boolean.class).eq(false))
.and(field("execution_id", String.class).eq(execution.getId()))
.execute();
});
}
Expand All @@ -168,8 +171,7 @@ private List<String> queryDistinct(String tenantId, Condition condition, String
.getDslContextWrapper()
.transactionResult(configuration -> {
DSLContext context = DSL.using(configuration);
SelectConditionStep<Record1<Object>> select = DSL
.using(configuration)
SelectConditionStep<Record1<Object>> select = context
.selectDistinct(field(field))
.from(this.jdbcRepository.getTable())
.where(this.defaultFilter(tenantId));
Expand All @@ -185,8 +187,7 @@ private ArrayListTotal<MetricEntry> query(String tenantId, Condition condition,
.getDslContextWrapper()
.transactionResult(configuration -> {
DSLContext context = DSL.using(configuration);
SelectConditionStep<Record1<Object>> select = DSL
.using(configuration)
SelectConditionStep<Record1<Object>> select = context
.select(field("value"))
.from(this.jdbcRepository.getTable())
.where(this.defaultFilter(tenantId));
Expand Down

0 comments on commit 2f56df4

Please sign in to comment.