You've already forked mariadb-columnstore-engine
mirror of
https://github.com/mariadb-corporation/mariadb-columnstore-engine.git
synced 2025-07-30 19:23:07 +03:00
MCOL-786 Redistribute: Round robin target dbroots
This commit is contained in:
@ -393,6 +393,14 @@ int RedistributeControlThread::makeRedistributePlan()
|
|||||||
// It's possible that a source that is "removed" on the command line is not empty.
|
// It's possible that a source that is "removed" on the command line is not empty.
|
||||||
// This can happen if a partition exists on all dbroots.
|
// This can happen if a partition exists on all dbroots.
|
||||||
|
|
||||||
|
// WCOL-786: use nextDbroot to start the loop looking for a suitible target
|
||||||
|
// where we left off with the previous partition. This gives each target
|
||||||
|
// an opportunity to get some of the data. In the case of dbroot removal,
|
||||||
|
// there is often the same number of partitions on each remaining dbroot.
|
||||||
|
// This logic tends to roundrobin which dbroot gets the next batch.
|
||||||
|
set<int>::iterator nextDbroot = targetDbroots.begin();
|
||||||
|
set<int>::iterator targetDbroot;
|
||||||
|
int targetCnt = (int)targetDbroots.size();
|
||||||
// Loop through the sources, looking for dbroots that are not targets that also still contain partitions
|
// Loop through the sources, looking for dbroots that are not targets that also still contain partitions
|
||||||
for (set<int>::iterator sourceDbroot = sourceDbroots.begin();
|
for (set<int>::iterator sourceDbroot = sourceDbroots.begin();
|
||||||
sourceDbroot != sourceDbroots.end();
|
sourceDbroot != sourceDbroots.end();
|
||||||
@ -416,15 +424,22 @@ int RedistributeControlThread::makeRedistributePlan()
|
|||||||
// the partition.
|
// the partition.
|
||||||
uint64_t partCount = std::numeric_limits<uint64_t>::max();
|
uint64_t partCount = std::numeric_limits<uint64_t>::max();
|
||||||
int tdbroot = 0;
|
int tdbroot = 0;
|
||||||
for (set<int>::iterator targetDbroot = targetDbroots.begin();
|
targetDbroot = nextDbroot;
|
||||||
targetDbroot != targetDbroots.end();
|
// MCOL-786. Start at targetDbroot and loop around back to the same spot.
|
||||||
++targetDbroot)
|
for (int tbd=0; tbd < targetCnt; ++tbd)
|
||||||
{
|
{
|
||||||
|
if (targetDbroot == targetDbroots.end())
|
||||||
|
{
|
||||||
|
targetDbroot == targetDbroots.begin();
|
||||||
|
}
|
||||||
if (dbPartVec[*targetDbroot].size() < partCount)
|
if (dbPartVec[*targetDbroot].size() < partCount)
|
||||||
{
|
{
|
||||||
tdbroot = *targetDbroot;
|
tdbroot = *targetDbroot;
|
||||||
partCount = dbPartVec[*targetDbroot].size();
|
partCount = dbPartVec[*targetDbroot].size();
|
||||||
|
nextDbroot = targetDbroot;
|
||||||
|
++nextDbroot;
|
||||||
}
|
}
|
||||||
|
++targetDbroot;
|
||||||
}
|
}
|
||||||
if (tdbroot == 0)
|
if (tdbroot == 0)
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user