提交 6a9236e0 编写于 作者: A Alexey Surkov 提交者: TensorFlower Gardener

Explicilty retry failures of individual deletes in DeleteRecursively.

Otherwise these failuers aren't currently covered by any retry logic.
Change: 150486764
上级 2f46b74c
......@@ -1164,7 +1164,13 @@ Status GcsFileSystem::DeleteRecursively(const string& dirname,
for (const string& object : all_objects) {
const string& full_path = JoinGcsPath(dirname, object);
// Delete all objects including directory markers for subfolders.
if (!DeleteFile(full_path).ok()) {
// Since DeleteRecursively returns OK if individual file deletions fail,
// and therefore RetryingFileSystem won't pay attention to the failures,
// we need to make sure these failures are properly retried.
const auto& delete_file_status = RetryingUtils::DeleteWithRetries(
std::bind(&GcsFileSystem::DeleteFile, this, full_path),
initial_retry_delay_usec_);
if (!delete_file_status.ok()) {
if (IsDirectory(full_path).ok()) {
// The object is a directory marker.
(*undeleted_dirs)++;
......
......@@ -1471,7 +1471,13 @@ TEST(GcsFileSystemTest, DeleteRecursively_Ok) {
"Auth Token: fake_token\n"
"Delete: yes\n",
""),
// Delete the object.
// Delete the object - fails and will be retried.
new FakeHttpRequest("Uri: https://www.googleapis.com/storage/v1/b"
"/bucket/o/path%2Ffile1.txt\n"
"Auth Token: fake_token\n"
"Delete: yes\n",
"", errors::Unavailable("500"), 500),
// Delete the object again.
new FakeHttpRequest("Uri: https://www.googleapis.com/storage/v1/b"
"/bucket/o/path%2Ffile1.txt\n"
"Auth Token: fake_token\n"
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册