You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Usage records get end_date rounded up to the next period; listUsageRecords silently drops records on the last day/period of any range #14928
This is a regression, caused by #13809 "Improve date/timestamp handling performance in GenericDaoBase and DateUtil".
Cause.
GenericDaoBase used to bind dates as yyyy-MM-dd HH:mm:ss strings, which truncated the milliseconds.
It now binds them with pstmt.setTimestamp(..., gmtCalendar()) (GenericDaoBase.java:1854).
Connector/J 8.4 sends the milliseconds, and MySQL rounds them for DATETIME(0) columns. The session sql_mode has no TIME_TRUNCATE_FRACTIONAL.
The usage job computes endDate = periodEnd - 1 ms (UsageManagerImpl.java:404/414/423). That gives xx:59:59.999, which is now stored as the start of the next period.
Live reproduction (KVM env). I set usage.stats.job.aggregation.range=10 (reverted afterwards).
usage_job.end_millis = …059999 (17:00:59.999), but usage_job.end_date and every cloud_usage row have end_date = 17:01:00. 4.22.1.0 would store 17:00:59.
listUsageRecords startdate=2026-11-30 16:51:00 enddate=2026-11-30 17:00:59 returns 0 records. With enddate=17:01:00 it returns 22.
With the default daily aggregation, every day’s record gets end_date = D+1 00:00:00. A date-only enddate=D becomes D 23:59:59 (ParamProcessWorker.java:490), and the filter requires endDate BETWEEN start AND end (UsageServiceImpl.java:360-361). So the last day of every usage query loses its records. This affects billing integrations and the UI usage page.
Other effects.
Records still written via raw SQL strings keep :59:59 (network bytes, VM disk, bucket; UsageDaoImpl.saveUsageRecords), so the table is now inconsistent across types.
In general, every DATETIME written via GenericDaoBase can now be up to +0.5 s in the future.
versions
4.22.2 RC2
The steps to reproduce the bug
No response
What to do about it?
Possible fixes - truncate to whole seconds before binding, or add TIME_TRUNCATE_FRACTIONAL to the session sql_mode.
Activity