Skip to content

Commit cce5a6f

Browse files
HDFS-15385 Upgrade boost library to 1.72 (#2051)
* Removed the asio-1.10.2 that was checked in under libhdfspp/third_party directory.
1 parent 317fe45 commit cce5a6f

File tree

451 files changed

+326
-87303
lines changed

Some content is hidden

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

451 files changed

+326
-87303
lines changed

BUILDING.txt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ Requirements:
66
* Unix System
77
* JDK 1.8
88
* Maven 3.3 or later
9+
* Boost 1.72 (if compiling native code)
910
* Protocol Buffers 3.7.1 (if compiling native code)
1011
* CMake 3.1 or newer (if compiling native code)
1112
* Zlib devel (if compiling native code)
@@ -72,6 +73,12 @@ Installing required packages for clean install of Ubuntu 14.04 LTS Desktop:
7273
&& ./configure\
7374
&& make install \
7475
&& rm -rf /opt/protobuf-3.7-src
76+
* Boost
77+
$ 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 \
78+
&& tar --bzip2 -xf boost_1_72_0.tar.bz2 \
79+
&& cd boost_1_72_0 \
80+
&& ./bootstrap.sh --prefix=/usr/ \
81+
&& ./b2 --without-python install
7582

7683
Optional packages:
7784

@@ -468,6 +475,7 @@ Requirements:
468475
* Windows System
469476
* JDK 1.8
470477
* Maven 3.0 or later
478+
* Boost 1.72
471479
* Protocol Buffers 3.7.1
472480
* CMake 3.1 or newer
473481
* Visual Studio 2010 Professional or Higher

dev-support/docker/Dockerfile

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,21 @@ ENV MAVEN_HOME /usr
9292
ENV JAVA_HOME /usr/lib/jvm/java-8-openjdk-amd64
9393
ENV FINDBUGS_HOME /usr
9494

95+
#######
96+
# Install Boost 1.72 (1.65 ships with Bionic)
97+
#######
98+
# hadolint ignore=DL3003
99+
RUN mkdir -p /opt/boost-library \
100+
&& 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 \
101+
&& mv boost_1_72_0.tar.bz2 /opt/boost-library \
102+
&& cd /opt/boost-library \
103+
&& tar --bzip2 -xf boost_1_72_0.tar.bz2 \
104+
&& cd /opt/boost-library/boost_1_72_0 \
105+
&& ./bootstrap.sh --prefix=/usr/ \
106+
&& ./b2 --without-python install \
107+
&& cd /root \
108+
&& rm -rf /opt/boost-library
109+
95110
######
96111
# Install Google Protobuf 3.7.1 (3.0.0 ships with Bionic)
97112
######

dev-support/docker/Dockerfile_aarch64

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,21 @@ ENV MAVEN_HOME /usr
9595
ENV JAVA_HOME /usr/lib/jvm/java-8-openjdk-arm64
9696
ENV FINDBUGS_HOME /usr
9797

98+
#######
99+
# Install Boost 1.72 (1.65 ships with Bionic)
100+
#######
101+
# hadolint ignore=DL3003
102+
RUN mkdir -p /opt/boost-library \
103+
&& 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 \
104+
&& mv boost_1_72_0.tar.bz2 /opt/boost-library \
105+
&& cd /opt/boost-library \
106+
&& tar --bzip2 -xf boost_1_72_0.tar.bz2 \
107+
&& cd /opt/boost-library/boost_1_72_0 \
108+
&& ./bootstrap.sh --prefix=/usr/ \
109+
&& ./b2 --without-python install \
110+
&& cd /root \
111+
&& rm -rf /opt/boost-library
112+
98113
######
99114
# Install Google Protobuf 3.7.1 (3.0.0 ships with Bionic)
100115
######

hadoop-hdfs-project/hadoop-hdfs-native-client/src/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818

1919
cmake_minimum_required(VERSION 3.1 FATAL_ERROR)
2020

21+
project(hadoop_hdfs_native_client)
22+
2123
enable_testing()
2224

2325
list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/../../../hadoop-common-project/hadoop-common)

hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfspp/CMakeLists.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ project (libhdfspp)
2828

2929
cmake_minimum_required(VERSION 2.8)
3030

31+
find_package (Boost 1.72.0 REQUIRED)
32+
3133
enable_testing()
3234
include (CTest)
3335

