wb-discuss
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Wb-discuss] bad block number error


From: Floris Ouwendijk
Subject: Re: [Wb-discuss] bad block number error
Date: Mon, 14 Dec 2009 09:36:51 +0100
User-agent: Thunderbird 2.0.0.23 (X11/20090817)

Here's an example:

import wb.*;

public class Main {
    public static void main(String[] args) {
        Ents.initWb(12, 100, 4096);
        Seg btreeSeg = Segs.makeSeg("/tmp/wb/idx", 4096);
        Han btree = Han.hanMakeHan();
        Segs.btCreate(btreeSeg, Wbdefs.dirTyp, btree, 1);
        for (long i = 0; i < 10000000; i++) {
            Handle.btPut(btree, idToKey(i), 8, new byte[20], 20);
        }
    }

    public static byte[] idToKey(long id) {
        byte[] v = new byte[8];
        int i = 0;
        while (id !=0) {
            v[i++] = (byte)(id & 0xff);
            id>>=8;
        }
        return v;
    }
}

Note that if I change the initialization to Wnts.initWb(100, 100, 4096); the problem stays.

Regards,
Floris


Aubrey Jaffer wrote:
 | From: Aubrey Jaffer <address@hidden>
 | Date: Wed, 02 Dec 2009 16:55:46 -0500 (EST)
| | | Date: Tue, 24 Nov 2009 15:24:30 +0100
 |  | From: Floris Ouwendijk <address@hidden>
| | | | I'm working on an Java application for which I'd like to use WB
 |  | to store a mapping from a 10 byte key to a 20 byte value.  When
 |  | running some tests I ran into the following error:
 |  | >>>>ERROR<<<< bad block number 8:272129 (>= 1347)
 |  | The key is essentially a number, stored with the 8 bytes in
 |  | little endian order, followed by another 2 byte number. In the
 |  | test I sequentially store numbers, starting from zero, and the
 |  | error occurs (consistently) when storing a few tens of thousands
 |  | values.
| | | | Some snippets:
 |  |         Ents.initWb(12, 100, 4096);

My regression suite doesn't exercise the minimum-number-of-ents limit.
Could you send me a small program which fails with
Ents.initWb(12, 100, 4096)?

 | The first argument to initWb() should be much larger.  Try:
| | Ents.initWb(100, 100, 4096); | | or | | Ents.initWb(1000, 1000, 4096); | | These will allocate about 400.kB or 4.MB for buffers, respectively.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]