22
22
23
23
import org .apache .hadoop .conf .Configuration ;
24
24
import org .apache .hadoop .fs .Path ;
25
+ import org .apache .hadoop .fs .s3a .S3AFileSystem ;
26
+ import org .apache .hadoop .fs .s3a .S3ATestUtils ;
25
27
import org .apache .hadoop .fs .s3a .performance .AbstractS3ACostTest ;
26
28
27
29
import static org .apache .hadoop .fs .s3a .Constants .FS_S3A_CREATE_PERFORMANCE ;
30
+ import static org .apache .hadoop .fs .s3a .Constants .FS_S3A_PERFORMANCE_FLAGS ;
31
+ import static org .apache .hadoop .fs .s3a .Constants .S3EXPRESS_CREATE_SESSION ;
32
+ import static org .apache .hadoop .fs .s3a .S3ATestUtils .setPerformanceFlags ;
28
33
import static org .apache .hadoop .fs .s3a .Statistic .STORE_IO_REQUEST ;
34
+ import static org .apache .hadoop .fs .s3a .impl .S3ExpressStorage .STORE_CAPABILITY_S3_EXPRESS_STORAGE ;
29
35
30
36
/**
31
37
* Verify that AWS SDK statistics are wired up.
@@ -35,7 +41,10 @@ public class ITestAWSStatisticCollection extends AbstractS3ACostTest {
35
41
@ Override
36
42
public Configuration createConfiguration () {
37
43
final Configuration conf = super .createConfiguration ();
38
- conf .setBoolean (FS_S3A_CREATE_PERFORMANCE , true );
44
+ S3ATestUtils .removeBaseAndBucketOverrides (conf ,
45
+ S3EXPRESS_CREATE_SESSION );
46
+ setPerformanceFlags (conf , "create" );
47
+ conf .setBoolean (S3EXPRESS_CREATE_SESSION , false );
39
48
return conf ;
40
49
}
41
50
@@ -44,8 +53,11 @@ public void testSDKMetricsCostOfGetFileStatusOnFile() throws Throwable {
44
53
describe ("performing getFileStatus on a file" );
45
54
Path simpleFile = file (methodPath ());
46
55
// and repeat on the file looking at AWS wired up stats
47
- verifyMetrics (() -> getFileSystem ().getFileStatus (simpleFile ),
48
- with (STORE_IO_REQUEST , 1 ));
56
+ final S3AFileSystem fs = getFileSystem ();
57
+ verifyMetrics (() -> fs .getFileStatus (simpleFile ),
58
+ with (STORE_IO_REQUEST ,
59
+ fs .hasPathCapability (new Path ("/" ), STORE_CAPABILITY_S3_EXPRESS_STORAGE )
60
+ ? 2 : 1 ));
49
61
}
50
62
51
63
}
0 commit comments