Read the current Databricks event log last in every time zone - #2149
Merged
Conversation
A Databricks log-delivery directory holds the current `eventlog` and rolled
`eventlog-YYYY-MM-DD--HH-MM.gz` files. `getDBEventLogFileDate` dated the current file
`LocalDateTime.now()` in the machine's zone and the rolled files by their UTC stamps, so on a
machine west of UTC, for up to the zone offset after a rotation, the current file sorted first
and the events were processed out of order. Every SQL, job and stage spanning the rotation lost
its duration and `totalCoreSeconds` was 0, with no log line.
The undated current file is by definition the newest, so it is now dated `LocalDateTime.MAX`;
the value is only ever compared, never logged or added to, so nothing else changes.
Test: `QualificationNoSparkSuite` gets a rolled-log case whose rolled file carries a future
stamp, which reproduces the misorder in any zone at any time; it fails without the change and
passes with it, and asserts `getDBEventLogFileDate("eventlog")` is after any rolled stamp.
Fixes NVIDIA#2141
Signed-off-by: Thomas Wynne <jtwynne3@gmail.com>
NVnavkumar
self-requested a review
September 11, 2026 05:24
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #2141
Problem
A Databricks log-delivery directory holds the current
eventlogand rolledeventlog-YYYY-MM-DD--HH-MM.gzfiles.EventLogPathProcessor.getDBEventLogFileDatedated thecurrent file
LocalDateTime.now()in the machine's zone and the rolled files by their stamps,which are UTC wall time: in the Databricks 17.3 log this came from, the file named
18-20ends at 18:19:55Z and the current file starts at 18:20:00Z. On a machine west of UTC, for up
to the zone offset after a rotation, the current file sorted first and the events were
processed out of order:
totalCoreSecondswas 0 andremoved_executors.csvwas missing, because the executor'sremoval was processed before its addition;
doSparkListenerSQLExecutionEnddrops an end event whose start it hasnot seen.
Both the profiling and the qualification tool read directories through this path.
Fix
The undated current file is by definition the newest, so it is now dated
LocalDateTime.MAX.LocalDateTime.now(ZoneOffset.UTC)would fix the zone but still depend on the reader'sclock and still race with a rotation in the same minute; a sentinel needs no clock.
changes.
modificationTimeandfileSizeForLastIndex(unused today) read the last file of the sortedlist, which is now always the current file.
Tests
QualificationNoSparkSuite, "db event log rolling with a rolled file dated after the currentfile": the
db_sim_eventlogfixture copied into a temp directory with the rolled file renamedto
eventlog-2099-12-31--23-59.gz, checked against the same expected files as the existing"db event log rolling" test, since the log content is unchanged. It reproduces the misorder
in any zone at any time of day: on
devSQL 0 has an empty duration and App Duration is 0,and the test fails; with the change SQL 0 = 119903 ms and App Duration = 133857 ms.
QualificationNoSparkSuite, "the undated current db event log is dated after every rolledfile": asserts
getDBEventLogFileDate("eventlog")directly.QualificationNoSparkSuite: 48 tests pass with the change, the two new ones fail without it.ApplicationInfoSuitepasses. Scalastyle clean.