trivial example to write to disk

38 views
Skip to first unread message

Joel Nider

unread,
Mar 18, 2020, 3:26:24 PM3/18/20
to wiredtiger-users
Hi,
I'm writing my first WT app using the C API. I have followed the examples on the website: https://source.wiredtiger.com/develop/ex_cursor_8c-example.html My goal is to write about 1 billion key/value pairs (64-bit ints for both the key & value encoded as strings).

I am able to create a db, open a cursor and write key/values but run out of memory after a few gigabytes (Linux kills my app). I was expecting WT to automatically write the data to disk, but after the crash my data files are less than 100KB (sometimes a lot less). Any ideas what I'm missing?

Thanks,
Joel

Eric Milkie

unread,
Mar 18, 2020, 3:59:30 PM3/18/20
to wiredtiger-users
I believe you need to turn on Automatic Checkpoints, which the example code does not do.  Or you can call checkpoint manually.

-Eric

Amirouche Boubekki

unread,
Mar 18, 2020, 3:59:41 PM3/18/20
to wiredtiger-users
Please provide an example code.

Joel Nider

unread,
Mar 18, 2020, 5:57:07 PM3/18/20
to wiredtiger-users
I see - there are many parameters to wiredtiger_open() that I was not using.

I reduced the cache size, turned on logging, and now it seems to behave much better (I can load 100M entries successfully, and will let it run longer later).
It actually seems that I just didn't have enough free RAM on that machine, and can run with default values if its the only thing running.

Thanks for your helpful pointer.

Amirouche Boubekki

unread,
Mar 18, 2020, 6:45:04 PM3/18/20
to wiredtiger-users
You can also close and reopen the connection.
> --
> You received this message because you are subscribed to the Google Groups "wiredtiger-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to wiredtiger-use...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/wiredtiger-users/58569564-dde7-4688-9616-fce72181af52%40googlegroups.com.



--
Amirouche ~ https://hyper.dev
Reply all
Reply to author
Forward
0 new messages