Skip to content

Commit fa85d82

Browse files
authored
Merge branch 'apache:trunk' into YARN-11262-PART4
2 parents 61c3874 + 65f6567 commit fa85d82

File tree

67 files changed

+927
-1263
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

67 files changed

+927
-1263
lines changed

BUILDING.txt

+7-7
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Requirements:
66
* Unix System
77
* JDK 1.8
88
* Maven 3.3 or later
9-
* Boost 1.72 (if compiling native code)
9+
* Boost 1.86.0 (if compiling native code)
1010
* Protocol Buffers 3.21.12 (if compiling native code)
1111
* CMake 3.19 or newer (if compiling native code)
1212
* Zlib devel (if compiling native code)
@@ -82,8 +82,8 @@ Refer to dev-support/docker/Dockerfile):
8282
$ make -j$(nproc)
8383
$ sudo make install
8484
* Boost
85-
$ curl -L https://sourceforge.net/projects/boost/files/boost/1.72.0/boost_1_72_0.tar.bz2/download > boost_1_72_0.tar.bz2
86-
$ tar --bzip2 -xf boost_1_72_0.tar.bz2 && cd boost_1_72_0
85+
$ curl -L https://sourceforge.net/projects/boost/files/boost/1.86.0/boost_1_86_0.tar.bz2/download > boost_1_86_0.tar.bz2
86+
$ tar --bzip2 -xf boost_1_86_0.tar.bz2 && cd boost_1_86_0
8787
$ ./bootstrap.sh --prefix=/usr/
8888
$ ./b2 --without-python
8989
$ sudo ./b2 --without-python install
@@ -493,9 +493,9 @@ Building on CentOS 8
493493
$ sudo make install
494494

