Skip to content

Commit 71c8148

Browse files
committed
2 parents fa95fcf + ff6600c commit 71c8148

File tree

5 files changed

+63
-5
lines changed

5 files changed

+63
-5
lines changed

dev-support/docker/Dockerfile_windows_10

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ RUN powershell Invoke-WebRequest -URI https://cdn.azul.com/zulu/bin/zulu8.62.0.1
6262
RUN powershell Expand-Archive -Path $Env:TEMP\zulu8.62.0.19-ca-jdk8.0.332-win_x64.zip -DestinationPath "C:\Java"
6363

6464
# Install Apache Maven.
65-
RUN powershell Invoke-WebRequest -URI https://downloads.apache.org/maven/maven-3/3.8.8/binaries/apache-maven-3.8.8-bin.zip -OutFile $Env:TEMP\apache-maven-3.8.8-bin.zip
65+
RUN powershell Invoke-WebRequest -URI https://archive.apache.org/dist/maven/maven-3/3.8.8/binaries/apache-maven-3.8.8-bin.zip -OutFile $Env:TEMP\apache-maven-3.8.8-bin.zip
6666
RUN powershell Expand-Archive -Path $Env:TEMP\apache-maven-3.8.8-bin.zip -DestinationPath "C:\Maven"
6767

6868
# Install CMake 3.19.0.

hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/Path.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,14 @@ public Path(String scheme, String authority, String path) {
258258
private void initialize(String scheme, String authority, String path,
259259
String fragment) {
260260
try {
261-
this.uri = new URI(scheme, authority, normalizePath(scheme, path), null, fragment)
261+
// Normalize the path
262+
String normalizedPath = normalizePath(scheme, path);
263+
264+
// Windows-specific fix: file URIs must start with "/"
265+
if ("file".equalsIgnoreCase(scheme) && normalizedPath.matches("^[A-Za-z]:.*")) {
266+
normalizedPath = "/" + normalizedPath.replace("\\", "/");
267+
}
268+
this.uri = new URI(scheme, authority, normalizedPath, null, fragment)
262269
.normalize();
263270
} catch (URISyntaxException e) {
264271
throw new IllegalArgumentException(e);

hadoop-tools/hadoop-azure/src/main/java/org/apache/hadoop/fs/azurebfs/services/AbfsClient.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,7 @@
128128
import static org.apache.hadoop.fs.azurebfs.constants.AbfsHttpConstants.SEMICOLON;
129129
import static org.apache.hadoop.fs.azurebfs.constants.AbfsHttpConstants.SINGLE_WHITE_SPACE;
130130
import static org.apache.hadoop.fs.azurebfs.constants.AbfsHttpConstants.UTF_8;
131+
import static org.apache.hadoop.fs.azurebfs.constants.AbfsServiceType.BLOB;
131132
import static org.apache.hadoop.fs.azurebfs.constants.ConfigurationKeys.FS_AZURE_IDENTITY_TRANSFORM_CLASS;
132133
import static org.apache.hadoop.fs.azurebfs.constants.FileSystemConfigurations.DEFAULT_DELETE_CONSIDERED_IDEMPOTENT;
133134
import static org.apache.hadoop.fs.azurebfs.constants.FileSystemConfigurations.ONE_MB;
@@ -153,6 +154,7 @@ public abstract class AbfsClient implements Closeable {
153154
public static final Logger LOG = LoggerFactory.getLogger(AbfsClient.class);
154155
public static final String HUNDRED_CONTINUE_USER_AGENT = SINGLE_WHITE_SPACE + HUNDRED_CONTINUE + SEMICOLON;
155156
public static final String ABFS_CLIENT_TIMER_THREAD_NAME = "abfs-timer-client";
157+
public static final String FNS_BLOB_USER_AGENT_IDENTIFIER = "FNS";
156158

157159
private final URL baseUrl;
158160
private final SharedKeyCredentials sharedKeyCredentials;
@@ -1319,6 +1321,14 @@ String initializeUserAgent(final AbfsConfiguration abfsConfiguration,
13191321
sb.append(FORWARD_SLASH);
13201322
sb.append(abfsConfiguration.getClusterType());
13211323

1324+
// Add a unique identifier in FNS-Blob user agent string
1325+
if (!getIsNamespaceEnabled()
1326+
&& abfsConfiguration.getFsConfiguredServiceType() == BLOB) {
1327+
sb.append(SEMICOLON)
1328+
.append(SINGLE_WHITE_SPACE)
1329+
.append(FNS_BLOB_USER_AGENT_IDENTIFIER);
1330+
}
1331+
13221332
sb.append(")");
13231333

13241334
appendIfNotEmpty(sb, abfsConfiguration.getCustomUserAgentPrefix(), false);

hadoop-tools/hadoop-azure/src/test/java/org/apache/hadoop/fs/azurebfs/services/ITestAbfsClient.java

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@ public final class ITestAbfsClient extends AbstractAbfsIntegrationTest {
106106

107107
private static final String ACCOUNT_NAME = "bogusAccountName.dfs.core.windows.net";
108108
private static final String FS_AZURE_USER_AGENT_PREFIX = "Partner Service";
109+
private static final String FNS_BLOB_USER_AGENT_IDENTIFIER = "FNS";
109110
private static final String HUNDRED_CONTINUE_USER_AGENT = SINGLE_WHITE_SPACE + HUNDRED_CONTINUE + SEMICOLON;
110111
private static final String TEST_PATH = "/testfile";
111112
public static final int REDUCED_RETRY_COUNT = 2;
@@ -355,6 +356,42 @@ public void verifyUserAgentClusterType() throws Exception {
355356
.contains(DEFAULT_VALUE_UNKNOWN);
356357
}
357358

359+
@Test
360+
// Test to verify the unique identifier in user agent string for FNS-Blob accounts
361+
public void verifyUserAgentForFNSBlob() throws Exception {
362+
assumeHnsDisabled();
363+
assumeBlobServiceType();
364+
final AzureBlobFileSystem fs = getFileSystem();
365+
final AbfsConfiguration configuration = fs.getAbfsStore()
366+
.getAbfsConfiguration();
367+
368+
String userAgentStr = getUserAgentString(configuration, false);
369+
verifyBasicInfo(userAgentStr);
370+
Assertions.assertThat(userAgentStr)
371+
.describedAs(
372+
"User-Agent string for FNS accounts on Blob endpoint should contain "
373+
+ FNS_BLOB_USER_AGENT_IDENTIFIER)
374+
.contains(FNS_BLOB_USER_AGENT_IDENTIFIER);
375+
}
376+
377+
@Test
378+
// Test to verify that the user agent string for non-FNS-Blob accounts
379+
// does not contain the FNS identifier.
380+
public void verifyUserAgentForDFS() throws Exception {
381+
assumeDfsServiceType();
382+
final AzureBlobFileSystem fs = getFileSystem();
383+
final AbfsConfiguration configuration = fs.getAbfsStore()
384+
.getAbfsConfiguration();
385+
386+
String userAgentStr = getUserAgentString(configuration, false);
387+
verifyBasicInfo(userAgentStr);
388+
Assertions.assertThat(userAgentStr)
389+
.describedAs(
390+
"User-Agent string for non-FNS-Blob accounts should not contain"
391+
+ FNS_BLOB_USER_AGENT_IDENTIFIER)
392+
.doesNotContain(FNS_BLOB_USER_AGENT_IDENTIFIER);
393+
}
394+
358395
public static AbfsClient createTestClientFromCurrentContext(
359396
AbfsClient baseAbfsClientInstance,
360397
AbfsConfiguration abfsConfig) throws IOException, URISyntaxException {

hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/fair/converter/FSConfigConverterTestCommons.java

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
import java.io.IOException;
2828
import java.io.PrintStream;
2929
import java.io.PrintWriter;
30+
import java.util.UUID;
3031

3132
import static org.junit.jupiter.api.Assertions.assertTrue;
3233

@@ -43,8 +44,7 @@ public class FSConfigConverterTestCommons {
4344
new File(TEST_DIR, "test-yarn-site.xml").getAbsolutePath();
4445
public final static String CONVERSION_RULES_FILE =
4546
new File(TEST_DIR, "test-conversion-rules.properties").getAbsolutePath();
46-
public final static String OUTPUT_DIR =
47-
new File(TEST_DIR, "conversion-output").getAbsolutePath();
47+
public static String OUTPUT_DIR;
4848

4949
private final ByteArrayOutputStream outContent = new ByteArrayOutputStream();
5050
private final ByteArrayOutputStream errContent = new ByteArrayOutputStream();
@@ -57,7 +57,11 @@ public FSConfigConverterTestCommons() {
5757
}
5858

5959
public void setUp() throws IOException {
60-
File d = new File(TEST_DIR, "conversion-output");
60+
String uuid = UUID.randomUUID().toString().trim();
61+
OUTPUT_DIR =
62+
new File(TEST_DIR, "conversion-output" + uuid).getAbsolutePath();
63+
File d = new File(TEST_DIR, "conversion-output" + uuid);
64+
6165
if (d.exists()) {
6266
FileUtils.deleteDirectory(d);
6367
}

0 commit comments

Comments
 (0)