Commit eca5a7f
authored
[Spark] InCommitTimestamp: Use clock.currentTimeMillis() instead of nanoTime() in commitLarge (#3111)
## Description
We currently use NANOSECONDS.toMillis(System.nanoTime()) for generating
the ICT when `commitLarge` is called. However, this usage of
System.nanoTime() is not correct as it should only be used for measuring
time difference, not to get an approximate wall clock time. This leads
to scenarios where the ICT becomes very small (e.g. 1 Jan 1970)
sometimes because some systems return a very small number when
System.nanoTime() is called. This PR changes this so that
clock.getCurrentTimeMillis() is used instead.
## How was this patch tested?
Added a test case to ensure that `clock.getCurrentTimeMillis()` is being
used.1 parent e15132b commit eca5a7f
File tree
2 files changed
+41
-2
lines changed- spark/src
- main/scala/org/apache/spark/sql/delta
- test/scala/org/apache/spark/sql/delta
2 files changed
+41
-2
lines changedLines changed: 3 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1337 | 1337 | | |
1338 | 1338 | | |
1339 | 1339 | | |
| 1340 | + | |
1340 | 1341 | | |
1341 | | - | |
| 1342 | + | |
1342 | 1343 | | |
1343 | | - | |
| 1344 | + | |
1344 | 1345 | | |
1345 | 1346 | | |
1346 | 1347 | | |
| |||
Lines changed: 38 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
143 | 143 | | |
144 | 144 | | |
145 | 145 | | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
146 | 184 | | |
147 | 185 | | |
148 | 186 | | |
| |||
0 commit comments