1
0
mirror of https://github.com/MariaDB/server.git synced 2025-11-19 19:03:26 +03:00

Fixed test cases for hash and linear hash and fixed guess in NDB API

for this as well
This commit is contained in:
mronstrom@mysql.com
2005-07-21 14:56:07 +02:00
parent d931417cc3
commit b25cbdba14
2 changed files with 35 additions and 8 deletions

View File

@@ -505,19 +505,37 @@ NdbTableImpl::buildColumnHash(){
Uint32
NdbTableImpl::get_nodes(Uint32 hashValue, const Uint16 ** nodes) const
{
if(m_replicaCount > 0)
Uint32 fragmentId;
if(m_replicaCount == 0)
return 0;
switch (m_fragmentType)
{
Uint32 fragmentId = hashValue & m_hashValueMask;
if(fragmentId < m_hashpointerValue)
case AllNodesSmallTable:
case AllNodesMediumTable:
case AllNodesLargeTable:
case SingleFragment:
case DistrKeyLin:
{
fragmentId = hashValue & ((m_hashValueMask << 1) + 1);
Uint32 fragmentId = hashValue & m_hashValueMask;
if(fragmentId < m_hashpointerValue)
{
fragmentId = hashValue & ((m_hashValueMask << 1) + 1);
}
break;
}
Uint32 pos = fragmentId * m_replicaCount;
if(pos + m_replicaCount <= m_fragments.size())
case DistrKeyHash:
{
* nodes = m_fragments.getBase()+pos;
return m_replicaCount;
fragmentId = hashValue % m_fragmentCount;
break;
}
default:
return 0;
}
Uint32 pos = fragmentId * m_replicaCount;
if (pos + m_replicaCount <= m_fragments.size())
{
*nodes = m_fragments.getBase()+pos;
return m_replicaCount;
}
return 0;
}