Commit graph

222 commits

Author SHA1 Message Date
Gregory Burd
3310129918 * Check to make sure that all ASYNC_NIF_REPLY() calls are at the end of their
blocks, just before return and after releasing any local resources or locks.

* Check the return value of when setting up cursor caches so as not to miss an
ENOMEM or other error.

*Cleanup and free resources when closing a connection handle.

* Add a few missing mutex unlock calls on error paths.

* Ensure all resources are free'd/released/closed during truncate error paths.

* Free up alloc'ed copies of keys, cursor handles and sessions on unload.
2013-04-20 07:38:11 -04:00
Gregory Burd
01a79a08c0 Add a comment and remove an mutext unlock on error because this function is not
where the lock is acquired.
2013-04-20 06:13:41 -04:00
Gregory Burd
be95229af9 On error when fetching stats, ignore and return whatever you have so far. 2013-04-19 16:44:51 -04:00
Gregory Burd
17cfdcd04f Fix default tuple. 2013-04-19 16:07:18 -04:00
Gregory Burd
e9145c344c Ignore eperm on status cursors and empty cursors (for now). 2013-04-19 15:46:58 -04:00
Gregory Burd
5d3cb9997a For now we ignore eperm and ebusy error returns on fold and drop. 2013-04-19 15:09:29 -04:00
Gregory Burd
b936b99531 Minor fix. 2013-04-19 15:00:57 -04:00
Gregory Burd
d505f7f9c8 Whitespace. Call wterl:drop not truncate for drop calls and set force
to true when calling so that we ignore ENOENT.  Change the session estimate
down a bit.
2013-04-19 14:55:32 -04:00
Gregory Burd
40bdda15bb Create links for bzip2 shared libraries. 2013-04-19 12:33:20 -04:00
Gregory Burd
7b1dcb507d Need to copy shared library links for bzip2 as well (duh). 2013-04-19 11:14:03 -04:00
Gregory Burd
203fa1a54d Merge branch 'gsb-async-nifs3' of github.com:basho-labs/wterl into gsb-async-nifs3 2013-04-19 11:06:25 -04:00
Gregory Burd
01a8926160 Shared libs and files linking to them must be copied into our priv
dir so that at runtime we can find the correct files.
2013-04-19 11:03:40 -04:00
Gregory Burd
8d8ceecc8b enif_get_string can return < 1 when it copies less than the buffer size
you pass into it, that'd result in a non-zero (aka true) test when in fact
it's a problem if the argument isn't passed completely (however unlikely
that is).

enif_alloc_env() requires that later you enif_free_env() which I wasn't doing,
this seems to keep memory steady in test runs.
2013-04-19 09:11:41 -04:00
Gregory Burd
7a1e683a47 Working toward a more automated valgrind. 2013-04-18 17:07:27 -04:00
Gregory Burd
95d8a28453 Remove unused num_contexts count. Cleanup the session/cursor cache
init process.
2013-04-18 13:36:24 -04:00
Gregory Burd
728d2281e0 Ensure that we init the shared cache when asking for a cursor before
asking for a session.
2013-04-18 12:24:49 -04:00
Gregory Burd
846f7f72ba Must compile before commit, must compile before commit... 2013-04-18 12:01:34 -04:00
Gregory Burd
7a148b9f19 get, put, delete don't use sessions, only cursors so don't fetch the
shared session.
2013-04-18 11:59:10 -04:00
Gregory Burd
83bca853f3 Store copies of Uri as keys in the hash table. 2013-04-18 11:47:12 -04:00
Gregory Burd
60dd048b7e Move the FIFO Queue implementation into its own file (fifo_q.h). Work
on the nif_unload path.  Free up resources owned by wterl.c when
unloading.  Continue to evolve the build script.  Add to khash the ability
to create a hash that maps from a pointer to a value. There is still a segv
due to a race wterl.c:do_unload() which needs to be addressed.
2013-04-18 10:37:36 -04:00
Gregory Burd
db953f5b39 Moved num_queue estimate earlier so as to ensure that the amount of
memory allocated, zero'ed and free'd was consistent.  Skip free'ing
async environment as Erlang will free that for us when we no longer
reference it.  Fix the memory leak (or at least one of them) by no
longer copying the Uri into the hash table.
2013-04-17 18:26:59 -04:00
Gregory Burd
1ae8e5698f Ensure that the ratio of workers to queues is 2:1 and that there are at
least 2 queues regardless.  Fix a few race conditions (h/t Sue from
WiredTiger for some nice work) and cherry pick (for now) a commit that
fixes a bug I triggered and Keith fixed (in < 10min from report) related
to WiredTiger stats.  Ensure that my guesstimate for session_max is no
larger than WiredTiger can manage.  Continue to fiddle with the build
script.
2013-04-17 16:48:23 -04:00
Gregory Burd
f664c303d8 Disable prefix compression (for now). 2013-04-17 14:23:56 -04:00
Gregory Burd
123dfa600e Simplified the worker look function. Added ability to pick block
compressor in config, default is snappy, off is {block_compressor, none}.
2013-04-17 13:19:06 -04:00
Gregory Burd
87f70d75a1 Inline the fifo_q functions to speed them up and silence compiler warnings
for unused API calls.  Add a fifo_q_full call to hide the details of that.
Alloc work queues along with the async_nif at the end of that memory block.
Fix a few places where things should be free'd and were not.  Change enqueue
to return 0 when shutting down.  Fix a race related to shutdown.  When I use
gdb eunit calls ?cmd() seem to fail, so I've created rmdir:path() to replace
?cmd("rm -rf path") calls.
2013-04-17 11:17:13 -04:00
Gregory Burd
1913e7fdf5 Continue to iterate on the build system to accomodate shared libs. 2013-04-16 21:46:53 -04:00
Gregory Burd
5e80477d4a Merge remote-tracking branch 'origin/gsb-async-nifs3' into gsb-async-nifs3 2013-04-16 19:34:11 -04:00
Gregory Burd
13a9036764 So, WiredTiger prefers that extensions be shared libraries however those
extensions reference other shared libraries.  Previously I tried to turn
all those shared libs into static libs, however that didn't pan out so well.
So now the libwiredtiger.so library is loaded by wterl.so also, later on
during use libwiredtiger.so will load libwiredtiger_snappy.so and
libwiredtiger_bzip2.so which now have libsnappy.a and libbz2.a respectively
linked statically so as to avoid confusion.
2013-04-16 19:31:10 -04:00
Gregory Burd
76d7a7d0a3 Revert a small change 2013-04-16 17:20:57 -04:00
Gregory Burd
2d077a0baf Explicitly close cursors we open despite knowing they'll be closed with the session later. 2013-04-16 17:15:23 -04:00
Gregory Burd
3dab6a2dc5 Clean up 2013-04-16 17:09:34 -04:00
Gregory Burd
36c1d3f829 Move things around in the build script to get a bit of reuse. 2013-04-16 16:24:04 -04:00
Gregory Burd
bd4d852a19 Remove wildcards from the patch file names and fix checkout of wiredtiger repo to pull and track remote branch. 2013-04-16 17:41:00 +00:00
Gregory Burd
249c600554 Switching back to static linking to avoid platform issues and have
confidence when in deployment of what code is being used.
2013-04-16 11:47:04 -04:00
Gregory Burd
941bb0a929 Whitespace 2013-04-16 11:46:51 -04:00
Gregory Burd
ba41dd7fb6 Use the table name in get/put/delete calls to form an "affinity" with a
worker queue so that we spread work around and make it more likely that
work for a given table goes first to a given set of worker threads.
2013-04-15 18:46:06 -04:00
Gregory Burd
371779d14e Return to alloc'ed requests because there may be many more in flight
than those in the various queues.  Reenable the (still failing)
truncate tests (because they don't SEGV anymore).  Still might be
a memory leak, next up is valgrind.
2013-04-15 17:37:14 -04:00
Gregory Burd
668109de25 Added match/gt/lt atom return for cursor_search_near() call. Changed
the request queue over to a simple fifo queue which could (if needed)
be made lock-free.  Cursor searches can optionally now specifiy that
they are mid-scan so as not to have their cursor handles reset every
call.
2013-04-15 15:22:12 -04:00
Gregory Burd
e37c5b68d9 Type-o fixed. 2013-04-15 00:25:00 -04:00
Gregory Burd
cc73310cb3 Missed a change. 2013-04-15 00:11:48 -04:00
Gregory Burd
5ba491adfa We don't use the scheduler id from Erlang anymore in async_nif so
stop sending it over.  Allow the user to set a "type" of storage
in their config to either 'table' for btree or 'lsm' for a log
structured merge tree.  Various other cleanup.
2013-04-15 00:08:01 -04:00
Gregory Burd
9ed2137730 A bit of cleanup 2013-04-14 19:33:14 -04:00
Super-User
15a9a70c41 bzero isn't portable, use memset instead. Include bzip2 and snappy source for use by WT block compression
e
2013-04-14 21:23:57 +00:00
Gregory Burd
22643fc312 Change from waking up all threads to waking up one thread. 2013-04-14 13:54:45 -04:00
Gregory Burd
8fe9dc9bad This is a different approach from async2, instead of a single queue
and many workers this has a queue per scheduler and a few workers per
queue.
2013-04-14 08:44:54 -04:00
Gregory Burd
456129e7f3 Reusing closed cursors is bad for your health (SEGV), don't do that.
Also a bit of paranoia, bzero after all enif_alloc calls.
2013-04-12 16:59:10 -04:00
Gregory Burd
1962640382 Move the cleanup code into conn_close and remove the need for a dtor
function for resource GC/cleanup.  It's easier.
2013-04-12 16:09:00 -04:00
Gregory Burd
b0ca1e4098 WIP -- 41 tests pass, 3 fail = progress! Right now I have the connection
dtor commented out, otherwise it would SEGV on GC.  Some of the truncate
tests fail (race?) but don't SEGV, so that's not so bad.  Fixed numerous
issues and also removed a mutex and queue of idle worker threads because
it isn't used so why bother with it?
2013-04-12 15:25:56 -04:00
Gregory Burd
5a73264307 WIP -- Most tests passing, truncate and drop failing due to EBUSY,
also not sure why there is a segv when exiting but not in gdb.
Unlock mutex before returning error codes.  Alloc/free copies of some
strings allocated on the stack.
2013-04-11 11:57:41 -04:00
Gregory Burd
5c0295624d WIP -- most tests running, a few commented out, sometimes a segv on exit 2013-04-08 17:21:48 -04:00