Search code examples
javascalakyotocabinet

Kyotocabinet and Scala(Java): Limit of DB files open?


I write scala application that use a lot of Kyotocabinet Db files (i need to open 500-3k little kyotocabinet files at one time).
But after 512 opened (created) db files i have a error "Error:success: no error", and new db file does not created.
After googling i found similar problem with Tokyo Cabinet + Java here: https://groups.google.com/forum/#!msg/tokyocabinet-users/ve6OsRm_hyU/hXC7795iqPsJ but without solution.
So what's the deal ? How can i open more kyotocabinet files in one application ? May be there is a some bug in Kyotocabinet ?


Solution

  • Ok it seems that i found the answer for my question...
    This is not a Java or Scala specific issue but a Kyotocabinet
    First i try to reproduce this behaviour in another language. So i writed test program using Perl , and it fails too, but with more informative message:
    terminate called after throwing an instance of 'std::runtime_error'
    what(): pthread_key_create

    After that got sources of kyotocabinet and researched that for every kyoto File() object special TSDKey object created, and this object create pthread_key. By default one process can create limited number of this keys, and this number defined in PTHREAD_KEYS_MAX.
    So it seems that open more than 512 kyoto db files in one process is not possible :(