Uh oh!
There was an error while loading. Please reload this page.
[fix](be) fix disk metrics staying empty on LVM/device-mapper mounts - #67536
Open
sinhaparth5 wants to merge 1 commit into
Open
[fix](be) fix disk metrics staying empty on LVM/device-mapper mounts#67536sinhaparth5 wants to merge 1 commit into
sinhaparth5 wants to merge 1 commit into
Conversation
DiskInfo::get_disk_devices() matched a mount's device against the table get_device_names() builds from /proc/partitions by comparing basenames with trailing digits stripped (sda2 -> sda). For an LVM mount, /proc/mounts lists the device as /dev/mapper/<vg-lv>, which never matches the dm-N name /proc/partitions uses. The match always failed, so no disk metrics were installed for that mount. Resolve the device with stat() instead and match on its real dev_t (major:minor) against _s_device_id_to_disk_id, the table get_device_names() already keys by dev_t for exactly this purpose. Also stop stripping trailing digits from dm-N names: for device-mapper, the number identifies a distinct logical volume, not a partition of one shared disk, so dm-0 and dm-1 were collapsing into a single bogus "dm-" entry. Added be/test/util/disk_info_test.cpp for the extracted strip_partition_suffix helper. Fixesapache#62365
hello-stephen
commented
Sep 4, 2026
Contributor
Thank you for your contribution to Apache Doris. Please clearly describe your PR:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for freeto join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What problem does this PR solve?
Issue Number: close#62365
Problem Summary:
BE disk metrics come back empty when a data dir sits on an LVM (device-mapper) volume.
DiskInfo::get_disk_devices()inbe/src/util/disk_info.cpplooks up a mount's device by comparing basenames: it takes the device column from/proc/mounts, strips trailing digits (sda2->sda), and checks that name against the tableget_device_names()built from/proc/partitions. For an LVM mount,/proc/mountsshows/dev/mapper/<vg-lv>, which never matches thedm-Nname/proc/partitionsuses, so the lookup always fails and no per-disk metrics get installed for that mount.get_device_names()already builds_s_device_id_to_disk_id, a table keyed by the device's realdev_t(major:minor), for exactly this kind of lookup.get_disk_devices()just wasn't using it. This PR resolves the mount's device withstat()and matches onst_rdevagainst that table instead of comparing names.Also stopped trimming trailing digits off
dm-Nnames inget_device_names(). For a regular disk the digits mark a partition (sda1,sda2are bothsda), but for device-mapper the number identifies a distinct logical volume, not a partition, sodm-0anddm-1were being collapsed into one bogusdm-entry.Added
be/test/util/disk_info_test.cppcovering the extractedDiskInfo::strip_partition_suffixhelper.Release note
None
Check List (For Author)
Manual test: hand-traced the
/proc/mounts//proc/partitionsparsing against a real LVM layout (/dev/mapper/vg-lv0mounted, backed bydm-0) to confirm the newstat()-based match resolves correctly, plus the new unit test forstrip_partition_suffix. Also running the BE unit test build on a separate box to confirmDiskInfoTest.*passes; will update this PR when that finishes.Behavior changed:
Does this need documentation?