Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
ceph
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
certo
ceph
Commits
34845ee4
Commit
34845ee4
authored
Jun 29, 2019
by
Vladimir Bashkirtsev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed RGW sync: we should check for abnormal download
parent
fec49b99
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
91 additions
and
0 deletions
+91
-0
Makefile
Makefile
+1
-0
ceph-14.2.1-fix_rgw_sync.patch
ceph-14.2.1-fix_rgw_sync.patch
+90
-0
No files found.
Makefile
View file @
34845ee4
...
@@ -32,6 +32,7 @@ all: ceph-config
...
@@ -32,6 +32,7 @@ all: ceph-config
tar
xf
ceph-14.2.1.tar.gz
tar
xf
ceph-14.2.1.tar.gz
patch
-Np1
-d
ceph-14.2.1
<
ceph-14.2.1-fix_tests.patch
patch
-Np1
-d
ceph-14.2.1
<
ceph-14.2.1-fix_tests.patch
patch
-Np1
-d
ceph-14.2.1
<
ceph-14.2.1-fix_rgw_sync.patch
cd
ceph-14.2.1
&&
./do_cmake.sh
-DCMAKE_BUILD_TYPE
=
Release
-DCMAKE_INSTALL_PREFIX
=
/usr
-DCMAKE_INSTALL_SYSCONFDIR
=
/etc
-DCMAKE_INSTALL_LIBEXECDIR
=
/lib
-DWITH_SPDK
=
OFF
-DWITH_RDMA
=
OFF
-DWITH_RADOSGW_AMQP_ENDPOINT
=
OFF
cd
ceph-14.2.1
&&
./do_cmake.sh
-DCMAKE_BUILD_TYPE
=
Release
-DCMAKE_INSTALL_PREFIX
=
/usr
-DCMAKE_INSTALL_SYSCONFDIR
=
/etc
-DCMAKE_INSTALL_LIBEXECDIR
=
/lib
-DWITH_SPDK
=
OFF
-DWITH_RDMA
=
OFF
-DWITH_RADOSGW_AMQP_ENDPOINT
=
OFF
$(MAKE)
-C
ceph-14.2.1/build
npm_config_cache
=
/build/.npm
$(MAKE)
-C
ceph-14.2.1/build
npm_config_cache
=
/build/.npm
hostname
localhost
hostname
localhost
...
...
ceph-14.2.1-fix_rgw_sync.patch
0 → 100644
View file @
34845ee4
diff -uNr ceph-14.2.1/src/rgw/rgw_http_client.cc ceph-14.2.1-fix_rgw_sync/src/rgw/rgw_http_client.cc
--- ceph-14.2.1/src/rgw/rgw_http_client.cc 2019-04-26 03:45:48.000000000 +0930
+++ ceph-14.2.1-fix_rgw_sync/src/rgw/rgw_http_client.cc 2019-06-29 14:10:43.430981168 +0930
@@ -1141,7 +1141,8 @@
curl_easy_getinfo(e, CURLINFO_RESPONSE_CODE, (void **)&http_status);
int status = rgw_http_error_to_errno(http_status);
- if (result != CURLE_OK && http_status == 0) {
+ if (result != CURLE_OK && status == 0) {
+ dout(0) << "ERROR: curl error: " << curl_easy_strerror((CURLcode)result) << ", maybe network unstable" << dendl;
status = -EAGAIN;
}
int id = req_data->id;
diff -uNr ceph-14.2.1/src/rgw/rgw_rados.cc ceph-14.2.1-fix_rgw_sync/src/rgw/rgw_rados.cc
--- ceph-14.2.1/src/rgw/rgw_rados.cc 2019-04-26 03:45:48.000000000 +0930
+++ ceph-14.2.1-fix_rgw_sync/src/rgw/rgw_rados.cc 2019-06-29 14:08:41.470629630 +0930
@@ -4374,6 +4374,7 @@
string etag;
real_time set_mtime;
+ uint64_t expected_size = 0;
RGWObjState *dest_state = NULL;
@@ -4408,7 +4409,8 @@
goto set_err_state;
}
- ret = conn->complete_request(in_stream_req, &etag, &set_mtime, nullptr, nullptr, nullptr);
+ ret = conn->complete_request(in_stream_req, &etag, &set_mtime,
+ &expected_size, nullptr, nullptr);
if (ret < 0) {
goto set_err_state;
}
@@ -4416,6 +4418,12 @@
if (ret < 0) {
goto set_err_state;
}
+ if (cb.get_data_len() != expected_size) {
+ ret = -EIO;
+ ldout(cct, 0) << "ERROR: object truncated during fetching, expected "
+ << expected_size << " bytes but received " << cb.get_data_len() << dendl;
+ goto set_err_state;
+ }
if (compressor && compressor->is_compressed()) {
bufferlist tmp;
RGWCompressionInfo cs_info;
diff -uNr ceph-14.2.1/src/test/rgw/test_http_manager.cc ceph-14.2.1-fix_rgw_sync/src/test/rgw/test_http_manager.cc
--- ceph-14.2.1/src/test/rgw/test_http_manager.cc 2019-04-26 03:45:48.000000000 +0930
+++ ceph-14.2.1-fix_rgw_sync/src/test/rgw/test_http_manager.cc 2019-06-29 14:11:56.499191779 +0930
@@ -16,8 +16,39 @@
#include "global/global_init.h"
#include "common/ceph_argparse.h"
#include <curl/curl.h>
+#include <boost/asio/ip/tcp.hpp>
+#include <boost/asio/write.hpp>
+#include <thread>
#include <gtest/gtest.h>
+TEST(HTTPManager, ReadTruncated)
+{
+ using tcp = boost::asio::ip::tcp;
+ tcp::endpoint endpoint(tcp::v4(), 0);
+ boost::asio::io_context ioctx;
+ tcp::acceptor acceptor(ioctx);
+ acceptor.open(endpoint.protocol());
+ acceptor.bind(endpoint);
+ acceptor.listen();
+
+ std::thread server{[&] {
+ tcp::socket socket{ioctx};
+ acceptor.accept(socket);
+ std::string_view response =
+ "HTTP/1.1 200 OK\r\n"
+ "Content-Length: 1024\r\n"
+ "\r\n"
+ "short body";
+ boost::asio::write(socket, boost::asio::buffer(response));
+ }};
+ const auto url = std::string{"http://127.0.0.1:"} + std::to_string(acceptor.local_endpoint().port());
+
+ RGWHTTPClient client{g_ceph_context, "GET", url};
+ EXPECT_EQ(-EAGAIN, RGWHTTP::process(&client, null_yield));
+
+ server.join();
+}
+
TEST(HTTPManager, SignalThread)
{
auto cct = g_ceph_context;
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment