io: Correct handling of byte count pos in TBufferFile::ReadObjectAny#21192
io: Correct handling of byte count pos in TBufferFile::ReadObjectAny#21192pcanal wants to merge 21 commits intoroot-project:Arlesiennefrom
Conversation
|
Note that 588b29e was also not reviewed. |
Test Results 22 files 22 suites 3d 5h 29m 20s ⏱️ For more details on these failures, see this check. Results for commit 0b030d7. ♻️ This comment has been updated with latest results. |
|
Closing #20498 since it seems this is an alternative / better approach |
1ca66ec to
33e27a1
Compare
|
|
||
| virtual void *ReadObjectAny(const TClass* cast) = 0; | ||
| virtual void SkipObjectAny() = 0; | ||
| virtual void SkipObjectAny(Long64_t start, UInt_t bytecount) = 0; |
There was a problem hiding this comment.
It would be useful to add additional documentation that explains why this overload is needed. We seem to need this only once in the code base. Is it worth (the only option) to add a new virtual method in a fundamental class?
There was a problem hiding this comment.
This is used for error handling within a Streamer.
The use case is a streamer with a flow like:
- Read version and bytecount
- Start reading the date
- Detect an error (in the use case, missing some information for a
CollectionProxy) - Properly set the cursor to the end of the object to allow to continue without problem.
Because the actual ByteCount information for large byte count is only in the stack, I could only see two ways to support this use case: add the new SkipObjectAny overload or make the stack public (via a Getter).
There was a problem hiding this comment.
Thank you for the explanation! Can you add this as a method documentation.
| /// Skip any kind of object from buffer | ||
|
|
||
| void TBufferFile::SkipObjectAny(Long64_t start, UInt_t count) | ||
| { |
There was a problem hiding this comment.
Wouldn't that always be true? (count is an unsigned int here)
Or Do you mean to require strictly positive?
fbaed6e to
677a609
Compare
This fixes TBufferFile::ReadObjectAny handling of long range byte counts
Those were essentially replaced by a 'set the cursor to the end' call in commit 7d25b75. It is dubious whether these changes are needed or were an heurestic to ignore (temporarily !?) race conditions.
Due to the need for using a stack of bytecount position, we can no longer support redundant calls to CheckByteCount.
677a609 to
61e48bd
Compare
This simplify the implementation of calling `ReserveByteCount` and then `SetByteCount` and could also simplify removing the use of the ByteCountStack in some/most cases. Note: `ReserveByteCount` is protected and the existing code that does the same semantic action was only recording the position in a 32 bits integer. That code needs to be updated by either making `ReserverByteCount` public (making removal of external use of the ByteCountStack more difficult) or by introducing a RAII that hides the size of the integer.
In order to allow using the roottest CMake macro outside of the roottest sub-directory, we need to make the variable used by those macros 'cache variable' so that they can use elsewhere. This is a hack and works only after the second CMake configuration/invocation.
When using the Microsoft Visual Studio generator we have the exact same problem, that it might trigger a rebuild of ROOT so we need to apply the same solution. See 06e00a2. PS. We might want to eventually rename the resource lock.
It is need by at least Ninja and the Visual Studio generator
61e48bd to
0b030d7
Compare
This is a missing commit for #21183 which was merge a bit too soon.