Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

download job related fix #4754

Merged
merged 1 commit into from
Oct 20, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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();
Copy link
Contributor

@SuperYoko SuperYoko Oct 20, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here download error will failed this job too? Will them generate empty directories?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, if download occurs error we should fail it. (Exchange will not generate empty dir, if it indeed generate empty dir, ingest will handle it)

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