2 Replies Latest reply on Jun 4, 2012 2:23 PM by Greybird-Oracle

    NPE with deferred writes

      I'm from time to time receiving NPEs once I enable deferredWrites for our database handle.

      Caused by: java.lang.NullPointerException
           at com.sleepycat.je.tree.IN.getFileNumberOffset(IN.java:1233)
           at com.sleepycat.je.tree.IN.getLsn(IN.java:1043)
           at com.sleepycat.je.cleaner.Cleaner.isEvictable(Cleaner.java:1117)
           at com.sleepycat.je.tree.BIN.getChildEvictionType(BIN.java:337)
           at com.sleepycat.je.tree.IN.getEvictionType(IN.java:3146)
           at com.sleepycat.je.evictor.TargetSelector.selectIN(TargetSelector.java:129)
           at com.sleepycat.je.evictor.Evictor.evictBatch(Evictor.java:612)
           at com.sleepycat.je.evictor.Evictor.doEvict(Evictor.java:542)
           at com.sleepycat.je.evictor.Evictor$BackgroundEvictTask.run(Evictor.java:1205)
           at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
           at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
           at java.lang.Thread.run(Thread.java:722)

      Without deferredWrites it's never occuring. We are using a second database for a simple persistent transaction log which is cleared once changes are commit (for a file-backend despite our Java BerkeleyDB-binding). I think it's much better to use deferredWrites for this kind of operation, especially for the first initial import (in our case revision).

      We are using version 5.0.34 as it somehow cannot find the new version in maven (maybe it's not yet in the official repo?). Maybe it's related to the bug in 11) meantioned in the changelog from 5.0.48.

      BTW: Is it possible to get the size of a database easily? I'm using a StoredMap in another application, whereas the BerkeleyDB is some kind of an overflow protection if the RAM is full and I'm simple deciding based on a threshold size if the StoredMap instead of a "normal" Map (HashMap or something) must be used.

      Edited by: 918519 on Jun 3, 2012 6:46 PM

      Edited by: 918519 on Jun 3, 2012 6:51 PM
        • 1. Re: NPE with deferred writes

          This was fixed in 5.0.48. If you search the change log for [#21015] you'll see it.

          I'll check on the Maven issue but for the moment you may want to just download the release package and copy the JE jar.

          JE does not maintain the database size but has a relatively low cost method for getting it (although it must enumerate all keys): Database.count.

          • 2. Re: NPE with deferred writes
            We tested (thanks Yang) last night to be sure that the Maven site works for downloading JE 5.0.48. It works, so you may want to try again.

            For example, this works:

            wget http://download.oracle.com/maven/com/sleepycat/je/5.0.48/je-5.0.48.jar