Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Running many inserts in a sequnce hangs the code #6

Open
Roeya opened this issue Mar 1, 2015 · 0 comments
Open

Running many inserts in a sequnce hangs the code #6

Roeya opened this issue Mar 1, 2015 · 0 comments

Comments

@Roeya
Copy link

Roeya commented Mar 1, 2015

Using the following code the program hangs after few minutes:

use v5.18;
use UnQLite;
$| = 1;

my $db = UnQLite->open('foo.db',
                       UnQLite::UNQLITE_OPEN_READWRITE|
                       UnQLite::UNQLITE_OPEN_CREATE);

my $round = 1;
while (!-e 'stop') {
    for my $key (1 .. 2000) {
        my $value = $key * rand(10);
        $db->kv_store($key, $value);
        print $key . " $value $round " . $db->errstr . "    \r"; 
        $round++;
    }
}

undef $db;

The reason seems to be a that UnQlite expets you to manually commit after every long sequence of commits - see http://unqlite.org/c_api/unqlite_commit.html

I did ensured that opening and closing the database (using the undef $db) every round prevents the hang,

So please add the unqlite_commit binding to the module and I will test the code to see if it works

Thank you for creating this module it seems to be old alternative the the old DB_File that has no transaction and locking....

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant