Skip to content

Commit da23f87

Browse files
critical27Sophie-Xie
authored andcommitted
download job related fix (#4754)
1 parent 3f69f27 commit da23f87

File tree

4 files changed

+14
-0
lines changed

4 files changed

+14
-0
lines changed

src/common/hdfs/HdfsCommandHelper.cpp

+2
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ Status HdfsCommandHelper::ls(const std::string& hdfsHost,
2323
folly::Subprocess proc(std::vector<std::string>({"/bin/bash", "-c", command}));
2424
auto result = proc.wait();
2525
if (!result.exited()) {
26+
LOG(INFO) << "Failed to ls: " << result.str();
2627
return Status::Error("Failed to ls hdfs");
2728
} else if (result.exitStatus() != 0) {
2829
LOG(INFO) << "Failed to ls: " << result.str();
@@ -49,6 +50,7 @@ Status HdfsCommandHelper::copyToLocal(const std::string& hdfsHost,
4950
folly::Subprocess proc(std::vector<std::string>({"/bin/bash", "-c", command}));
5051
auto result = proc.wait();
5152
if (!result.exited()) {
53+
LOG(INFO) << "Failed to download: " << result.str();
5254
return Status::Error("Failed to download from hdfs");
5355
} else if (result.exitStatus() != 0) {
5456
LOG(INFO) << "Failed to download: " << result.str();

src/kvstore/RocksEngine.cpp

+3
Original file line numberDiff line numberDiff line change
@@ -438,6 +438,9 @@ int32_t RocksEngine::totalPartsNum() {
438438

439439
nebula::cpp2::ErrorCode RocksEngine::ingest(const std::vector<std::string>& files,
440440
bool verifyFileChecksum) {
441+
if (files.empty()) {
442+
return nebula::cpp2::ErrorCode::SUCCEEDED;
443+
}
441444
rocksdb::IngestExternalFileOptions options;
442445
options.move_files = FLAGS_move_files;
443446
options.verify_file_checksum = verifyFileChecksum;

src/kvstore/test/RocksEngineTest.cpp

+2
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,8 @@ TEST_P(RocksEngineTest, IngestTest) {
225225
EXPECT_EQ(nebula::cpp2::ErrorCode::SUCCEEDED, engine->get("key_empty", &result));
226226
EXPECT_EQ("", result);
227227
EXPECT_EQ(nebula::cpp2::ErrorCode::E_KEY_NOT_FOUND, engine->get("key_not_exist", &result));
228+
229+
EXPECT_EQ(nebula::cpp2::ErrorCode::SUCCEEDED, engine->ingest({}));
228230
}
229231

230232
TEST_P(RocksEngineTest, BackupRestoreTable) {

src/storage/admin/DownloadTask.cpp

+7
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,13 @@ nebula::cpp2::ErrorCode DownloadTask::subTask(GraphSpaceID space, PartitionID pa
5050
}
5151
}
5252

53+
auto listResult = helper_->ls(hdfsHost_, hdfsPort_, hdfsPartPath);
54+
if (!listResult.ok()) {
55+
LOG(INFO) << "Can't found data of space: " << space << ", part: " << part
56+
<< ", just skip the part";
57+
return nebula::cpp2::ErrorCode::SUCCEEDED;
58+
}
59+
5360
auto result = helper_->copyToLocal(hdfsHost_, hdfsPort_, hdfsPartPath, localPath);
5461
return result.ok() ? nebula::cpp2::ErrorCode::SUCCEEDED
5562
: nebula::cpp2::ErrorCode::E_TASK_EXECUTION_FAILED;

0 commit comments

Comments
 (0)