Skip to content

Commit

Permalink
download job related fix (#4754)
Browse files Browse the repository at this point in the history
  • Loading branch information
critical27 authored and Sophie-Xie committed Oct 20, 2022
1 parent 3f69f27 commit da23f87
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/common/hdfs/HdfsCommandHelper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ Status HdfsCommandHelper::ls(const std::string& hdfsHost,
folly::Subprocess proc(std::vector<std::string>({"/bin/bash", "-c", command}));
auto result = proc.wait();
if (!result.exited()) {
LOG(INFO) << "Failed to ls: " << result.str();
return Status::Error("Failed to ls hdfs");
} else if (result.exitStatus() != 0) {
LOG(INFO) << "Failed to ls: " << result.str();
Expand All @@ -49,6 +50,7 @@ Status HdfsCommandHelper::copyToLocal(const std::string& hdfsHost,
folly::Subprocess proc(std::vector<std::string>({"/bin/bash", "-c", command}));
auto result = proc.wait();
if (!result.exited()) {
LOG(INFO) << "Failed to download: " << result.str();
return Status::Error("Failed to download from hdfs");
} else if (result.exitStatus() != 0) {
LOG(INFO) << "Failed to download: " << result.str();
Expand Down
3 changes: 3 additions & 0 deletions src/kvstore/RocksEngine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -438,6 +438,9 @@ int32_t RocksEngine::totalPartsNum() {

nebula::cpp2::ErrorCode RocksEngine::ingest(const std::vector<std::string>& files,
bool verifyFileChecksum) {
if (files.empty()) {
return nebula::cpp2::ErrorCode::SUCCEEDED;
}
rocksdb::IngestExternalFileOptions options;
options.move_files = FLAGS_move_files;
options.verify_file_checksum = verifyFileChecksum;
Expand Down
2 changes: 2 additions & 0 deletions src/kvstore/test/RocksEngineTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,8 @@ TEST_P(RocksEngineTest, IngestTest) {
EXPECT_EQ(nebula::cpp2::ErrorCode::SUCCEEDED, engine->get("key_empty", &result));
EXPECT_EQ("", result);
EXPECT_EQ(nebula::cpp2::ErrorCode::E_KEY_NOT_FOUND, engine->get("key_not_exist", &result));

EXPECT_EQ(nebula::cpp2::ErrorCode::SUCCEEDED, engine->ingest({}));
}

TEST_P(RocksEngineTest, BackupRestoreTable) {
Expand Down
7 changes: 7 additions & 0 deletions src/storage/admin/DownloadTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,13 @@ nebula::cpp2::ErrorCode DownloadTask::subTask(GraphSpaceID space, PartitionID pa
}
}

auto listResult = helper_->ls(hdfsHost_, hdfsPort_, hdfsPartPath);
if (!listResult.ok()) {
LOG(INFO) << "Can't found data of space: " << space << ", part: " << part
<< ", just skip the part";
return nebula::cpp2::ErrorCode::SUCCEEDED;
}

auto result = helper_->copyToLocal(hdfsHost_, hdfsPort_, hdfsPartPath, localPath);
return result.ok() ? nebula::cpp2::ErrorCode::SUCCEEDED
: nebula::cpp2::ErrorCode::E_TASK_EXECUTION_FAILED;
Expand Down

0 comments on commit da23f87

Please sign in to comment.