Commit a39fc87
committed
[SPARK-39636][CORE][UI] Fix multiple bugs in JsonProtocol, impacting off heap StorageLevels and Task/Executor ResourceRequests
### What changes were proposed in this pull request?
This PR fixes three longstanding bugs in Spark's `JsonProtocol`:
- `TaskResourceRequest` loses precision for `amount` < 0.5. The `amount` is a floating point number which is either between 0 and 0.5 or is a positive integer, but the JSON read path assumes it is an integer.
- `ExecutorResourceRequest` integer overflows for values larger than Int.MaxValue because the write path writes longs but the read path assumes integers.
- Off heap StorageLevels are not handled properly: the `useOffHeap` field isn't included in the JSON, so this StorageLevel cannot be round-tripped through JSON. This could cause the History Server to display inaccurate "off heap memory used" stats on the executors page.
I discovered these bugs while working on #36885.
### Why are the changes needed?
JsonProtocol should be able to roundtrip events through JSON without loss of information.
### Does this PR introduce _any_ user-facing change?
Yes: it fixes bugs that impact information shown in the History Server Web UI. The new StorageLevel JSON field will be visible to tools which process raw event log JSON.
### How was this patch tested?
Updated existing unit tests to cover the changed logic.
Closes #37027 from JoshRosen/jsonprotocol-bugfixes.
Authored-by: Josh Rosen <[email protected]>
Signed-off-by: Josh Rosen <[email protected]>1 parent 91f95a7 commit a39fc87
File tree
2 files changed
+64
-6
lines changed- core/src
- main/scala/org/apache/spark/util
- test/scala/org/apache/spark/util
2 files changed
+64
-6
lines changedLines changed: 14 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
512 | 512 | | |
513 | 513 | | |
514 | 514 | | |
| 515 | + | |
515 | 516 | | |
516 | 517 | | |
517 | 518 | | |
| |||
750 | 751 | | |
751 | 752 | | |
752 | 753 | | |
753 | | - | |
| 754 | + | |
754 | 755 | | |
755 | 756 | | |
756 | 757 | | |
757 | 758 | | |
758 | 759 | | |
759 | 760 | | |
760 | 761 | | |
761 | | - | |
| 762 | + | |
762 | 763 | | |
763 | 764 | | |
764 | 765 | | |
| |||
1202 | 1203 | | |
1203 | 1204 | | |
1204 | 1205 | | |
| 1206 | + | |
| 1207 | + | |
| 1208 | + | |
| 1209 | + | |
| 1210 | + | |
1205 | 1211 | | |
1206 | 1212 | | |
1207 | | - | |
| 1213 | + | |
| 1214 | + | |
| 1215 | + | |
| 1216 | + | |
| 1217 | + | |
| 1218 | + | |
1208 | 1219 | | |
1209 | 1220 | | |
1210 | 1221 | | |
| |||
Lines changed: 50 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
136 | 136 | | |
137 | 137 | | |
138 | 138 | | |
139 | | - | |
140 | | - | |
141 | | - | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
142 | 147 | | |
143 | 148 | | |
144 | 149 | | |
| |||
203 | 208 | | |
204 | 209 | | |
205 | 210 | | |
| 211 | + | |
206 | 212 | | |
207 | 213 | | |
208 | 214 | | |
| |||
319 | 325 | | |
320 | 326 | | |
321 | 327 | | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
322 | 343 | | |
323 | 344 | | |
324 | 345 | | |
| |||
1189 | 1210 | | |
1190 | 1211 | | |
1191 | 1212 | | |
| 1213 | + | |
1192 | 1214 | | |
1193 | 1215 | | |
1194 | 1216 | | |
| |||
1437 | 1459 | | |
1438 | 1460 | | |
1439 | 1461 | | |
| 1462 | + | |
1440 | 1463 | | |
1441 | 1464 | | |
1442 | 1465 | | |
| |||
1563 | 1586 | | |
1564 | 1587 | | |
1565 | 1588 | | |
| 1589 | + | |
1566 | 1590 | | |
1567 | 1591 | | |
1568 | 1592 | | |
| |||
1689 | 1713 | | |
1690 | 1714 | | |
1691 | 1715 | | |
| 1716 | + | |
1692 | 1717 | | |
1693 | 1718 | | |
1694 | 1719 | | |
| |||
1722 | 1747 | | |
1723 | 1748 | | |
1724 | 1749 | | |
| 1750 | + | |
1725 | 1751 | | |
1726 | 1752 | | |
1727 | 1753 | | |
| |||
1769 | 1795 | | |
1770 | 1796 | | |
1771 | 1797 | | |
| 1798 | + | |
1772 | 1799 | | |
1773 | 1800 | | |
1774 | 1801 | | |
| |||
1787 | 1814 | | |
1788 | 1815 | | |
1789 | 1816 | | |
| 1817 | + | |
1790 | 1818 | | |
1791 | 1819 | | |
1792 | 1820 | | |
| |||
1834 | 1862 | | |
1835 | 1863 | | |
1836 | 1864 | | |
| 1865 | + | |
1837 | 1866 | | |
1838 | 1867 | | |
1839 | 1868 | | |
| |||
1852 | 1881 | | |
1853 | 1882 | | |
1854 | 1883 | | |
| 1884 | + | |
1855 | 1885 | | |
1856 | 1886 | | |
1857 | 1887 | | |
| |||
1870 | 1900 | | |
1871 | 1901 | | |
1872 | 1902 | | |
| 1903 | + | |
1873 | 1904 | | |
1874 | 1905 | | |
1875 | 1906 | | |
| |||
1917 | 1948 | | |
1918 | 1949 | | |
1919 | 1950 | | |
| 1951 | + | |
1920 | 1952 | | |
1921 | 1953 | | |
1922 | 1954 | | |
| |||
1935 | 1967 | | |
1936 | 1968 | | |
1937 | 1969 | | |
| 1970 | + | |
1938 | 1971 | | |
1939 | 1972 | | |
1940 | 1973 | | |
| |||
1953 | 1986 | | |
1954 | 1987 | | |
1955 | 1988 | | |
| 1989 | + | |
1956 | 1990 | | |
1957 | 1991 | | |
1958 | 1992 | | |
| |||
1971 | 2005 | | |
1972 | 2006 | | |
1973 | 2007 | | |
| 2008 | + | |
1974 | 2009 | | |
1975 | 2010 | | |
1976 | 2011 | | |
| |||
2291 | 2326 | | |
2292 | 2327 | | |
2293 | 2328 | | |
| 2329 | + | |
2294 | 2330 | | |
2295 | 2331 | | |
2296 | 2332 | | |
| |||
2489 | 2525 | | |
2490 | 2526 | | |
2491 | 2527 | | |
| 2528 | + | |
2492 | 2529 | | |
2493 | 2530 | | |
2494 | 2531 | | |
| |||
2578 | 2615 | | |
2579 | 2616 | | |
2580 | 2617 | | |
| 2618 | + | |
| 2619 | + | |
| 2620 | + | |
| 2621 | + | |
| 2622 | + | |
| 2623 | + | |
2581 | 2624 | | |
2582 | 2625 | | |
2583 | 2626 | | |
| |||
2593 | 2636 | | |
2594 | 2637 | | |
2595 | 2638 | | |
| 2639 | + | |
| 2640 | + | |
| 2641 | + | |
| 2642 | + | |
2596 | 2643 | | |
2597 | 2644 | | |
2598 | 2645 | | |
| |||
0 commit comments