Skip to content
Snippets Groups Projects
Commit 7a64f8fb authored by Oana Vickey Boeriu's avatar Oana Vickey Boeriu Committed by Atlas Nightlybuild
Browse files

Merge branch 'checkCorruptedMDFix-21.2.116.0' into '21.2'

Fix issue with short index for IOVPayload PT conversion

See merge request atlas/athena!42384

(cherry picked from commit 43f733e8)

43b3fded Fix issue with short index for IOVPayload PT conversion
parent c608e01f
No related branches found
No related tags found
5 merge requests!58791DataQualityConfigurations: Modify L1Calo config for web display,!46784MuonCondInterface: Enable thread-safety checking.,!46776Updated LArMonitoring config file for WD to match new files produced using MT,!45405updated ART test cron job,!42472Sweeping !42384 from 21.2 to master. Fix issue with short index for IOVPayload PT conversion
Pipeline #2478996 passed
File mode changed from 100644 to 100755
File mode changed from 100755 to 100644
......@@ -47,6 +47,9 @@ private:
// Attribute types
std::map<std::string, unsigned int> m_attributeTypeMap;
std::vector<std::string> m_attributeTypes;
unsigned int m_objIndexOffset[IOVPayloadContainer_p1::ATTR_TIME_STAMP+1];
};
#endif // IOVDBPTCNV_IOVPAYLOADCONTAINERPTCNV_P1_H
......@@ -30,6 +30,10 @@ IOVPayloadContainerPTCnv_p1::persToTrans(const IOVPayloadContainer_p1* persObj,
// Make sure transient container is empty - may be reused
transObj->m_payloadVec.clear();
for( auto & offset : m_objIndexOffset ) {
offset = 1; // this is just the initial value before first use
}
// fill map from type name to int
if (m_attributeTypes.size() == 0)fillAttributeTypeMap();
......@@ -394,53 +398,82 @@ IOVPayloadContainerPTCnv_p1::fillAttributeData(const IOVPayloadContainer_p1* per
const std::string& name,
coral::AttributeList& attrList)
{
// Fill persistent object with attribute data - must use switch
// for all possible types
/*
this offset calculation solves the problem reported in
ATR-22116 trying to get past the limitation introduced by
AttrListIndexes::m_objIndex being of type short, which doesn't
cover the full length of the type-wise data vectors
It is assumed that when reading the persistent object entries,
the objIndex starts at 0, and increases by 1 each read for a given type.
One must also not call fillAttributeData multiple times for the
same (AttrListIndexes index), nor call them out of order
* There is one offset per type, initialized to 1
* In the first read of a type the offset is set to 0
* In all later reads the offset is not changed unless the objIndex equals 0
- if objIndex is fixed to be unsigned int, then objIndex should never be 0 in later reads
- if objIndex is unsigned short, then objIndex==0 only when it runs into the 65536 boundary
and the offset then gets increased by this amount
So this will work also when objIndex is integer
*/
unsigned int objIndex = index.objIndex();
unsigned int & offset = m_objIndexOffset[index.typeIndex()];
if(offset == 1) {
offset = 0;
} else {
if(objIndex == 0) {
offset += 65536;
}
}
switch (index.typeIndex()) {
case IOVPayloadContainer_p1::ATTR_BOOL:
attrList[name].setValue(persObj->m_bool[index.objIndex()]);
attrList[name].setValue(persObj->m_bool[objIndex + offset]);
break;
case IOVPayloadContainer_p1::ATTR_CHAR:
attrList[name].setValue(persObj->m_char[index.objIndex()]);
attrList[name].setValue(persObj->m_char[objIndex + offset]);
break;
case IOVPayloadContainer_p1::ATTR_UNSIGNED_CHAR:
attrList[name].setValue(persObj->m_unsignedChar[index.objIndex()]);
attrList[name].setValue(persObj->m_unsignedChar[objIndex + offset]);
break;
case IOVPayloadContainer_p1::ATTR_SHORT:
attrList[name].setValue(persObj->m_short[index.objIndex()]);
attrList[name].setValue(persObj->m_short[objIndex + offset]);
break;
case IOVPayloadContainer_p1::ATTR_UNSIGNED_SHORT:
attrList[name].setValue(persObj->m_unsignedShort[index.objIndex()]);
attrList[name].setValue(persObj->m_unsignedShort[objIndex + offset]);
break;
case IOVPayloadContainer_p1::ATTR_INT:
attrList[name].setValue(persObj->m_int[index.objIndex()]);
attrList[name].setValue(persObj->m_int[objIndex + offset]);
break;
case IOVPayloadContainer_p1::ATTR_UNSIGNED_INT:
attrList[name].setValue(persObj->m_unsignedInt[index.objIndex()]);
attrList[name].setValue(persObj->m_unsignedInt[objIndex + offset]);
break;
case IOVPayloadContainer_p1::ATTR_LONG:
attrList[name].setValue(persObj->m_long[index.objIndex()]);
attrList[name].setValue(persObj->m_long[objIndex + offset]);
break;
case IOVPayloadContainer_p1::ATTR_UNSIGNED_LONG:
attrList[name].setValue(persObj->m_unsignedLong[index.objIndex()]);
attrList[name].setValue(persObj->m_unsignedLong[objIndex + offset]);
break;
case IOVPayloadContainer_p1::ATTR_LONG_LONG:
attrList[name].setValue(persObj->m_longLong[index.objIndex()]);
attrList[name].setValue(persObj->m_longLong[objIndex + offset]);
break;
case IOVPayloadContainer_p1::ATTR_UNSIGNED_LONG_LONG:
attrList[name].setValue(persObj->m_unsignedLongLong[index.objIndex()]);
attrList[name].setValue(persObj->m_unsignedLongLong[objIndex + offset]);
break;
case IOVPayloadContainer_p1::ATTR_FLOAT:
attrList[name].setValue(persObj->m_float[index.objIndex()]);
attrList[name].setValue(persObj->m_float[objIndex + offset]);
break;
case IOVPayloadContainer_p1::ATTR_DOUBLE:
attrList[name].setValue(persObj->m_double[index.objIndex()]);
attrList[name].setValue(persObj->m_double[objIndex + offset]);
break;
case IOVPayloadContainer_p1::ATTR_LONG_DOUBLE:
// attrList[name].setValue(persObj->m_longDouble[index.objIndex()]);
// attrList[name].setValue(persObj->m_longDouble[objIndex + offset]);
break;
case IOVPayloadContainer_p1::ATTR_STRING:
attrList[name].setValue(persObj->m_string[index.objIndex()]);
attrList[name].setValue(persObj->m_string[objIndex + offset]);
break;
case IOVPayloadContainer_p1::ATTR_BLOB:
// log << MSG::ERROR
......@@ -449,14 +482,14 @@ IOVPayloadContainerPTCnv_p1::fillAttributeData(const IOVPayloadContainer_p1* per
return;
case IOVPayloadContainer_p1::ATTR_DATE:
{
coral::TimeStamp::ValueType ns( persObj->m_date[index.objIndex()] );
coral::TimeStamp::ValueType ns( persObj->m_date[objIndex + offset] );
attrList[name].setValue( coral::Date(coral::TimeStamp(ns).time()) );
break;
}
case IOVPayloadContainer_p1::ATTR_TIME_STAMP:
{
coral::TimeStamp::ValueType ns =
coral::TimeStamp::ValueType( persObj->m_timeStamp[index.objIndex()] );
coral::TimeStamp::ValueType( persObj->m_timeStamp[objIndex + offset] );
attrList[name].setValue( coral::TimeStamp(ns) );
break;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment