1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-07-29 08:21:15 +03:00

MCOL-5493: First portion of UBSan fixes (#2842)

Multiple UB fixes
This commit is contained in:
Leonid Fedorov
2023-06-02 17:02:09 +03:00
committed by GitHub
parent 0a2e9760ee
commit 8f93fc3623
31 changed files with 274 additions and 916 deletions

View File

@ -65,12 +65,13 @@ ExtentStripeAlloc::~ExtentStripeAlloc()
// Add a column to be associated with the "stripe" allocations for "this"
// ExtentStripeAlloc object.
//------------------------------------------------------------------------------
void ExtentStripeAlloc::addColumn(OID colOID, int colWidth)
void ExtentStripeAlloc::addColumn(OID colOID, int colWidth, datatypes::SystemCatalog::ColDataType colDataType)
{
boost::mutex::scoped_lock lock(fMapMutex);
fColOIDs.push_back(colOID);
fColWidths.push_back(colWidth);
fColDataTypes.push_back(colDataType);
}
//------------------------------------------------------------------------------
@ -161,6 +162,7 @@ int ExtentStripeAlloc::allocateExtent(OID oid, uint16_t dbRoot,
BRM::CreateStripeColumnExtentsArgIn colEntry;
colEntry.oid = fColOIDs[j];
colEntry.width = fColWidths[j];
colEntry.colDataType = fColDataTypes[j];
cols.push_back(colEntry);
}

View File

@ -128,7 +128,7 @@ class ExtentStripeAlloc
* @param colOID Column OID to be added to extent allocation list.
* @param colWidth Width of column associated with colOID.
*/
void addColumn(OID colOID, int colWidth);
void addColumn(OID colOID, int colWidth, datatypes::SystemCatalog::ColDataType colDataType);
/** @brief Request an extent allocation for the specified OID and DBRoot.
* A "stripe" of extents for the corresponding table will be allocated
@ -159,6 +159,7 @@ class ExtentStripeAlloc
boost::mutex fMapMutex; // protects unordered map access
std::vector<OID> fColOIDs; // Vector of column OIDs
std::vector<int> fColWidths; // Widths associated with fColOIDs
std::vector<datatypes::SystemCatalog::ColDataType> fColDataTypes;
// unordered map where we collect the allocated extents
std::tr1::unordered_multimap<OID, AllocExtEntry, AllocExtHasher> fMap;

View File

@ -1249,7 +1249,7 @@ void TableInfo::addColumn(ColumnInfo* info)
fColumns.push_back(info);
fNumberOfColumns = fColumns.size();
fExtentStrAlloc.addColumn(info->column.mapOid, info->column.width);
fExtentStrAlloc.addColumn(info->column.mapOid, info->column.width, info->column.dataType);
}
//------------------------------------------------------------------------------