Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
    Jan Kotek
    @jankotek
    @swampcoder Beginning of 2021
    @DarioRomano I no longer support that version. But feel free to just remove all references to sun.nio.ch. It should be optional for some type of storage.
    Bradley L Schatz
    @blschatz
    db.close() doesnt seem to work correctly. I'm getting the following exception on close, regardless of using mmap, filechannel, or the default.
    java.nio.file.FileSystemException: I:\xxxx: The process cannot access the file because it is being used by another process.
    This is using 3.0.7 on windows x64
    Any suggestions? Thanks!
    Jan Kotek
    @jankotek
    @blschatz most likely file locking. Storage was opened twice. Also on Windows file might remain locked, even after JVM process exits.
    Bradley L Schatz
    @blschatz
    Thanks Jan! It turned out to be I was missing a close in an earlier unit test.
    FYI mmap is working for me on Win10/Java8.
    Organ bank from sector 7G
    @testchamber1_twitter
    Hi there! Has anyone tried to use the expireOverflow feature successfully? The problem I'm facing is that the only function that retrieves the data from the disk memory is the memoryMap.get(some_key). If I call a function like underlyingMap.keys, underlyingMap.values, etcetc they come back empty UNLESS the data was refreshed recently. Is this expected? thanks in advance.
    liuyibox
    @liuyibox
    Hey I recently work on an android project have to use org.mapdb:mapdb:jar:3.0.7, but I got Method name '%%%verify$mapdb' in class 'org.mapdb.DB$Maker' cannot be represented in dex format. build error message. I saw this happen before, I'm wondering if there are any progresses on this problem?
    liuyibox
    @liuyibox
    If I guess correctly, in order to use mapdb.jar on android, the java source files and kotlin source files of MapDB need to be specified separately when compiling them into class/dex files.
    Jan Kotek
    @jankotek
    @liuyibox one method in kotlin has strange name in order to obfuscate it. It is not problem in JVM, but on Android. I will have to release new minor version for that
    nate8628
    @nate8628
    db.treeMap can't do batch import anymore? I'm trying to use the example from the documentation but createFrom() is an invalid method.
    nate8628
    @nate8628
    @jankotek
    SJS830
    @SJS830
    How do you serialize an entire database to a byte array?
    I want to save my databases to amazon s3 without storing them in a file
    Or is there another database that is better suited for that
    Nuwan Sanjeewa Abeysiriwardana
    @nuwansa
    Hi , NavigableSet.headSet with inclusive 'true' is not working, also tailSet with inclusive 'false' not working too. has anyone else experience this. I'm using latest version of mapdb 3.0.8
    to explain further , NavigableSet.headSet with inclusive 'true' not including the equal value in the result set.
    NavigableSet. tailSet with inclusive 'false' including the equal value in the result set
    Jan Kotek
    @jankotek
    @nuwansa it should work, there are unit tests for this case. Maybe you are using some exotic data type where 'equal' is not correctly handled? what is your serializer and config?
    Nuwan Sanjeewa Abeysiriwardana
    @nuwansa
    @jankotek this is the initialization code
    this.db
                .treeSet("map")
                .serializer(new SerializerArrayTuple(Serializer.BIG_DECIMAL, Serializer.LONG))
                .counterEnable()
                .createOrOpen();
    Jan Kotek
    @jankotek
    That should work
    I will look into it jankotek/mapdb#980
    Nuwan Sanjeewa Abeysiriwardana
    @nuwansa
    @jankotek thank you very much
    Qi Chen
    @chenqi0805
    @jankotek Hi, is there plan of re-support encryption API for the DBMaker? If yes, what will be the encryption standards?
    Jan Kotek
    @jankotek
    @chenqi0805 yes, I would like to support encryption. It will be done by block encryption (entire store) or via serializers (only part of data such as Map values)
    Qi Chen
    @chenqi0805

    @jankotek QUES on the hashmap or treemap with nested data structure. With the following code block:

            HTreeMap<String, List<String>> map = (HTreeMap<String, List<String>>) DBMaker.fileDB("map").make().hashMap("map").createOrOpen();
            for (int i = 0; i< 10; i++) {
                final int finalI = i;
                for (int j = 0; j< 10; j++) {
                    final int finalJ = j;
                    map.compute(String.valueOf(finalI), (key, value) -> {
                        if (value == null) {
                            value = new ArrayList<>();
                        }
                        value.add(String.format("%d_%d", finalI, finalJ));
                        return value;
                    });
                }
            }

    It falls into deadloop. Instead, I need to copy the value and then return the modified new copy to make it work.

    HTreeMap<String, List<String>> map = (HTreeMap<String, List<String>>) DBMaker.fileDB("map").make().hashMap("map").createOrOpen();
            for (int i = 0; i< 10; i++) {
                final int finalI = i;
                for (int j = 0; j< 10; j++) {
                    final int finalJ = j;
                    map.compute(String.valueOf(finalI), (key, value) -> {
                        final List<String> newValue;
                        if (value == null) {
                            newValue = new ArrayList<>();
                        } else {
                            newValue = new ArrayList<>(value);
                        }
                        newValue.add(String.format("%d_%d", finalI, finalJ));
                        return newValue;
                    });
                }
            }

    Is it a bug or it is expected? I think this is not an issue with in-memory counterpart (e.g. concurrentHashMap)

    1 reply
    Qi Chen
    @chenqi0805

    Hi, Another question on how expire works in MapDB. The following snippet does not work

    @Test
        public void testExpiration() throws InterruptedException {
            HTreeMap<String, String> map = (HTreeMap<String, String>) DBMaker
    //                .fileDB("map").fileDeleteAfterClose()
                    .memoryDB()
                    .make().hashMap("map")
                    .expireAfterCreate(10)
                    .createOrOpen();
            map.put("a", "b");
            Thread.sleep(4000);
            assertNull(map.get("a"));
            map.close();
        }

    Did I misunderstand how expiration works?

    svukadin85
    @svukadin85
    Hi
    where are mapdb kotlin source files found?
    chaitas
    @chaitas
    Hello
    I want to use SortedTableMap i have ip as key and want multiple values in value section as columns in tables is there any way to achieve it using it ?Tried from examples given but not able to do so if anyone can help on it..
    Thnx
    This is sample data that i want to feed
    3754892057--this is ip hashcode generated
    THis are all values -- "PUB","TH","Thailand","Chon Buri","Ban Talat Bueng","Triple T Internet PCL","triplet.co.th","ISP","45629","JasTel Network International Gateway","30","-"
    @chaitas that structure is called Multimap, but MapDB does not support it yet. I would suggest using Lists as values
    justflier
    @justflier

    Hi, is it supported to store multiple HashMaps in one database? Something like:
    DB db = DBMaker.fileDB("/tmp/test").closeOnJvmShutdown().make();
    HTreeMap<byte[], MyClass> mapDB1 = db.hashMap("map")..keySerializer(Serializer.BYTE_ARRAY).valueSerializer(SERIALIZER.JAVA).createOrOpen();
    HTreeMap<String, Integer> mapDB2 = db.hashMap("info")..keySerializer(Serializer.STRING).valueSerializer(SERIALIZER.INTEGER).createOrOpen();
    MyClass c = new MyClass();
    byte[] b = { 1, 2, 3, 4 };
    mapDB1.put(b, c);
    mapDB2.put("version", 1);
    db.commit();
    db.close();

    I tried this and it worked in a very simple test but I want to be sure this is actually supported. Thank you!

    Jan Kotek
    @jankotek
    @justflier yes, it is supported
    Jure Kajzer
    @freakolowsky

    Hey, quick question.
    On 3.0.8., other than opening and closing a file based DB, is there a (static?) way to check the validity of a DB (properly closed, file corruption, what not).
    MapDB files are relatively small and the use case is, i have to keep rather large source data files they are built on, but if i can verify that sources are no longer required i could release them (which could lead to them being deleted).

    So is there away to do that in a oneliner, if not is DBMaker.make() enough to verify validity or do i have to open all required collections also?
    Thanks.

    Harvey Reginald Specter
    @SangameswaranRS
    @jankotek Is the Android friendly facade out? I'm still getting
    [CIRCULAR REFERENCE:com.android.tools.r8.errors.a: Method name '%%%verify$mapdb' in class 'org.mapdb.DB$Maker' cannot be represented in dex format.]
    Jure Kajzer
    @freakolowsky

    @jankotek I've got a weird issue if anyone wants to chime in:
    I have a custom serialization and i'm getting an exception on deserialization (a readshort returns a negative number when a positive is expected), so i debugged the code to get other object fields that were deserialized before it breaks and then debugged again with those fields to see ho the object is serialized in the first place.

    The thing is, an object with those field values is never created let alone serialized. Up to that point deserialization works as expected.

    What am i missing?

    Jure Kajzer
    @freakolowsky
    Nevermind ... PEBKAC
    Ayoub
    @I_am_ayoub_twitter
    Hi, I am trying to create anIndexTreeList to store instances of a Scala case class like case class Foo(bar: String) but I am unable to get a Serializer for my class.
    How do I created one ?
    By default something like this would create an IndexTreeList[Object]
        val db = DBMaker.tempFileDB().fileMmapEnable().make()
        val list = db.indexTreeList("foo").create()
    stefanmoers
    @stefanmoers

    Using 3.0.8, what is is best way for implementing multimaps?

    I have for example a Map like this:

    Map<String, Map<String, List<String>>> statisticData

    Thanks a lot for your assistance...

    Jan Kotek
    @jankotek
    @stefanmoers composite keys
    Qi Chen
    @chenqi0805
    @jankotek qq - Is BTreeMap<byte[], ...> preferrable to BTreeMap<String, ...> performance-wise?
    Jan Kotek
    @jankotek
    @chenqi0805 there is not much difference. With proper serializer BTreeMap internally compresses strings, so Map<String,...> instantiates strings only for iterators
    DestinyL
    @DestinyL
    I have a question.How do I detect file corruption´╝čThis means that the file is tested before it is initialized.
    2 replies
    Ted Kaplan
    @thirtyseven
    Hey, any chance of doing a minor release with Kotlin 1.4 support? Running into dependency conflicts because of the stdlib 1.2 version selector in the exported pom.xml