Skip to content

Commit

Permalink
fix: Avoid false warning about UTC timestamps (#505)
Browse files Browse the repository at this point in the history
If the JDBC customization is already correctly configured,
`SchedulerClient.Builder.build` should not instantiate an unused
incorrectly configured one.

## Fixes

Instantiating a `SchedulerClient` on MariaDB always logged the UTC
warning, even when using a correctly configured JDBC customization:

```java
SchedulerClient.Builder.create(dataSource)
            .jdbcCustomization(AutodetectJdbcCustomization(dataSource, true))
            .build()
```

```
2024-06-21T15:44:33.427+02:00  WARN 57277 --- [  restartedMain] c.g.k.s.j.A.utc_warning                  : MariaDB-schema does not support persistent timezones. It is recommended to store time in UTC to avoid issues with for example DST. For first time users, use setting 'alwaysPersistTimestampInUtc' to achieve this. Users upgrading from a version prior to v14.0.0 can either silence this logger, or perform a controlled upgrade to UTC timestamps. All old instances of the scheduler must be stopped and timestamps migrated to UTC before starting again, using 'alwaysPersistTimestampInUtc=true'.
```

(I did not create a separate issue for this.)

---
cc @kagkarlsson

Co-authored-by: Georg Echterling <g.echterling@jobware.de>
  • Loading branch information
GeorgEchterling and Georg Echterling committed Jun 21, 2024
1 parent 1b52ac3 commit 60a3f76
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -219,11 +219,15 @@ public SchedulerClient build() {
TaskResolver taskResolver = new TaskResolver(StatsRegistry.NOOP, knownTasks);
final SystemClock clock = new SystemClock();

final JdbcCustomization jdbcCustomization =
ofNullable(this.jdbcCustomization)
.orElseGet(() -> new AutodetectJdbcCustomization(dataSource));

TaskRepository taskRepository =
new JdbcTaskRepository(
dataSource,
false,
ofNullable(jdbcCustomization).orElse(new AutodetectJdbcCustomization(dataSource)),
jdbcCustomization,
tableName,
taskResolver,
new SchedulerClientName(),
Expand Down

0 comments on commit 60a3f76

Please sign in to comment.