yuqi1129 commented on code in PR #9282:
URL: https://github.com/apache/gravitino/pull/9282#discussion_r2591543020
##########
catalogs/catalog-fileset/src/test/java/org/apache/gravitino/catalog/fileset/TestFilesetCatalogOperations.java:
##########
@@ -1868,6 +1874,42 @@ public void testGetTargetLocation() throws IOException {
}
}
+ @Test
+ @Timeout(15)
+ void testGetFileSystemTimeoutThrowsException() throws Exception {
+ FieldUtils.writeField(
+ GravitinoEnv.getInstance(), "entityStore", new
RelationalEntityStore(), true);
+
+ try (FilesetCatalogOperations filesetCatalogOperations = new
FilesetCatalogOperations()) {
+ LocalFileSystemProvider localFileSystemProvider =
Mockito.mock(LocalFileSystemProvider.class);
+ when(localFileSystemProvider.scheme()).thenReturn("file");
+ when(localFileSystemProvider.getFileSystem(Mockito.any(Path.class),
Mockito.anyMap()))
+ .thenAnswer(
+ invocation -> {
+ // Block 100s, however, the timeout is set to 6s by default in
+ // FilesetCatalogOperations, so it's expected to be over
within 10s
+ Awaitility.await().forever().until(() -> false);
+ return new LocalFileSystem();
+ });
+ Map<String, FileSystemProvider> fileSystemProviderMapOriginal = new
HashMap<>();
+ fileSystemProviderMapOriginal.put("file", localFileSystemProvider);
+ FieldUtils.writeField(
+ filesetCatalogOperations, "fileSystemProvidersMap",
fileSystemProviderMapOriginal, true);
+
+ FieldUtils.writeField(
+ filesetCatalogOperations, "propertiesMetadata",
FILESET_PROPERTIES_METADATA, true);
+
+ // Test the following method should finish with 10s
+ long now = System.currentTimeMillis();
+ try {
+ filesetCatalogOperations.getFileSystem(new Path("file:///tmp"),
ImmutableMap.of());
+ } catch (IOException e) {
+ long timeTake = System.currentTimeMillis() - now;
+ Assertions.assertTrue(timeTake <= 10000);
Review Comment:
I have used annotation `Timeout(15)` to replace it.
##########
catalogs/hadoop-common/src/main/java/org/apache/gravitino/catalog/hadoop/fs/HDFSFileSystemProvider.java:
##########
@@ -48,4 +55,29 @@ public String scheme() {
public String name() {
return BUILTIN_HDFS_FS_PROVIDER;
}
+
+ /**
+ * Add additional HDFS specific configurations.
+ *
+ * @param configs Original configurations.
+ * @return Configurations with additional HDFS specific configurations.
+ */
+ private Map<String, String> additionalHDFSConfig(Map<String, String>
configs) {
+ Map<String, String> additionalConfigs = Maps.newHashMap(configs);
+
+ // Avoid multiple retries to speed up failure in test cases.
+ // Use hard code instead of
CommonConfigurationKeysPublic.IPC_CLIENT_CONNECT_TIMEOUT_KEY to
+ // avoid dependency on a specific Hadoop version.
+ if (!configs.containsKey(HDFS_IPC_CLIENT_CONNECT_TIMEOUT_KEY)) {
+ additionalConfigs.put(HDFS_IPC_CLIENT_CONNECT_TIMEOUT_KEY,
DEFAULT_CONNECTION_TIMEOUT);
+ }
+
+ if (!configs.containsKey(HDFS_IPC_PING_KEY)) {
+ additionalConfigs.put(HDFS_IPC_PING_KEY, "true");
Review Comment:
changed
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]