File tree Expand file tree Collapse file tree 2 files changed +12
-2
lines changed
core/src/main/scala/org/apache/spark Expand file tree Collapse file tree 2 files changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -91,6 +91,8 @@ private[spark] class ContextCleaner(
91
91
*/
92
92
private val periodicGCInterval = sc.conf.get(CLEANER_PERIODIC_GC_INTERVAL )
93
93
94
+ private val periodicGCEnabled = sc.conf.get(CLEANER_PERIODIC_GC_ENABLED )
95
+
94
96
/**
95
97
* Whether the cleaning thread will block on cleanup tasks (other than shuffle, which
96
98
* is controlled by the `spark.cleaner.referenceTracking.blocking.shuffle` parameter).
@@ -137,8 +139,10 @@ private[spark] class ContextCleaner(
137
139
cleaningThread.setDaemon(true )
138
140
cleaningThread.setName(" Spark Context Cleaner" )
139
141
cleaningThread.start()
140
- periodicGCService.scheduleAtFixedRate(() => System .gc(),
141
- periodicGCInterval, periodicGCInterval, TimeUnit .SECONDS )
142
+ if (periodicGCEnabled) {
143
+ periodicGCService.scheduleAtFixedRate(() => System .gc(),
144
+ periodicGCInterval, periodicGCInterval, TimeUnit .SECONDS )
145
+ }
142
146
}
143
147
144
148
/**
Original file line number Diff line number Diff line change @@ -1709,6 +1709,12 @@ package object config {
1709
1709
.timeConf(TimeUnit .SECONDS )
1710
1710
.createWithDefaultString(" 30min" )
1711
1711
1712
+ private [spark] val CLEANER_PERIODIC_GC_ENABLED =
1713
+ ConfigBuilder (" spark.cleaner.periodicGC.enabled" )
1714
+ .version(" 3.3.0" )
1715
+ .booleanConf
1716
+ .createWithDefault(true )
1717
+
1712
1718
private [spark] val CLEANER_REFERENCE_TRACKING =
1713
1719
ConfigBuilder (" spark.cleaner.referenceTracking" )
1714
1720
.version(" 1.0.0" )
You can’t perform that action at this time.
0 commit comments