Skip to content

Conversion StreamerInfo not properly found if classes are unversioned. #14491

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
1 task
pcanal opened this issue Jan 30, 2024 · 3 comments
Open
1 task

Conversion StreamerInfo not properly found if classes are unversioned. #14491

pcanal opened this issue Jan 30, 2024 · 3 comments

Comments

@pcanal
Copy link
Member

pcanal commented Jan 30, 2024

Check duplicate issues.

  • Checked for duplicates

Description

When a class is schema evoled (see reproducer) using a renaming rules

At least on line 1258 of StreamerInfoReadBuffer.cxx:

                    subinfo = (TStreamerInfo*)newProxy->GetValueClass()->GetConversionStreamerInfo( oldProxy->GetValueClass(), vClVersion );

is not properly handling the case whether the classes are unversion and thus the search ought to be done using the checksum rather than the class version.

Reproducer

template <typename T>
struct Wrapper
{
   bool present = true;
   T obj;
};

struct MatchedCSCSegment
{
   float someValue = 0.0;

   MatchedCSCSegment(float in = 0.0) : someValue{in} {}

   // The simeple update fails if the class version is not set.
   ClassDef(MatchedCSCSegment, 5);
};

struct CSCSegment
{
   float someValue;

   operator MatchedCSCSegment()
   {
      return MatchedCSCSegment{someValue};
   }

#ifdef OLD_VERSION
   std::vector<CSCSegment> theDuplicateSegments;
   ClassDef(CSCSegment, 3);
#else
   std::vector<MatchedCSCSegment> theDuplicateSegments;

   ClassDef(CSCSegment, 4);
#endif
};

and rule:

#pragma read sourceClass="CSCSegment" targetClass="MatchedCSCSegment"

ROOT version

master

Installation method

any

Operating system

any

Additional context

No response

@pcanal
Copy link
Member Author

pcanal commented Jan 30, 2024

conversionWithChecksum.tgz

contains the full example:

root.exe -b -l -q writedata.C+
root.exe -b -l -q simpleread.C+ 
***********************************
*    Row   * Instance * seg_split *
***********************************
Error in <TBufferFile::CheckByteCount>: object of class vector<CSCSegment> read too few bytes: 4 instead of 24
*        0 *        0 *         0 *
***********************************
Error in <TBufferFile::CheckByteCount>: object of class vector<MatchedCSCSegment> read too few bytes: 12 instead of 24
***********************************
*    Row   * Instance * seg_unspl *
***********************************
Error in <TBufferFile::CheckByteCount>: object of class vector<MatchedCSCSegment> read too few bytes: 12 instead of 24
Error in <TBufferFile::CheckByteCount>: object of class vector<MatchedCSCSegment> read too few bytes: 12 instead of 24
*        0 *        0 *         1 *
***********************************

@ferdymercury
Copy link
Collaborator

Maybe related: https://its.cern.ch/jira/browse/ROOT-5306

@ferdymercury
Copy link
Collaborator

This seems solved in 6.34.02, or at least it does not show the read too few bytes error.

Processing writedata.C+...
Info in <TUnixSystem::ACLiC>: creating shared library /tmp//tmp/conversionWithChecksum/./writedata_C.so
******************************************************************************
*Tree    :t         : t                                                      *
*Entries :        1 : Total =            4649 bytes  File  Size =       1611 *
*        :          : Tree compression factor =   1.02                       *
******************************************************************************
*Branch  :seg_split.                                                         *
*Entries :        1 : BranchElement (see below)                              *
*............................................................................*
*Br    0 :seg_split.present : Bool_t                                         *
*Entries :        1 : Total  Size=        627 bytes  File Size  =         82 *
*Baskets :        1 : Basket Size=      32000 bytes  Compression=   1.00     *
*............................................................................*
*Br    1 :seg_split.obj : Int_t seg_split.obj_                               *
*Entries :        1 : Total  Size=       2486 bytes  File Size  =         93 *
*Baskets :        1 : Basket Size=      32000 bytes  Compression=   1.00     *
*............................................................................*
*Br    2 :seg_split.obj.someValue : Float_t someValue[seg_split.obj_]        *
*Entries :        1 : Total  Size=        764 bytes  File Size  =        103 *
*Baskets :        1 : Basket Size=      32000 bytes  Compression=   1.00     *
*............................................................................*
*Br    3 :seg_split.obj.theDuplicateSegments :                               *
*         | vector<CSCSegment> theDuplicateSegments[seg_split.obj_]          *
*Entries :        1 : Total  Size=        851 bytes  File Size  =        146 *
*Baskets :        1 : Basket Size=      32000 bytes  Compression=   1.00     *
*............................................................................*
*Br    4 :seg_unsplit. : Wrapper<vector<CSCSegment> >                        *
*Entries :        1 : Total  Size=        670 bytes  File Size  =        134 *
*Baskets :        1 : Basket Size=      32000 bytes  Compression=   1.08     *
*............................................................................*

root.exe -b -l -q simpleread.C+  

Processing simpleread.C+...
***********************************
*    Row   * Instance * seg_split *
***********************************
*        0 *        0 *         0 *
***********************************
***********************************
*    Row   * Instance * seg_unspl *
***********************************
*        0 *        0 *         1 *
***********************************

ferdymercury added a commit to ferdymercury/root that referenced this issue May 9, 2025
ferdymercury added a commit to ferdymercury/root that referenced this issue May 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants