This is an automated email from the ASF dual-hosted git repository.
morningman pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/master by this push:
new 805c13aaa1 [fix](backup) fix backup restore raise `Storage backend not
initialized.` error (#11736)
805c13aaa1 is described below
commit 805c13aaa1204a24aa31f5a63f73a678d5e7d3f1
Author: Zhengguo Yang <[email protected]>
AuthorDate: Mon Aug 15 13:24:38 2022 +0800
[fix](backup) fix backup restore raise `Storage backend not initialized.`
error (#11736)
fix backup restore raise Storage backend not initialized. error
---
be/src/agent/task_worker_pool.cpp | 30 ++++++++++--------------------
be/src/runtime/snapshot_loader.cpp | 20 ++++----------------
be/src/runtime/snapshot_loader.h | 2 --
3 files changed, 14 insertions(+), 38 deletions(-)
diff --git a/be/src/agent/task_worker_pool.cpp
b/be/src/agent/task_worker_pool.cpp
index deb39a3a51..f63e9abb25 100644
--- a/be/src/agent/task_worker_pool.cpp
+++ b/be/src/agent/task_worker_pool.cpp
@@ -1296,16 +1296,11 @@ void TaskWorkerPool::_upload_worker_thread_callback() {
<< ", job id:" << upload_request.job_id;
std::map<int64_t, std::vector<std::string>> tablet_files;
- std::unique_ptr<SnapshotLoader> loader = nullptr;
- if (upload_request.__isset.storage_backend) {
- loader.reset(new SnapshotLoader(_env, upload_request.job_id,
agent_task_req.signature,
- upload_request.broker_prop,
- upload_request.storage_backend));
- } else {
- loader.reset(new SnapshotLoader(_env, upload_request.job_id,
agent_task_req.signature,
- upload_request.broker_addr,
- upload_request.broker_prop));
- }
+ std::unique_ptr<SnapshotLoader> loader =
std::make_unique<SnapshotLoader>(
+ _env, upload_request.job_id, agent_task_req.signature,
upload_request.broker_addr,
+ upload_request.broker_prop,
+ upload_request.__isset.storage_backend ?
upload_request.storage_backend
+ :
TStorageBackendType::type::BROKER);
Status status = loader->upload(upload_request.src_dest_map,
&tablet_files);
TStatusCode::type status_code = TStatusCode::OK;
@@ -1363,16 +1358,11 @@ void TaskWorkerPool::_download_worker_thread_callback()
{
// TODO: download
std::vector<int64_t> downloaded_tablet_ids;
- std::unique_ptr<SnapshotLoader> loader = nullptr;
- if (download_request.__isset.storage_backend) {
- loader.reset(new SnapshotLoader(_env, download_request.job_id,
agent_task_req.signature,
- download_request.broker_prop,
- download_request.storage_backend));
- } else {
- loader.reset(new SnapshotLoader(_env, download_request.job_id,
agent_task_req.signature,
- download_request.broker_addr,
- download_request.broker_prop));
- }
+ std::unique_ptr<SnapshotLoader> loader =
std::make_unique<SnapshotLoader>(
+ _env, download_request.job_id, agent_task_req.signature,
+ download_request.broker_addr, download_request.broker_prop,
+ download_request.__isset.storage_backend ?
download_request.storage_backend
+ :
TStorageBackendType::type::BROKER);
Status status = loader->download(download_request.src_dest_map,
&downloaded_tablet_ids);
if (!status.ok()) {
diff --git a/be/src/runtime/snapshot_loader.cpp
b/be/src/runtime/snapshot_loader.cpp
index 598092d3d8..11c8930d11 100644
--- a/be/src/runtime/snapshot_loader.cpp
+++ b/be/src/runtime/snapshot_loader.cpp
@@ -40,17 +40,6 @@
namespace doris {
-SnapshotLoader::SnapshotLoader(ExecEnv* env, int64_t job_id, int64_t task_id,
- const TNetworkAddress& broker_addr,
- const std::map<std::string, std::string>&
broker_prop)
- : _env(env),
- _job_id(job_id),
- _task_id(task_id),
- _broker_addr(broker_addr),
- _prop(broker_prop) {
- _storage_backend.reset(new BrokerStorageBackend(_env, _broker_addr,
_prop));
-}
-
SnapshotLoader::SnapshotLoader(ExecEnv* env, int64_t job_id, int64_t task_id)
: _env(env),
_job_id(job_id),
@@ -60,17 +49,16 @@ SnapshotLoader::SnapshotLoader(ExecEnv* env, int64_t
job_id, int64_t task_id)
_storage_backend(nullptr) {}
SnapshotLoader::SnapshotLoader(ExecEnv* env, int64_t job_id, int64_t task_id,
+ const TNetworkAddress& broker_addr,
const std::map<std::string, std::string>& prop,
TStorageBackendType::type type)
- : _env(env),
- _job_id(job_id),
- _task_id(task_id),
- _broker_addr(TNetworkAddress()),
- _prop(prop) {
+ : _env(env), _job_id(job_id), _task_id(task_id),
_broker_addr(broker_addr), _prop(prop) {
if (TStorageBackendType::type::S3 == type) {
_storage_backend.reset(new S3StorageBackend(_prop));
} else if (TStorageBackendType::type::HDFS == type) {
_storage_backend.reset(new HDFSStorageBackend(_prop));
+ } else if (TStorageBackendType::type::BROKER == type) {
+ _storage_backend.reset(new BrokerStorageBackend(_env, _broker_addr,
_prop));
} else {
_storage_backend = nullptr;
}
diff --git a/be/src/runtime/snapshot_loader.h b/be/src/runtime/snapshot_loader.h
index 952782f5fc..30eaa9f9f3 100644
--- a/be/src/runtime/snapshot_loader.h
+++ b/be/src/runtime/snapshot_loader.h
@@ -59,8 +59,6 @@ public:
SnapshotLoader(ExecEnv* env, int64_t job_id, int64_t task_id);
SnapshotLoader(ExecEnv* env, int64_t job_id, int64_t task_id,
const TNetworkAddress& broker_addr,
- const std::map<std::string, std::string>& broker_prop);
- SnapshotLoader(ExecEnv* env, int64_t job_id, int64_t task_id,
const std::map<std::string, std::string>& broker_prop,
TStorageBackendType::type type);
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]