Reset the EventStreamInfo payload at the first event
This is an updated version of !74770 (merged) which attempted at fixing ATEAM-1016, but broke some ART tests (!75561 (merged)).
The original description is still valid:
All fields of
EventStreamInfo
, except the number of events, are sets, thus are safe for merging. On the other hand, special care needs to be taken for the number of events, in particular in merge and/or MP jobs. Historically it was done by switching on or off{Copy,Make}EventStreamInfo
tools. This was moved recently to configuration layer in !73452 (merged) (merged). This however introduced regression reported in ATEAM-1016 (overwrite of number of events in merge job running in MP). This MR attempts at improving this by resetting theEventStreamInfo
payload at the first processed event inMakeEventStreamInfo::postExecute()
, usingstd::call_once
(thread-safe). This is needed to avoid double counting of events which could have been already added byCopyEventStreamInfo
atbeginInputFile()
. Such an approach allows for co-existence ofCopy-
andMakeEventStreamInfo
tools. The reason why we need to reset not only the number of events, but also other payload comes from the filtering workflows (MakeEventStreamInfo
must create adequate description of the events in the output).
One addition is, however, the case of jobs processing multiple files having events (so not shared writer who does not see any events, but processes inputs from workers, i.e. virtual input files). In such a case, one needs to set the number of events to what MakeEventStreamInfo
processed to reflect correct number of events in the stream.