Skip to content

Commit 9a6bcd5

Browse files
committed
[fix](be) Scope filesystem error-code imports to their functions
### What problem does this PR solve? Issue Number: None Related PR: apache#67292 Problem Summary: With ENABLE_PCH=OFF and unity builds enabled, the IO unity translation unit includes err_utils.cpp before file_meta_cache.cpp. The namespace-scope ErrorCode using-directive then makes LIMIT_REACH ambiguous when the latter includes the generated protobuf enum. Move the using-directive into the two localfs_error overloads that need it, preserving the existing error-code mappings while preventing it from affecting sibling source files. ### Release note None ### Check List (For Author) - Test: Manual test. Reproduced the original ENABLE_PCH=OFF compile failure with ./build.sh --be -j100; build-support/clang-format.sh, build-support/check-format.sh, build-support/check-build-hygiene.sh, and git diff --check passed. Post-fix BE compilation is tracked in the compilation-only Draft PR. - Behavior changed: No - Does this need documentation: No
1 parent 7ccfb97 commit 9a6bcd5

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

‎be/src/io/fs/err_utils.cpp‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,6 @@
2828
#include "io/fs/hdfs.h"
2929

3030
namespace doris {
31-
using namespace ErrorCode;
32-
3331
namespace io {
3432

3533
namespace {
@@ -86,6 +84,7 @@ std::string glob_err_to_str(int code) {
8684
}
8785

8886
Status localfs_error(const std::error_code& ec, std::string_view msg) {
87+
using namespace ErrorCode;
8988
auto message = fmt::format("{}: {}", msg, ec.message());
9089
if (ec == std::errc::io_error) {
9190
return Status::Error<IO_ERROR, false>(message);
@@ -105,6 +104,7 @@ Status localfs_error(const std::error_code& ec, std::string_view msg) {
105104
}
106105

107106
Status localfs_error(int posix_errno, std::string_view msg) {
107+
using namespace ErrorCode;
108108
auto message = fmt::format("{}: {}", msg, errno_message(posix_errno));
109109
switch (posix_errno) {
110110
case EIO:

0 commit comments

Comments
 (0)