我用光标(example from documentation )
遍历BTree见下面的代码:
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++;
}
我按tcbdbrnum()
获得了562 418条记录,
但我有一个循环,其中counter
超过1.5亿和更多......
我没有循环完成。
可能是什么问题?
我发现loopize是150652个圆柱体,循环偏移量接近1.3 * 150652 所以,我将文件增加到1 042 638键,我有loopize = 280299 比率recsize / loopsize = 3,73 ...
该做什么,有什么不受欢迎的? 为什么我有循环?
所有密钥都是随机的,大小为64位(8字节)。 可以删除一些键。