1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-08-01 06:46:55 +03:00

clang format apply

This commit is contained in:
Leonid Fedorov
2022-01-21 16:43:49 +00:00
parent 6b6411229f
commit 04752ec546
1376 changed files with 393460 additions and 412662 deletions

View File

@ -43,90 +43,91 @@ using namespace messageqcpp;
namespace joblist
{
ColumnCommandJL::ColumnCommandJL(const pColScanStep& scan, vector<BRM::LBID_t> lastLBID)
{
BRM::DBRM dbrm;
isScan = true;
BRM::DBRM dbrm;
isScan = true;
/* grab necessary vars from scan */
traceFlags = scan.fTraceFlags;
filterString = scan.fFilterString;
filterCount = scan.fFilterCount;
colType = scan.fColType;
BOP = scan.fBOP;
extents = scan.extents;
OID = scan.fOid;
colName = scan.fName;
rpbShift = scan.rpbShift;
fIsDict = scan.fIsDict;
fLastLbid = lastLBID;
/* grab necessary vars from scan */
traceFlags = scan.fTraceFlags;
filterString = scan.fFilterString;
filterCount = scan.fFilterCount;
colType = scan.fColType;
BOP = scan.fBOP;
extents = scan.extents;
OID = scan.fOid;
colName = scan.fName;
rpbShift = scan.rpbShift;
fIsDict = scan.fIsDict;
fLastLbid = lastLBID;
//cout << "CCJL inherited lastlbids: ";
//for (uint32_t i = 0; i < lastLBID.size(); i++)
// cout << lastLBID[i] << " ";
//cout << endl;
// cout << "CCJL inherited lastlbids: ";
// for (uint32_t i = 0; i < lastLBID.size(); i++)
// cout << lastLBID[i] << " ";
// cout << endl;
// cout << "Init columncommand from scan with OID " << OID << endl;
/* I think modmask isn't necessary for scans */
divShift = scan.divShift;
modMask = (1 << divShift) - 1;
// cout << "Init columncommand from scan with OID " << OID << endl;
/* I think modmask isn't necessary for scans */
divShift = scan.divShift;
modMask = (1 << divShift) - 1;
// @Bug 2889. Drop partition enhancement. Read FilesPerColumnPartition and ExtentsPerSegmentFile for use in RID calculation.
fFilesPerColumnPartition = DEFAULT_FILES_PER_COLUMN_PARTITION;
// MCOL-4685 remove the option to set more than 2 extents per file (ExtentsPreSegmentFile).
fExtentsPerSegmentFile = DEFAULT_EXTENTS_PER_SEGMENT_FILE;
config::Config* cf = config::Config::makeConfig();
string fpc = cf->getConfig("ExtentMap", "FilesPerColumnPartition");
// @Bug 2889. Drop partition enhancement. Read FilesPerColumnPartition and ExtentsPerSegmentFile for use
// in RID calculation.
fFilesPerColumnPartition = DEFAULT_FILES_PER_COLUMN_PARTITION;
// MCOL-4685 remove the option to set more than 2 extents per file (ExtentsPreSegmentFile).
fExtentsPerSegmentFile = DEFAULT_EXTENTS_PER_SEGMENT_FILE;
config::Config* cf = config::Config::makeConfig();
string fpc = cf->getConfig("ExtentMap", "FilesPerColumnPartition");
if ( fpc.length() != 0 )
fFilesPerColumnPartition = cf->uFromText(fpc);
if (fpc.length() != 0)
fFilesPerColumnPartition = cf->uFromText(fpc);
}
ColumnCommandJL::ColumnCommandJL(const pColStep& step)
{
BRM::DBRM dbrm;
BRM::DBRM dbrm;
isScan = false;
isScan = false;
/* grab necessary vars from step */
traceFlags = step.fTraceFlags;
filterString = step.fFilterString;
filterCount = step.fFilterCount;
colType = step.fColType;
BOP = step.fBOP;
extents = step.extents;
divShift = step.divShift;
modMask = step.modMask;
rpbShift = step.rpbShift;
OID = step.fOid;
colName = step.fName;
fIsDict = step.fIsDict;
ResourceManager* rm = ResourceManager::instance();
numDBRoots = rm->getDBRootCount();
/* grab necessary vars from step */
traceFlags = step.fTraceFlags;
filterString = step.fFilterString;
filterCount = step.fFilterCount;
colType = step.fColType;
BOP = step.fBOP;
extents = step.extents;
divShift = step.divShift;
modMask = step.modMask;
rpbShift = step.rpbShift;
OID = step.fOid;
colName = step.fName;
fIsDict = step.fIsDict;
ResourceManager* rm = ResourceManager::instance();
numDBRoots = rm->getDBRootCount();
// grab the last LBID for this column. It's a _minor_ optimization for the block loader.
//dbrm.getLastLocalHWM((BRM::OID_t)OID, dbroot, partNum, segNum, lastHWM);
//dbrm.lookupLocal((BRM::OID_t)OID, partNum, segNum, lastHWM, fLastLbid);
/*
fLastLbid.resize(numDBRoots);
for (uint32_t i = 0; i < numDBRoots; i++) {
dbrm.getLastLocalHWM2((BRM::OID_t)OID, i+1, partNum, segNum, lastHWM);
dbrm.lookupLocal((BRM::OID_t)OID, partNum, segNum, lastHWM, fLastLbid[i]);
}
*/
// grab the last LBID for this column. It's a _minor_ optimization for the block loader.
// dbrm.getLastLocalHWM((BRM::OID_t)OID, dbroot, partNum, segNum, lastHWM);
// dbrm.lookupLocal((BRM::OID_t)OID, partNum, segNum, lastHWM, fLastLbid);
/*
fLastLbid.resize(numDBRoots);
for (uint32_t i = 0; i < numDBRoots; i++) {
dbrm.getLastLocalHWM2((BRM::OID_t)OID, i+1, partNum, segNum, lastHWM);
dbrm.lookupLocal((BRM::OID_t)OID, partNum, segNum, lastHWM, fLastLbid[i]);
}
*/
// cout << "Init columncommand from step with OID " << OID << " and width " << colType.colWidth << endl;
// cout << "Init columncommand from step with OID " << OID << " and width " << colType.colWidth << endl;
// @Bug 2889. Drop partition enhancement. Read FilesPerColumnPartition and ExtentsPerSegmentFile for use in RID calculation.
fFilesPerColumnPartition = DEFAULT_FILES_PER_COLUMN_PARTITION;
// MCOL-4685 remove the option to set more than 2 extents per file (ExtentsPreSegmentFile).
fExtentsPerSegmentFile = DEFAULT_EXTENTS_PER_SEGMENT_FILE;
config::Config* cf = config::Config::makeConfig();
string fpc = cf->getConfig("ExtentMap", "FilesPerColumnPartition");
// @Bug 2889. Drop partition enhancement. Read FilesPerColumnPartition and ExtentsPerSegmentFile for use
// in RID calculation.
fFilesPerColumnPartition = DEFAULT_FILES_PER_COLUMN_PARTITION;
// MCOL-4685 remove the option to set more than 2 extents per file (ExtentsPreSegmentFile).
fExtentsPerSegmentFile = DEFAULT_EXTENTS_PER_SEGMENT_FILE;
config::Config* cf = config::Config::makeConfig();
string fpc = cf->getConfig("ExtentMap", "FilesPerColumnPartition");
if ( fpc.length() != 0 )
fFilesPerColumnPartition = cf->uFromText(fpc);
if (fpc.length() != 0)
fFilesPerColumnPartition = cf->uFromText(fpc);
}
ColumnCommandJL::~ColumnCommandJL()
@ -136,167 +137,153 @@ ColumnCommandJL::~ColumnCommandJL()
// The other leg is in PP, its name is ColumnCommand::makeCommand.
void ColumnCommandJL::createCommand(ByteStream& bs) const
{
bs << (uint8_t) COLUMN_COMMAND;
colType.serialize(bs);
bs << (uint8_t) isScan;
bs << traceFlags;
bs << filterString;
bs << BOP;
bs << filterCount;
serializeInlineVector(bs, fLastLbid);
bs << (uint8_t)COLUMN_COMMAND;
colType.serialize(bs);
bs << (uint8_t)isScan;
bs << traceFlags;
bs << filterString;
bs << BOP;
bs << filterCount;
serializeInlineVector(bs, fLastLbid);
CommandJL::createCommand(bs);
CommandJL::createCommand(bs);
}
void ColumnCommandJL::runCommand(ByteStream& bs) const
{
bs << lbid;
bs << lbid;
}
void ColumnCommandJL::setLBID(uint64_t rid, uint32_t dbRoot)
{
uint32_t partNum;
uint16_t segNum;
uint8_t extentNum;
uint16_t blockNum;
uint32_t colWidth;
uint32_t i;
uint32_t partNum;
uint16_t segNum;
uint8_t extentNum;
uint16_t blockNum;
uint32_t colWidth;
uint32_t i;
idbassert(extents.size() > 0);
colWidth = extents[0].colWid;
rowgroup::getLocationFromRid(rid, &partNum, &segNum, &extentNum, &blockNum);
idbassert(extents.size() > 0);
colWidth = extents[0].colWid;
rowgroup::getLocationFromRid(rid, &partNum, &segNum, &extentNum, &blockNum);
for (i = 0; i < extents.size(); i++)
for (i = 0; i < extents.size(); i++)
{
if (extents[i].dbRoot == dbRoot && extents[i].partitionNum == partNum &&
extents[i].segmentNum == segNum && extents[i].blockOffset == (extentNum * colWidth * 1024))
{
if (extents[i].dbRoot == dbRoot &&
extents[i].partitionNum == partNum &&
extents[i].segmentNum == segNum &&
extents[i].blockOffset == (extentNum * colWidth * 1024))
{
lbid = extents[i].range.start + (blockNum * colWidth);
currentExtentIndex = i;
/*
ostringstream os;
os << "CCJL: rid=" << rid << "; dbroot=" << dbRoot << "; partitionNum=" << partNum
<< "; segmentNum=" << segNum << "; extentNum = " << (int) extentNum <<
"; blockNum = " << blockNum << "; OID=" << OID << " LBID=" << lbid;
cout << os.str() << endl;
*/
return;
}
lbid = extents[i].range.start + (blockNum * colWidth);
currentExtentIndex = i;
/*
ostringstream os;
os << "CCJL: rid=" << rid << "; dbroot=" << dbRoot << "; partitionNum=" << partNum
<< "; segmentNum=" << segNum << "; extentNum = " << (int) extentNum <<
"; blockNum = " << blockNum << "; OID=" << OID << " LBID=" << lbid;
cout << os.str() << endl;
*/
return;
}
}
throw logic_error("ColumnCommandJL: setLBID didn't find the extent for the rid.");
throw logic_error("ColumnCommandJL: setLBID didn't find the extent for the rid.");
// ostringstream os;
// os << "CCJL: rid=" << rid << "; dbroot=" << dbRoot << "; partitionNum=" << partitionNum << "; segmentNum=" << segmentNum << "; stripeWithinPartition=" <<
// stripeWithinPartition << "; OID=" << OID << " LBID=" << lbid;
// BRM::log(os.str());
// ostringstream os;
// os << "CCJL: rid=" << rid << "; dbroot=" << dbRoot << "; partitionNum=" << partitionNum << ";
//segmentNum=" << segmentNum << "; stripeWithinPartition=" << stripeWithinPartition << "; OID=" << OID << "
//LBID=" << lbid; BRM::log(os.str());
}
inline uint32_t ColumnCommandJL::getFBO(uint64_t lbid)
{
uint32_t i;
uint64_t lastLBID;
uint32_t i;
uint64_t lastLBID;
for (i = 0; i < extents.size(); i++)
for (i = 0; i < extents.size(); i++)
{
lastLBID = extents[i].range.start + (extents[i].range.size << 10) - 1;
if (lbid >= (uint64_t)extents[i].range.start && lbid <= lastLBID)
{
lastLBID = extents[i].range.start + (extents[i].range.size << 10) - 1;
// @Bug 2889. Change for drop partition. Treat the FBO as if all of the partitions are
// still there as one or more partitions may have been dropped. Get the original index
// for this partition (i.e. what the index would be if all of the partitions were still
// there). The RIDs wind up being calculated off of this FBO for use in DML and DML
// needs calculates the partition number, segment number, etc. off of the RID and needs
// to remain the same when partitions are dropped.
//
// originalIndex = extents in partitions above +
// extents in this partition in stripes above +
// file offset in this stripe
uint32_t originalIndex =
(extents[i].partitionNum * fExtentsPerSegmentFile * fFilesPerColumnPartition) +
((extents[i].blockOffset / extents[i].colWid / 1024) * fFilesPerColumnPartition) +
extents[i].segmentNum;
if (lbid >= (uint64_t) extents[i].range.start && lbid <= lastLBID)
{
// @Bug 2889. Change for drop partition. Treat the FBO as if all of the partitions are
// still there as one or more partitions may have been dropped. Get the original index
// for this partition (i.e. what the index would be if all of the partitions were still
// there). The RIDs wind up being calculated off of this FBO for use in DML and DML
// needs calculates the partition number, segment number, etc. off of the RID and needs
// to remain the same when partitions are dropped.
//
// originalIndex = extents in partitions above +
// extents in this partition in stripes above +
// file offset in this stripe
uint32_t originalIndex =
(extents[i].partitionNum * fExtentsPerSegmentFile * fFilesPerColumnPartition) +
((extents[i].blockOffset / extents[i].colWid / 1024) * fFilesPerColumnPartition) +
extents[i].segmentNum;
return (lbid - extents[i].range.start) + (originalIndex << divShift);
}
return (lbid - extents[i].range.start) + (originalIndex << divShift);
}
}
throw logic_error("ColumnCommandJL: didn't find the FBO?");
throw logic_error("ColumnCommandJL: didn't find the FBO?");
}
uint8_t ColumnCommandJL::getTableColumnType()
{
switch (colType.colWidth)
{
case 8:
return TableColumn::UINT64;
switch (colType.colWidth)
{
case 8: return TableColumn::UINT64;
case 4:
return TableColumn::UINT32;
case 4: return TableColumn::UINT32;
case 2:
return TableColumn::UINT16;
case 2: return TableColumn::UINT16;
case 1:
return TableColumn::UINT8;
case 1: return TableColumn::UINT8;
// TODO MCOL-641
case 16:
//fallthrough
// TODO MCOL-641
case 16:
// fallthrough
default:
throw logic_error("ColumnCommandJL: bad column width");
}
default: throw logic_error("ColumnCommandJL: bad column width");
}
}
string ColumnCommandJL::toString()
{
ostringstream ret;
ostringstream ret;
ret << "ColumnCommandJL: " << filterCount << " filters colwidth=" <<
colType.colWidth << " oid=" << OID << " name=" << colName;
ret << "ColumnCommandJL: " << filterCount << " filters colwidth=" << colType.colWidth << " oid=" << OID
<< " name=" << colName;
if (isScan)
ret << " (scan)";
if (isScan)
ret << " (scan)";
if (isDict())
ret << " (tokens)";
else if (datatypes::isCharType(colType.colDataType))
ret << " (is char)";
if (isDict())
ret << " (tokens)";
else if (datatypes::isCharType(colType.colDataType))
ret << " (is char)";
return ret.str();
return ret.str();
}
uint16_t ColumnCommandJL::getWidth()
{
return colType.colWidth;
return colType.colWidth;
}
void ColumnCommandJL::reloadExtents()
{
int err;
BRM::DBRM dbrm;
int err;
BRM::DBRM dbrm;
err = dbrm.getExtents(OID, extents);
err = dbrm.getExtents(OID, extents);
if (err)
{
ostringstream os;
os << "pColStep: BRM lookup error. Could not get extents for OID " << OID;
throw runtime_error(os.str());
}
if (err)
{
ostringstream os;
os << "pColStep: BRM lookup error. Could not get extents for OID " << OID;
throw runtime_error(os.str());
}
sort(extents.begin(), extents.end(), BRM::ExtentSorter());
sort(extents.begin(), extents.end(), BRM::ExtentSorter());
}
};
}; // namespace joblist