franferta / jdbm2

Automatically exported from code.google.com/p/jdbm2
0 stars 0 forks source link

Retrieval of objects from PrimaryStoreMap failing #6

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Create a PrimaryStoreMap, and secondary index using Longs as keys, Strings 
as values
2. Add 1000 records, checking that each added correctly
3. In separate program attempt to iterate through records

What is the expected output? What do you see instead?
I expect it to iterate through all the records, instead some of them are not 
found. I can see that they've been added using the secondary key extractor, but 
when the key is looked up there's nothing there.

What version of the product are you using? On what operating system?
The 2.0 zip from the downloads page.

Please provide any additional information below.
I tried reading with and without the cache enabled, same problem.
I add records to the primary store key, then on a secondary index I use the 
keys 1-1000. When I add a record I check that the key is in secondary index.
I've attached two files, one to write, one to read, which are modifications of 
the samples provided that I was using for some performance testing.

This is a pity because the library is very easy to use. 

Original issue reported on code.google.com by keith.po...@gmail.com on 6 May 2011 at 12:27

GoogleCodeExporter commented 8 years ago
Oops, I uploaded incorrect versions of the tests. With the console output you 
can see that the index key is present, and even get back the recid for the key, 
but trying to get the value object returns null.

Original comment by keith.po...@gmail.com on 6 May 2011 at 12:39

Attachments:

GoogleCodeExporter commented 8 years ago
I tried Base64 encoding the byte arrays first to make sure there were no 
non-ASCII characters being output, after reading the commentary for Issue 5. 
Same problem.

Also, it's non-deterministic - the read fails on a different record each time, 
so it's unlikely to do with the formatting of one of the records anyway.

The new version requires the Commons Codec jar for the Base64 encoding.

Original comment by keith.po...@gmail.com on 6 May 2011 at 1:32

Attachments:

GoogleCodeExporter commented 8 years ago
JDBM is fine. You used wrong method. On 'StoreReadTest.java' line 36 should be:

 String s = index.getPrimaryValues(key).iterator().next();

Problem is that there are two methods with very similar name but different 
meaning. One of them returns primary values for _secondary key_ other for 
_primary key_. I will change method names in JDBM3. 

Original comment by kja...@gmail.com on 5 Jun 2011 at 1:57

GoogleCodeExporter commented 8 years ago
What worked perfectly. Many thanks for setting me straight. This is a really 
easy to use library by the way, great work.

I can proceed with my performance tests now. I don't suppose there's any 
performance benchmark lying around ? One thing I've noticed so far is that 
under Mac OS the writes are way faster than the reads which is very odd. It's 
as expected on Windows. I'll have to get profiling...

Original comment by keith.po...@gmail.com on 9 Jun 2011 at 2:04