495495
* Install boost.
496-
$ curl -L -o boost_1_72_0.tar.bz2 https://sourceforge.net/projects/boost/files/boost/1.72.0/boost_1_72_0.tar.bz2/download
497-
$ tar xjf boost_1_72_0.tar.bz2
498-
$ cd boost_1_72_0
496+
$ curl -L -o boost_1_86_0.tar.bz2 https://sourceforge.net/projects/boost/files/boost/1.86.0/boost_1_86_0.tar.bz2/download
497+
$ tar xjf boost_1_86_0.tar.bz2
498+
$ cd boost_1_86_0
499499
$ ./bootstrap.sh --prefix=/usr/local
500500
$ ./b2
501501
$ sudo ./b2 install
@@ -526,7 +526,7 @@ Requirements:
526526
* Windows 10
527527
* JDK 1.8
528528
* Maven 3.0 or later (maven.apache.org)
529-
* Boost 1.72 (boost.org)
529+
* Boost 1.86.0 (boost.org)
530530
* Protocol Buffers 3.21.12 (https://github.com/protocolbuffers/protobuf/tags)
531531
* CMake 3.19 or newer (cmake.org)
532532
* Visual Studio 2019 (visualstudio.com)

dev-support/docker/pkg-resolver/install-boost.sh

+7-7
Original file line numberDiff line numberDiff line change
@@ -27,25 +27,25 @@ if [ $? -eq 1 ]; then
2727
exit 1
2828
fi
2929

30-
default_version="1.72.0"
30+
default_version="1.86.0"
3131
version_to_install=$default_version
3232
if [ -n "$2" ]; then
3333
version_to_install="$2"
3434
fi
3535

36-
if [ "$version_to_install" != "1.72.0" ]; then
36+
if [ "$version_to_install" != "1.86.0" ]; then
3737
echo "WARN: Don't know how to install version $version_to_install, installing the default version $default_version instead"
3838
version_to_install=$default_version
3939
fi
4040

41-
if [ "$version_to_install" == "1.72.0" ]; then
41+
if [ "$version_to_install" == "1.86.0" ]; then
4242
# hadolint ignore=DL3003
4343
mkdir -p /opt/boost-library &&
44-
curl -L https://sourceforge.net/projects/boost/files/boost/1.72.0/boost_1_72_0.tar.bz2/download >boost_1_72_0.tar.bz2 &&
45-
mv boost_1_72_0.tar.bz2 /opt/boost-library &&
44+
curl -L https://sourceforge.net/projects/boost/files/boost/1.86.0/boost_1_86_0.tar.bz2/download >boost_1_86_0.tar.bz2 &&
45+
mv boost_1_86_0.tar.bz2 /opt/boost-library &&
4646
cd /opt/boost-library &&
47-
tar --bzip2 -xf boost_1_72_0.tar.bz2 &&
48-
cd /opt/boost-library/boost_1_72_0 &&
47+
tar --bzip2 -xf boost_1_86_0.tar.bz2 &&
48+
cd /opt/boost-library/boost_1_86_0 &&
4949
./bootstrap.sh --prefix=/usr/ &&
5050
./b2 --without-python install &&
5151
cd /root &&

hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/ipc/Client.java

+21-4
Original file line numberDiff line numberDiff line change
@@ -202,9 +202,24 @@ public static Object getExternalHandler() {
202202
private final boolean fallbackAllowed;
203203
private final boolean bindToWildCardAddress;
204204
private final byte[] clientId;
205-
private final int maxAsyncCalls;
205+
private int maxAsyncCalls;
206206
private final AtomicInteger asyncCallCounter = new AtomicInteger(0);
207207

208+
@VisibleForTesting
209+
public int getAsyncCallCounter() {
210+
return asyncCallCounter.get();
211+
}
212+
213+
@VisibleForTesting
214+
public void setMaxAsyncCalls(int limits) {
215+
this.maxAsyncCalls = limits;
216+
}
217+
218+
@VisibleForTesting
219+
public boolean isAsyncCallCheckEabled() {
220+
return maxAsyncCalls >= 0;
221+
}
222+
208223
/**
209224
* set the ping interval value in configuration
210225
*
@@ -1460,7 +1475,7 @@ public Writable call(RPC.RpcKind rpcKind, Writable rpcRequest,
14601475
}
14611476

14621477
private void checkAsyncCall() throws IOException {
1463-
if (isAsynchronousMode()) {
1478+
if (isAsynchronousMode() && isAsyncCallCheckEabled()) {
14641479
if (asyncCallCounter.incrementAndGet() > maxAsyncCalls) {
14651480
String errMsg = String.format(
14661481
"Exceeded limit of max asynchronous calls: %d, " +
@@ -1518,7 +1533,7 @@ Writable call(RPC.RpcKind rpcKind, Writable rpcRequest,
15181533
throw ioe;
15191534
}
15201535
} catch (Exception e) {
1521-
if (isAsynchronousMode()) {
1536+
if (isAsynchronousMode() && isAsyncCallCheckEabled()) {
15221537
releaseAsyncCall();
15231538
}
15241539
throw e;
@@ -1527,7 +1542,9 @@ Writable call(RPC.RpcKind rpcKind, Writable rpcRequest,
15271542
if (isAsynchronousMode()) {
15281543
CompletableFuture<Writable> result = call.rpcResponseFuture.handle(
15291544
(rpcResponse, e) -> {
1530-
releaseAsyncCall();
1545+
if (isAsyncCallCheckEabled()) {
1546+
releaseAsyncCall();
1547+
}
15311548
if (e != null) {
15321549
IOException ioe = (IOException) e;
15331550
throw new CompletionException(warpIOException(ioe, connection));

hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/util/RunJar.java

+62-10
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,17 @@
2727
import java.net.MalformedURLException;
2828
import java.net.URL;
2929
import java.net.URLClassLoader;
30+
import java.nio.file.FileSystems;
3031
import java.nio.file.Files;
32+
import java.nio.file.attribute.AclEntry;
33+
import java.nio.file.attribute.AclEntryPermission;
3134
import java.nio.file.attribute.FileAttribute;
32-
import java.nio.file.attribute.PosixFilePermission;
3335
import java.nio.file.attribute.PosixFilePermissions;
36+
import java.nio.file.attribute.UserPrincipal;
3437
import java.util.ArrayList;
3538
import java.util.Arrays;
39+
import java.util.Collections;
40+
import java.util.EnumSet;
3641
import java.util.Enumeration;
3742
import java.util.List;
3843
import java.util.Set;
@@ -51,6 +56,10 @@
5156
import org.slf4j.Logger;
5257
import org.slf4j.LoggerFactory;
5358

59+
import static java.nio.file.attribute.AclEntryFlag.DIRECTORY_INHERIT;
60+
import static java.nio.file.attribute.AclEntryFlag.FILE_INHERIT;
61+
import static java.nio.file.attribute.AclEntryType.ALLOW;
62+
5463
/** Run a Hadoop job jar. */
5564
@InterfaceAudience.Private
5665
@InterfaceStability.Unstable
@@ -286,25 +295,19 @@ public void run(String[] args) throws Throwable {
286295
}
287296
mainClassName = mainClassName.replaceAll("/", ".");
288297

289-
File tmpDir = new File(System.getProperty("java.io.tmpdir"));
290-
ensureDirectory(tmpDir);
291-
292298
final File workDir;
293299
try {
294-
FileAttribute<Set<PosixFilePermission>> perms = PosixFilePermissions
295-
.asFileAttribute(PosixFilePermissions.fromString("rwx------"));
296-
workDir = Files.createTempDirectory(tmpDir.toPath(), "hadoop-unjar", perms).toFile();
300+
workDir = createWorkDirectory();
297301
} catch (IOException | SecurityException e) {
298302
// If user has insufficient perms to write to tmpDir, default
299303
// "Permission denied" message doesn't specify a filename.
300304
System.err.println("Error creating temp dir in java.io.tmpdir "
301-
+ tmpDir + " due to " + e.getMessage());
305+
+ System.getProperty("java.io.tmpdir") + " due to "
306+
+ e.getMessage());
302307
System.exit(-1);
303308
return;
304309
}
305310

306-
ensureDirectory(workDir);
307-
308311
ShutdownHookManager.get().addShutdownHook(
309312
new Runnable() {
310313
@Override
@@ -333,6 +336,55 @@ public void run() {
333336
}
334337
}
335338

339+
static File createWorkDirectory() throws IOException {
340+
File tmpDir = new File(System.getProperty("java.io.tmpdir"));
341+
ensureDirectory(tmpDir);
342+
343+
File workDir = Files.createTempDirectory(tmpDir.toPath(), "hadoop-unjar",
344+
directoryPermissions()).toFile();
345+
ensureDirectory(workDir);
346+
return workDir;
347+
}
348+
349+
private static FileAttribute<?> directoryPermissions() throws IOException {
350+
Set<String> views = FileSystems.getDefault().supportedFileAttributeViews();
351+
if (views.contains("posix")) {
352+
return PosixFilePermissions
353+
.asFileAttribute(PosixFilePermissions.fromString("rwx------"));
354+
} else if (views.contains("acl")) {
355+
return userOnly();
356+
} else {
357+
throw new IOException("unrecognized FileSystem type " +
358+
FileSystems.getDefault());
359+
}
360+
}
361+
362+
private static FileAttribute<?> userOnly() throws IOException {
363+
UserPrincipal user =
364+
FileSystems.getDefault()
365+
.getUserPrincipalLookupService()
366+
.lookupPrincipalByName(System.getProperty("user.name"));
367+
List<AclEntry> acl =
368+
Collections.singletonList(AclEntry.newBuilder()
369+
.setType(ALLOW)
370+
.setPrincipal(user)
371+
.setPermissions(EnumSet.allOf(AclEntryPermission.class))
372+
.setFlags(DIRECTORY_INHERIT, FILE_INHERIT)
373+
.build());
374+
return
375+
new FileAttribute<List<AclEntry>>() {
376+
@Override
377+
public String name() {
378+
return "acl:acl";
379+
}
380+
381+
@Override
382+
public List<AclEntry> value() {
383+
return acl;
384+
}
385+
};
386+
}
387+
336388
/**
337389
* Creates a classloader based on the environment that was specified by the
338390
* user. If HADOOP_USE_CLIENT_CLASSLOADER is specified, it creates an

hadoop-common-project/hadoop-common/src/main/resources/core-default.xml

+1
Original file line numberDiff line numberDiff line change
@@ -2409,6 +2409,7 @@ The switch to turn S3A auditing on or off.
24092409
<value>100</value>
24102410
<description>
24112411
Define the maximum number of outstanding async calls.
2412+
If negative, there is no limit on the number of outstanding async calls.
24122413
</description>
24132414
</property>
24142415

0 commit comments

Comments
 (0)