max key length at 20 is too small

53 views
Skip to first unread message

Xav ier

unread,
Nov 26, 2011, 12:06:03 PM11/26/11
to nes...@googlegroups.com
Size of 20 chars for the key is too small for my usage. I need to insert 255 chars as key.
How do you calculate the size TABLE_SIZE ??

#define SHA1_LENGTH (20)
struct btree_item {
char sha1[SHA1_LENGTH];
__be32 offset;
__be32 child;
} __attribute__((packed));
#define TABLE_SIZE ((4096 - 1) / sizeof(struct btree_item))

If I set SHA1_LENGTH to 100, db won't work, TABLE_SIZE will be to small.
With witch value should I set it ?

Xavier

BohuTANG

unread,
Nov 27, 2011, 7:30:06 AM11/27/11
to nessDB
Yes,I will fix it to big.

Thanks.
BohuTANG

BohuTANG

unread,
Nov 27, 2011, 9:13:59 PM11/27/11
to nessDB
Hi,
You can tinker it by yourself.
It doesn't matter when you set SHA1_LENGTH(not too big),but '100'
works well.The weakness is more waste if your 'KEY' length is less
than it.
I think you should give more informations about 'db won't work'.


Thanks.
--BohuTANG


On Nov 27, 1:06 am, Xav ier <xavier.etche...@gmail.com> wrote:

Xav ier

unread,
Nov 29, 2011, 4:23:12 PM11/29/11
to nes...@googlegroups.com
Hi,
I may have done something else wrong because I don't have any troubles for now with long keys.
I was just setting a key with a length of 21 and then trying to get the value, but it wasn't properly recorded. With a length of 20 it worked.

Anyway it's ok now. If I see something else, I'll double check before posting.

I changed the whole string usage with C in my program and I've got a db working well. It's behind Kyoto Cabinet and LevelDB in pure speed for my usage but at least it seems to work on IBM AIX 5.3 correctly. I'll do some more test in the near future.

Xavier

BohuTANG

unread,
Nov 29, 2011, 9:39:54 PM11/29/11
to nessDB
It doesn't matter.You can post all question about nessDB here.
Because v1.8.1 modified time by time, so if you find something wrong,
you should 'git pull' the new code which on github.

--BohuTANG

Reply all
Reply to author
Forward
0 new messages