0

I traverse the BTree by cursor (example from documentation )

See code bellow:

 kkey_t* p2;  // the type kkey_t is some struct
 int counter=0;
 BDBCUR *cur = tcbdbcurnew(bdb);
 tcbdbcurfirst(cur);
 while((p2 = (kkey_t*)tcbdbcurkey(cur, &len )) != NULL){ 
    printf("%u.%u\t%u\n",p2->type, p2->key, counter);
    free(p2);
    res = tcbdbcurnext(cur);
    if (!res) break;

    counter++;    
 }

I get the 562 418 records by tcbdbrnum(), but I have loop where counter is more that 150 000 000 and more... I d't have cycle finish.

What is the problem can be?

I find that the loopsize is 150652 cylses and loop offset nearly 1.3 * 150652 So, I increase file to 1 042 638 keys, and I have loopsize = 280299 The ratio recsize / loopsize = 3,73...

What to do, that have unlooping? Why I have the looping?

The all keys is random of size 64 bit (8 bytes). The some keys caould be deleted.

user1514692
  • 60
  • 1
  • 8
Alexandre Kalendarev
  • 681
  • 2
  • 10
  • 24

0 Answers0