MCPcopy Create free account
hub / github.com/MariaDB/server / MakeBlockArray

Method MakeBlockArray

storage/connect/xindex.cpp:3160–3181  ·  view source on GitHub ↗

/ Make a front end array of key values that are the first value of */ each blocks (of size n). This to reduce paging in FastFind. */ /

Source from the content-addressed store, hash-verified

3158/* each blocks (of size n). This to reduce paging in FastFind. */
3159/***********************************************************************/
3160bool KXYCOL::MakeBlockArray(PGLOBAL g, int nb, int size)
3161 {
3162 int i, k;
3163
3164 // Calculate the size of the block array in the index
3165 Bkeys.Size = nb * Klen;
3166
3167 // Allocate the required memory
3168 if (!PlgDBalloc(g, NULL, Bkeys)) {
3169 snprintf(g->Message, sizeof(g->Message), MSG(KEY_ALLOC_ERROR), Klen, nb);
3170 return true; // Error
3171 } // endif
3172
3173 // Allocate the Valblk used to contains initial block key values
3174 Blkp = AllocValBlock(g, To_Bkeys, Type, nb, Klen, Kprec);
3175
3176 // Populate the array with values
3177 for (i = k = 0; i < nb; i++, k += size)
3178 Blkp->SetValue(Kblp, i, k);
3179
3180 return false;
3181 } // end of MakeBlockArray
3182
3183/***********************************************************************/
3184/* KXYCOL SetValue: read column value for nth array element. */

Callers 2

MakeMethod · 0.80
InitMethod · 0.80

Calls 3

PlgDBallocFunction · 0.85
AllocValBlockFunction · 0.85
SetValueMethod · 0.45

Tested by

no test coverage detected