This is an automated email from the ASF dual-hosted git repository.
dataroaring pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/master by this push:
new 9f93df5a3c8 [fix](cast) fix implicit casts in disk_info (#53552)
9f93df5a3c8 is described below
commit 9f93df5a3c871aabbc2f7e4d5ea841b634472b5a
Author: Kaijie Chen <[email protected]>
AuthorDate: Wed Jul 23 21:07:04 2025 +0800
[fix](cast) fix implicit casts in disk_info (#53552)
---
be/src/util/disk_info.cpp | 7 ++++++-
be/src/util/disk_info.h | 7 ++++++-
2 files changed, 12 insertions(+), 2 deletions(-)
diff --git a/be/src/util/disk_info.cpp b/be/src/util/disk_info.cpp
index 23aeb1bdf74..13c039635a7 100644
--- a/be/src/util/disk_info.cpp
+++ b/be/src/util/disk_info.cpp
@@ -36,10 +36,13 @@
#include <memory>
#include <utility>
+#include "common/cast_set.h"
#include "io/fs/local_file_system.h"
namespace doris {
+#include "common/compile_check_begin.h"
+
bool DiskInfo::_s_initialized;
std::vector<DiskInfo::Disk> DiskInfo::_s_disks;
std::map<dev_t, int> DiskInfo::_s_device_id_to_disk_id;
@@ -87,7 +90,7 @@ void DiskInfo::get_device_names() {
if (it == _s_disk_name_to_disk_id.end()) {
// First time seeing this disk
- disk_id = _s_disks.size();
+ disk_id = cast_set<int>(_s_disks.size());
_s_disks.push_back(Disk(name, disk_id));
_s_disk_name_to_disk_id[name] = disk_id;
} else {
@@ -232,4 +235,6 @@ Status DiskInfo::get_disk_devices(const
std::vector<std::string>& paths,
return status;
}
+#include "common/compile_check_end.h"
+
} // namespace doris
diff --git a/be/src/util/disk_info.h b/be/src/util/disk_info.h
index f415cb958d3..6ff5711541c 100644
--- a/be/src/util/disk_info.h
+++ b/be/src/util/disk_info.h
@@ -24,11 +24,14 @@
#include <string>
#include <vector>
+#include "common/cast_set.h"
#include "common/logging.h"
#include "common/status.h"
namespace doris {
+#include "common/compile_check_begin.h"
+
// DiskInfo is an interface to query for the disk information at runtime. This
// contains information about the system as well as the specific data node
// configuration.
@@ -42,7 +45,7 @@ public:
// Returns the number of (logical) disks on the system
static int num_disks() {
DCHECK(_s_initialized);
- return _s_disks.size();
+ return cast_set<int>(_s_disks.size());
}
// Returns the 0-based disk index for 'path' (path must be a FS path, not
@@ -102,4 +105,6 @@ private:
static void get_device_names();
};
+#include "common/compile_check_end.h"
+
} // namespace doris
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]