You've already forked mariadb-columnstore-engine
mirror of
https://github.com/mariadb-corporation/mariadb-columnstore-engine.git
synced 2025-07-27 21:01:50 +03:00
MCOL-5206 This patch brings some EMIndex and treeish EM leftovers from develop-5
This commit is contained in:
@ -1,5 +1,5 @@
|
||||
/* Copyright (C) 2014 InfiniDB, Inc.
|
||||
|
||||
Copyright (C) 2016-2022 MariaDB Corporation
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
as published by the Free Software Foundation; version 2 of
|
||||
@ -295,6 +295,9 @@ class LBIDRange : public messageqcpp::Serializeable
|
||||
uint32_t size;
|
||||
|
||||
EXPORT LBIDRange();
|
||||
LBIDRange(const LBID_t aStart, const uint32_t aSize) : start(aStart), size(aSize)
|
||||
{
|
||||
}
|
||||
EXPORT LBIDRange(const LBIDRange& l);
|
||||
EXPORT LBIDRange(const InlineLBIDRange& l);
|
||||
EXPORT LBIDRange& operator=(const LBIDRange& l);
|
||||
|
@ -2471,17 +2471,15 @@ int ExtentMap::lookupLocal_DBroot(int OID, uint16_t dbroot, uint32_t partitionNu
|
||||
grabEMEntryTable(READ);
|
||||
grabEMIndex(READ);
|
||||
|
||||
for (auto emIt = fExtentMapRBTree->begin(), end = fExtentMapRBTree->end(); emIt != end; ++emIt)
|
||||
const auto lbids = fPExtMapIndexImpl_->find(dbroot, OID, partitionNum);
|
||||
const auto emIdents = getEmIdentsByLbids(lbids);
|
||||
for (auto& emEntry : emIdents)
|
||||
{
|
||||
const auto& emEntry = emIt->second;
|
||||
// TODO: Blockoffset logic.
|
||||
if (emEntry.fileID == OID && emEntry.dbRoot == dbroot && emEntry.partitionNum == partitionNum &&
|
||||
emEntry.segmentNum == segmentNum && emEntry.blockOffset <= fileBlockOffset &&
|
||||
if (emEntry.segmentNum == segmentNum && emEntry.blockOffset <= fileBlockOffset &&
|
||||
fileBlockOffset <= (emEntry.blockOffset + (static_cast<LBID_t>(emEntry.range.size) * 1024) - 1))
|
||||
{
|
||||
auto offset = fileBlockOffset - emEntry.blockOffset;
|
||||
LBID = emEntry.range.start + offset;
|
||||
|
||||
releaseEMIndex(READ);
|
||||
releaseEMEntryTable(READ);
|
||||
return 0;
|
||||
@ -3325,7 +3323,6 @@ LBID_t ExtentMap::_createColumnExtentExactFile(uint32_t size, int OID, uint32_t
|
||||
newEmEntry.segmentNum = segmentNum;
|
||||
newEmEntry.status = EXTENTUNAVAILABLE; // mark extent as in process
|
||||
|
||||
|
||||
if (isUnsigned(colDataType))
|
||||
{
|
||||
if (colWidth != datatypes::MAXDECIMALWIDTH)
|
||||
@ -3670,8 +3667,6 @@ void ExtentMap::printFL() const
|
||||
void ExtentMap::rollbackColumnExtents_DBroot(int oid, bool bDeleteAll, uint16_t dbRoot, uint32_t partitionNum,
|
||||
uint16_t segmentNum, HWM_t hwm)
|
||||
{
|
||||
// bool oidExists = false;
|
||||
|
||||
#ifdef BRM_INFO
|
||||
if (fDebug)
|
||||
{
|
||||
@ -3810,6 +3805,7 @@ void ExtentMap::rollbackColumnExtents_DBroot(int oid, bool bDeleteAll, uint16_t
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// If this function is called, we are already in error recovery mode; so
|
||||
// don't worry about reporting an error if the OID is not found, because
|
||||
// we don't want/need the extents for that OID anyway.
|
||||
@ -3851,8 +3847,6 @@ void ExtentMap::rollbackColumnExtents_DBroot(int oid, bool bDeleteAll, uint16_t
|
||||
void ExtentMap::rollbackDictStoreExtents_DBroot(int oid, uint16_t dbRoot, uint32_t partitionNum,
|
||||
const vector<uint16_t>& segNums, const vector<HWM_t>& hwms)
|
||||
{
|
||||
// bool oidExists = false;
|
||||
|
||||
#ifdef BRM_INFO
|
||||
if (fDebug)
|
||||
{
|
||||
@ -3885,8 +3879,8 @@ void ExtentMap::rollbackDictStoreExtents_DBroot(int oid, uint16_t dbRoot, uint32
|
||||
bDeleteAll = true;
|
||||
|
||||
// segToHwmMap maps segment file number to corresponding pair<hwm,fboLo>
|
||||
tr1::unordered_map<uint16_t, pair<uint32_t, uint32_t>> segToHwmMap;
|
||||
tr1::unordered_map<uint16_t, pair<uint32_t, uint32_t>>::const_iterator segToHwmMapIter;
|
||||
tr1::unordered_map<uint16_t, pair<uint32_t, uint32_t> > segToHwmMap;
|
||||
tr1::unordered_map<uint16_t, pair<uint32_t, uint32_t> >::const_iterator segToHwmMapIter;
|
||||
|
||||
grabEMEntryTable(WRITE);
|
||||
grabEMIndex(WRITE);
|
||||
@ -3980,20 +3974,6 @@ void ExtentMap::rollbackDictStoreExtents_DBroot(int oid, uint16_t dbRoot, uint32
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// If this function is called, we are already in error recovery mode; so
|
||||
// don't worry about reporting an error if the OID is not found, because
|
||||
// we don't want/need the extents for that OID anyway.
|
||||
// if (!oidExists)
|
||||
//{
|
||||
// ostringstream oss;
|
||||
// oss << "ExtentMap::rollbackDictStoreExtents_DBroot(): "
|
||||
// "Rollback failed: no extents exist for: OID-" << oid <<
|
||||
// "; dbRoot-" << dbRoot <<
|
||||
// "; partition-" << partitionNum;
|
||||
// log(oss.str(), logging::LOG_TYPE_CRITICAL);
|
||||
// throw invalid_argument(oss.str());
|
||||
//}
|
||||
}
|
||||
}
|
||||
|
||||
@ -4271,6 +4251,7 @@ void ExtentMap::deleteOID(int OID)
|
||||
|
||||
// Clean up the index and tell deleteExtent to skip the clean-up.
|
||||
DBRootVec dbRootVec(getAllDbRoots());
|
||||
|
||||
for (auto dbRoot : dbRootVec)
|
||||
{
|
||||
const auto lbids = fPExtMapIndexImpl_->find(dbRoot, OID);
|
||||
@ -4504,14 +4485,12 @@ HWM_t ExtentMap::getLastHWM_DBroot(int OID, uint16_t dbRoot, uint32_t& partition
|
||||
log(oss.str(), logging::LOG_TYPE_CRITICAL);
|
||||
throw invalid_argument(oss.str());
|
||||
}
|
||||
|
||||
grabEMEntryTable(READ);
|
||||
grabEMIndex(READ);
|
||||
|
||||
const auto lbids = fPExtMapIndexImpl_->find(dbRoot, OID);
|
||||
const auto emIdents = getEmIdentsByLbids(lbids);
|
||||
auto lastEmEntry = emIdents.begin();
|
||||
|
||||
for (auto emEntry = emIdents.begin(); emEntry < emIdents.end(); ++emEntry)
|
||||
{
|
||||
if (((emEntry->status == EXTENTAVAILABLE) || (emEntry->status == EXTENTOUTOFSERVICE)) &&
|
||||
@ -4595,7 +4574,6 @@ void ExtentMap::getDbRootHWMInfo(int OID, uint16_t pmNumber, EmDbRootHWMInfo_v&
|
||||
grabEMEntryTable(READ);
|
||||
grabEMIndex(READ);
|
||||
tr1::unordered_map<uint16_t, EmDbRootHWMInfo>::iterator emIter;
|
||||
|
||||
// Indicates that we found an extent, the index itself means nothing.
|
||||
// TODO: Update to flag.
|
||||
uint32_t foundIndex = 0;
|
||||
@ -4787,6 +4765,7 @@ HWM_t ExtentMap::getLocalHWM(int OID, uint32_t partitionNum, uint16_t segmentNum
|
||||
grabEMIndex(READ);
|
||||
|
||||
DBRootVec dbRootVec(getAllDbRoots());
|
||||
|
||||
for (auto dbRoot : dbRootVec)
|
||||
{
|
||||
const auto lbids = fPExtMapIndexImpl_->find(dbRoot, OID, partitionNum);
|
||||
@ -4950,7 +4929,6 @@ void ExtentMap::setLocalHWM(int OID, uint32_t partitionNum, uint16_t segmentNum,
|
||||
|
||||
log(os.str(), logging::LOG_TYPE_DEBUG);
|
||||
}
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -5089,7 +5067,6 @@ void ExtentMap::getExtents_dbroot(int OID, vector<struct EMEntry>& entries, cons
|
||||
#endif
|
||||
|
||||
entries.clear();
|
||||
|
||||
if (OID < 0)
|
||||
{
|
||||
ostringstream oss;
|
||||
@ -5237,7 +5214,6 @@ void ExtentMap::deletePartition(const set<OID_t>& oids, const set<LogicalPartiti
|
||||
|
||||
std::set<LogicalPartition> foundPartitions;
|
||||
std::vector<ExtentMapRBTree::iterator> extents;
|
||||
|
||||
for (auto oid : oids)
|
||||
{
|
||||
for (auto& partition : partitionNums)
|
||||
@ -5297,7 +5273,6 @@ void ExtentMap::markPartitionForDeletion(const set<OID_t>& oids, const set<Logic
|
||||
string& emsg)
|
||||
{
|
||||
#ifdef BRM_INFO
|
||||
|
||||
if (fDebug)
|
||||
{
|
||||
TRACER_WRITENOW("markPartitionForDeletion");
|
||||
@ -5487,7 +5462,6 @@ void ExtentMap::restorePartition(const set<OID_t>& oids, const set<LogicalPartit
|
||||
if (oids.size() == 0)
|
||||
return;
|
||||
|
||||
set<OID_t>::const_iterator it;
|
||||
grabEMEntryTable(WRITE);
|
||||
grabEMIndex(WRITE);
|
||||
|
||||
@ -5734,12 +5708,7 @@ void ExtentMap::lookup(OID_t OID, LBIDRange_v& ranges)
|
||||
for (auto& emEntry : emIdents)
|
||||
{
|
||||
if (emEntry.status != EXTENTOUTOFSERVICE)
|
||||
{
|
||||
LBIDRange tmp;
|
||||
tmp.start = emEntry.range.start;
|
||||
tmp.size = emEntry.range.size * 1024;
|
||||
ranges.emplace_back(tmp);
|
||||
}
|
||||
ranges.emplace_back(emEntry.range.start, emEntry.range.size * 1024);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1066,11 +1066,10 @@ class ExtentMap : public Undoable
|
||||
static const constexpr size_t EM_FREELIST_INITIAL_SIZE = 50 * sizeof(InlineLBIDRange);
|
||||
static const constexpr size_t EM_FREELIST_INCREMENT = 50 * sizeof(InlineLBIDRange);
|
||||
// RBTree constants.
|
||||
static const size_t EM_RB_TREE_NODE_SIZE = 10 * (sizeof(EMEntry) + 8 * sizeof(uint64_t));
|
||||
static const size_t EM_RB_TREE_NODE_SIZE = sizeof(EMEntry) + 8 * sizeof(uint64_t);
|
||||
static const size_t EM_RB_TREE_EMPTY_SIZE = 1024;
|
||||
static const size_t EM_RB_TREE_INITIAL_SIZE =
|
||||
EM_INCREMENT_ROWS * 10 * EM_RB_TREE_NODE_SIZE + EM_RB_TREE_EMPTY_SIZE;
|
||||
static const size_t EM_RB_TREE_INCREMENT = EM_INCREMENT_ROWS * EM_RB_TREE_NODE_SIZE;
|
||||
static const size_t EM_RB_TREE_INITIAL_SIZE = 16 * 1024 * 1024;
|
||||
static const size_t EM_RB_TREE_INCREMENT = 16 * 1024 * 1024;
|
||||
|
||||
ExtentMap(const ExtentMap& em);
|
||||
ExtentMap& operator=(const ExtentMap& em);
|
||||
|
Reference in New Issue
Block a user