File tree Expand file tree Collapse file tree 5 files changed +34
-7
lines changed
hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs
hadoop-tools/hadoop-aws/src/test
java/org/apache/hadoop/fs/s3a Expand file tree Collapse file tree 5 files changed +34
-7
lines changed Original file line number Diff line number Diff line change @@ -480,13 +480,13 @@ public class CommonConfigurationKeys extends CommonConfigurationKeysPublic {
480480 * Thread-level IOStats Support.
481481 * {@value}
482482 */
483- public static final String THREAD_LEVEL_IOSTATISTICS_ENABLED =
484- "fs.thread.level.iostatistics .enabled" ;
483+ public static final String IOSTATISTICS_THREAD_LEVEL_ENABLED =
484+ "fs.iostatistics. thread.level.enabled" ;
485485
486486 /**
487487 * Default value for Thread-level IOStats Support is true.
488488 */
489- public static final boolean THREAD_LEVEL_IOSTATISTICS_ENABLED_DEFAULT =
489+ public static final boolean IOSTATISTICS_THREAD_LEVEL_ENABLED_DEFAULT =
490490 true ;
491491
492492}
Original file line number Diff line number Diff line change @@ -80,4 +80,14 @@ static void setThreadIOStatisticsContext(
8080 IOStatisticsContextIntegration .setThreadIOStatisticsContext (
8181 statisticsContext );
8282 }
83+
84+ /**
85+ * Static probe to check if the thread-level IO statistics enabled.
86+ *
87+ * @return if the thread-level IO statistics enabled.
88+ */
89+ static boolean enabled () {
90+ return IOStatisticsContextIntegration .isIOStatisticsThreadLevelEnabled ();
91+ }
92+
8393}
Original file line number Diff line number Diff line change 2929import org .apache .hadoop .fs .impl .WeakReferenceThreadMap ;
3030import org .apache .hadoop .fs .statistics .IOStatisticsContext ;
3131
32- import static org .apache .hadoop .fs .CommonConfigurationKeys .THREAD_LEVEL_IOSTATISTICS_ENABLED ;
33- import static org .apache .hadoop .fs .CommonConfigurationKeys .THREAD_LEVEL_IOSTATISTICS_ENABLED_DEFAULT ;
32+ import static org .apache .hadoop .fs .CommonConfigurationKeys .IOSTATISTICS_THREAD_LEVEL_ENABLED ;
33+ import static org .apache .hadoop .fs .CommonConfigurationKeys .IOSTATISTICS_THREAD_LEVEL_ENABLED_DEFAULT ;
3434
3535/**
3636 * A Utility class for IOStatisticsContext, which helps in creating and
@@ -76,8 +76,17 @@ public final class IOStatisticsContextIntegration {
7676 // Work out if the current context has thread level IOStatistics enabled.
7777 final Configuration configuration = new Configuration ();
7878 isThreadIOStatsEnabled =
79- configuration .getBoolean (THREAD_LEVEL_IOSTATISTICS_ENABLED ,
80- THREAD_LEVEL_IOSTATISTICS_ENABLED_DEFAULT );
79+ configuration .getBoolean (IOSTATISTICS_THREAD_LEVEL_ENABLED ,
80+ IOSTATISTICS_THREAD_LEVEL_ENABLED_DEFAULT );
81+ }
82+
83+ /**
84+ * Static probe to check if the thread-level IO statistics enabled.
85+ *
86+ * @return if the thread-level IO statistics enabled.
87+ */
88+ public static boolean isIOStatisticsThreadLevelEnabled () {
89+ return isThreadIOStatsEnabled ;
8190 }
8291
8392 /**
Original file line number Diff line number Diff line change @@ -153,6 +153,8 @@ public void testS3AInputStreamIOStatisticsContext()
153153 * @return thread context
154154 */
155155 private static IOStatisticsContext getAndResetThreadStatisticsContext () {
156+ assertTrue ("thread-level IOStatistics should be enabled by default" ,
157+ IOStatisticsContext .enabled ());
156158 IOStatisticsContext context =
157159 IOStatisticsContext .getCurrentIOStatisticsContext ();
158160 context .reset ();
Original file line number Diff line number Diff line change 178178 <value >true</value >
179179 </property >
180180
181+ <!-- Enable IOStatisticsContext support for Thread level. -->
182+ <property >
183+ <name >fs.iostatistics.thread.level.enabled</name >
184+ <value >true</value >
185+ </property >
186+
181187 <!--
182188 To run these tests.
183189
You can’t perform that action at this time.
0 commit comments