Repository navigation
Commit 42ff11a
committed
CCDB: read std::array objects written by libstdc++ on libc++ builds
Needs review.
The only member of std::array<T,N> is T _M_elems[N] in libstdc++ and
T __elems_[N] in libc++, so the StreamerInfo of an array written on Linux
has a checksum (0x9189320d for array<int,540>) that the macOS class does
not have (0x919bc501). When the file is opened, TStreamerInfo::BuildCheck
(ROOT 6.40.04, "perfect alias" block, since 2014) drops the on-file
StreamerInfo as an alias of the in-memory one, and the read then fails:
Error in <TBufferFile::ReadVersion>: Could not find the StreamerInfo with
a checksum of 0x9189320d for the class "array<int,540>" in name.
Error in <TBufferFile::CheckByteCount>: object of class array<int,540>
read too few bytes: 6 instead of 2166
leaving the array zero-filled. TRD/Calib/DCSDPsFedChamberStatus is such an
object: every chamber looks off, the TRD digitizer writes 0 digits, and on
macOS the full system test has no TRD and no CTF. If the in-memory
StreamerInfo already exists when the file is opened, ROOT registers the
on-file one but cannot map _M_elems, and reads zeros without any error.
Before reading an array<...> object, DataRefUtils::registerLibstdcxxStdArray
registers the on-file layout as a class version of its own, with its member
renamed to the in-memory name, so ROOT finds it by checksum and reads the
T[N] payload, identical in both libraries, as usual. It is called from both
copies of extractFromTFile: CcdbApi (CcdbApi/BasicCCDBManager, DPL CCDB
fetcher) and DataRefUtils (DPL condition inputs).
Everything is inside #if defined(_LIBCPP_VERSION): libstdc++ builds (EPN,
Grid, CI) compile exactly the same code as before.
Verified on macOS 27.2, ROOT 6.40.04-alice:
- BasicCCDBManager read of DCSDPsFedChamberStatus at 1550600800000:
540 zeros before, 521x3 + 19x0 after, the same as decoding the payload
by hand; at 1720000000000: 431x3, 89x4, 2x5, 18x0.
- array<string,540> (TRD/Calib/DCSDPsFedCFGtag): 540 empty strings before,
the real tags after.
- TRD-only o2-sim-digitizer-workflow on the 10-event PbPb FST sample:
0 digits before, 126921 after.
Plain-ROOT reproducer for the ROOT team: ~/src/data/ccdb-stdarray-libcxx-repro.1 parent 92368c4 commit 42ff11a
3 files changed
Lines changed: 53 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
51 | 51 | | |
52 | 52 | | |
53 | 53 | | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
54 | 57 | | |
55 | 58 | | |
56 | 59 | | |
| |||
986 | 989 | | |
987 | 990 | | |
988 | 991 | | |
| 992 | + | |
| 993 | + | |
| 994 | + | |
989 | 995 | | |
990 | 996 | | |
991 | 997 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
34 | 38 | | |
35 | 39 | | |
36 | 40 | | |
| |||
185 | 189 | | |
186 | 190 | | |
187 | 191 | | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
188 | 196 | | |
189 | 197 | | |
190 | 198 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
23 | 28 | | |
24 | 29 | | |
25 | 30 | | |
| |||
31 | 36 | | |
32 | 37 | | |
33 | 38 | | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
34 | 42 | | |
35 | 43 | | |
36 | 44 | | |
| |||
73 | 81 | | |
74 | 82 | | |
75 | 83 | | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
76 | 115 | | |
77 | 116 | | |
78 | 117 | | |
| |||
0 commit comments