From 9957577cc8c82a1c90b44d00e92e34de69470f32 Mon Sep 17 00:00:00 2001 From: Felipe Oliveira Carvalho Date: Thu, 4 Jan 2024 17:21:30 -0300 Subject: [PATCH] Nest second kContainerNotFound check --- cpp/src/arrow/filesystem/azurefs.cc | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/cpp/src/arrow/filesystem/azurefs.cc b/cpp/src/arrow/filesystem/azurefs.cc index 4f3953045561c..3c18399eb6426 100644 --- a/cpp/src/arrow/filesystem/azurefs.cc +++ b/cpp/src/arrow/filesystem/azurefs.cc @@ -1781,13 +1781,13 @@ Status AzureFileSystem::CreateDir(const std::string& path, bool recursive) { RETURN_NOT_OK(CreateContainerIfNotExists(location.container, container_client)); // Perform a second check for HNS support after creating the container. ARROW_ASSIGN_OR_RAISE(hns_support, impl_->HierarchicalNamespaceSupport(adlfs_client)); - } - if (hns_support == HNSSupport::kContainerNotFound) { - // We only get kContainerNotFound if we are unable to read the properties of the - // container we just created. This is very unlikely, but theoretically possible in - // a concurrent system, so the error is handled to avoid infinite recursion. - return Status::IOError("Unable to read properties of a newly created container: ", - location.container, ": " + container_client.GetUrl()); + if (hns_support == HNSSupport::kContainerNotFound) { + // We only get kContainerNotFound if we are unable to read the properties of the + // container we just created. This is very unlikely, but theoretically possible in + // a concurrent system, so the error is handled to avoid infinite recursion. + return Status::IOError("Unable to read properties of a newly created container: ", + location.container, ": " + container_client.GetUrl()); + } } // CreateDirOnFileSystem and CreateDirOnContainer can handle the container // not existing which is useful and necessary here since the only reason