@@ -220,7 +222,7 @@ include_directories(
220222

221223
include_directories( SYSTEM
222224
${PROJECT_BINARY_DIR}/lib/proto
223-
third_party/asio-1.10.2/include
225+
${Boost_INCLUDE_DIRS}
224226
third_party/rapidxml-1.13
225227
third_party/gmock-1.7.0
226228
third_party/tr2

hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfspp/include/hdfspp/ioservice.h

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,7 @@
6161
#include <functional>
6262
#include <memory>
6363

64-
// forward decl
65-
namespace asio {
66-
class io_service;
67-
}
64+
#include <boost/asio/io_service.hpp>
6865

6966
namespace hdfs {
7067

@@ -133,7 +130,7 @@ class IoService : public std::enable_shared_from_this<IoService>
133130
* Access underlying io_service object. Only to be used in asio library calls.
134131
* After HDFS-11884 is complete only tests should need direct access to the asio::io_service.
135132
**/
136-
virtual asio::io_service& GetRaw() = 0;
133+
virtual boost::asio::io_service& GetRaw() = 0;
137134
};
138135

139136

hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfspp/lib/common/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ if(NEED_LINK_DL)
1919
set(LIB_DL dl)
2020
endif()
2121

22+
include_directories(${Boost_INCLUDE_DIRS} ../../include)
2223
add_library(common_obj OBJECT status.cc sasl_digest_md5.cc ioservice_impl.cc options.cc configuration.cc configuration_loader.cc hdfs_configuration.cc uri.cc util.cc retry_policy.cc cancel_tracker.cc logging.cc libhdfs_events_impl.cc auth_info.cc namenode_info.cc statinfo.cc fsinfo.cc content_summary.cc locks.cc config_parser.cc)
2324
add_library(common $<TARGET_OBJECTS:common_obj> $<TARGET_OBJECTS:uriparser2_obj>)
2425
target_link_libraries(common ${LIB_DL})

hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfspp/lib/common/async_stream.h

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,17 @@
1919
#ifndef LIB_COMMON_ASYNC_STREAM_H_
2020
#define LIB_COMMON_ASYNC_STREAM_H_
2121

22-
#include <asio/buffer.hpp>
23-
#include <asio/error_code.hpp>
22+
#include <boost/asio/buffer.hpp>
23+
#include <boost/system/error_code.hpp>
24+
#include <boost/asio/system_executor.hpp>
25+
2426
#include <functional>
2527

2628
namespace hdfs {
2729

2830
// Contiguous buffer types
29-
typedef asio::mutable_buffers_1 MutableBuffer;
30-
typedef asio::const_buffers_1 ConstBuffer;
31+
typedef boost::asio::mutable_buffers_1 MutableBuffer;
32+
typedef boost::asio::const_buffers_1 ConstBuffer;
3133

3234
/*
3335
* asio-compatible stream implementation.
@@ -38,13 +40,20 @@ typedef asio::const_buffers_1 ConstBuffer;
3840
*/
3941
class AsyncStream {
4042
public:
43+
using executor_type = boost::asio::system_executor;
44+
executor_type executor_;
45+
4146
virtual void async_read_some(const MutableBuffer &buf,
42-
std::function<void (const asio::error_code & error,
47+
std::function<void (const boost::system::error_code & error,
4348
std::size_t bytes_transferred) > handler) = 0;
4449

4550
virtual void async_write_some(const ConstBuffer &buf,
46-
std::function<void (const asio::error_code & error,
51+
std::function<void (const boost::system::error_code & error,
4752
std::size_t bytes_transferred) > handler) = 0;
53+
54+
executor_type get_executor() {
55+
return executor_;
56+
}
4857
};
4958

5059
}

hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfspp/lib/common/continuation/asio.h

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,10 @@
2121
#include "continuation.h"
2222
#include "common/util.h"
2323
#include "hdfspp/status.h"
24-
#include <asio/write.hpp>
24+
25+
#include <boost/asio/write.hpp>
26+
#include <boost/system/error_code.hpp>
27+
2528
#include <memory>
2629

2730
namespace hdfs {
@@ -37,8 +40,8 @@ class WriteContinuation : public Continuation {
3740

3841
virtual void Run(const Next &next) override {
3942
auto handler =
40-
[next](const asio::error_code &ec, size_t) { next(ToStatus(ec)); };
41-
asio::async_write(*stream_, buffer_, handler);
43+
[next](const boost::system::error_code &ec, size_t) { next(ToStatus(ec)); };
44+
boost::asio::async_write(*stream_, buffer_, handler);
4245
}
4346

4447
private:

hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfspp/lib/common/continuation/protobuf.h

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,10 @@
2020

2121
#include "common/util.h"
2222

23-
#include <asio/read.hpp>
24-
23+
#include <boost/asio/read.hpp>
24+
#include <boost/asio/write.hpp>
25+
#include <boost/asio/buffer.hpp>
26+
#include <boost/system/error_code.hpp>
2527
#include <google/protobuf/message_lite.h>
2628
#include <google/protobuf/io/coded_stream.h>
2729
#include <google/protobuf/io/zero_copy_stream_impl_lite.h>
@@ -39,7 +41,7 @@ struct ReadDelimitedPBMessageContinuation : public Continuation {
3941

4042
virtual void Run(const Next &next) override {
4143
namespace pbio = google::protobuf::io;
42-
auto handler = [this, next](const asio::error_code &ec, size_t) {
44+
auto handler = [this, next](const boost::system::error_code &ec, size_t) {
4345
Status status;
4446
if (ec) {
4547
status = ToStatus(ec);
@@ -57,15 +59,15 @@ struct ReadDelimitedPBMessageContinuation : public Continuation {
5759
}
5860
next(status);
5961
};
60-
asio::async_read(*stream_,
61-
asio::buffer(buf_),
62+
boost::asio::async_read(*stream_,
63+
boost::asio::buffer(buf_),
6264
std::bind(&ReadDelimitedPBMessageContinuation::CompletionHandler, this,
6365
std::placeholders::_1, std::placeholders::_2),
6466
handler);
6567
}
6668

6769
private:
68-
size_t CompletionHandler(const asio::error_code &ec, size_t transferred) {
70+
size_t CompletionHandler(const boost::system::error_code &ec, size_t transferred) {
6971
if (ec) {
7072
return 0;
7173
}
@@ -103,7 +105,7 @@ struct WriteDelimitedPBMessageContinuation : Continuation {
103105
return;
104106
}
105107

106-
asio::async_write(*stream_, asio::buffer(buf_), [next](const asio::error_code &ec, size_t) { next(ToStatus(ec)); } );
108+
boost::asio::async_write(*stream_, boost::asio::buffer(buf_), [next](const boost::system::error_code &ec, size_t) { next(ToStatus(ec)); } );
107109
}
108110

109111
private:

0 commit comments

Comments
 (0)