| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
parsePoolObjsetFile located the dataset name by searching the whole input
line for the third whitespace-separated field:
datasetName = line[strings.Index(line, parts[2]):]
For a root dataset whose name also appears inside the "dataset_name" field
name, strings.Index matches that prefix instead of the value column, so the
label ends up holding the entire input line. A pool called "data" exports:
node_zfs_zpool_dataset_nwritten{dataset="dataset_name 7 data",...}
Skip past the field name and type columns before taking the remainder, which
cannot match inside the prefix. The remainder is kept verbatim rather than
re-joining the split fields, so dataset names containing runs of whitespace
stay byte-exact as the existing pool3 fixture requires.
Signed-off-by: 霏承 <huangleshu.hls@alibaba-inc.com>
|
Darwin e2e is the only red one and I don't think it's this change — zfs is Linux-only, there's no darwin collector, and the darwin fixture has no node_zfs lines at all, so nothing in the diff gets compiled or read there. Seems to be failing on other branches too while master hasn't moved. |
Sorry, something went wrong.
|
#3768 got here first with the same root cause and the same approach, though it's still a draft. Mine adds the colliding-pool fixtures and regenerates both e2e outputs, which #3768 doesn't touch yet — happy to hand those over there and close this, or leave it to @SuperQ to pick. |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
Fixes #3761
parsePoolObjsetFile finds the dataset name by searching the whole kstat line for the third whitespace-separated field:
When a root dataset's name also occurs inside the dataset_name field name, strings.Index matches that prefix instead of the value column and the label ends up holding the entire input line. For a pool called data:
node_zfs_zpool_dataset_nwritten{dataset="dataset_name 7 data",zpool="data"} 0Child datasets were unaffected because e.g. data/vm-1101-disk-0 doesn't occur in the prefix, which is why this only shows up on the pool root.
The fix walks past the field name and type columns first, then takes the remainder. Those columns come from strings.Fields, so they're non-whitespace tokens and can't match inside the leading separator — the value offset is unambiguous.
I deliberately didn't use strings.Join(parts[2:], " ") as suggested in the issue. Fields collapses runs of whitespace, so re-joining with a single space would rewrite the existing pool3/dataset with space fixture to one space and silently corrupt label values for datasets that really do contain consecutive spaces. Keeping the remainder verbatim preserves them byte-for-byte.
Added a data pool fixture reproducing the collision (root plus a child dataset), extended TestZpoolObjsetParsingWithSpace, and regenerated both e2e outputs.
Fixes #3761