Fix various memory leak/not initialized errors

These were found with valgrind and fix the failover log unit test
which was sporadically failing. I plan on doing a second pass of
this stuff, but want to get this in quickly since if fixes an issue.

Change-Id: Ic13e6439700d61c87e8500da8eca7b2e8260f0e5
Reviewed-on: http://review.couchbase.org/34354
Reviewed-by: abhinav dangeti <abhinav@couchbase.com>
Tested-by: abhinav dangeti <abhinav@couchbase.com>
Remove compile warnings

Change-Id: If42fe9ebd56b1c26b3612b11dbc2dcc01ae5141d
Reviewed-on: http://review.couchbase.org/34379
Tested-by: buildbot <build@couchbase.com>
Reviewed-by: Chiyoung Seo <chiyoung@couchbase.com>
Tested-by: Chiyoung Seo <chiyoung@couchbase.com>
MB-10240: Check vbucket existence in ItemResidentCallback

We need to make sure the vbucket exists before trying to lookup
and item in the cache.

Change-Id: I721b6333fa59d70688facf762ef35d2d78f7fd36
Reviewed-on: http://review.couchbase.org/34386
Reviewed-by: Chiyoung Seo <chiyoung@couchbase.com>
Reviewed-by: Sundararaman Sridharan <sundar.sridharan@gmail.com>
Tested-by: buildbot <build@couchbase.com>
failover json debug stuff

Change-Id: I6a86575782063a8ba77e180fc8961c24fcb5f436
Grab the lock before registering seq-based replication cursors.

Change-Id: I8bed8da1f222ccc1d04bc22ee64951cf09dd9fc5
Reviewed-on: http://review.couchbase.org/34388
Reviewed-by: Chiyoung Seo <chiyoung@couchbase.com>
Tested-by: Chiyoung Seo <chiyoung@couchbase.com>
MB-9986 ensure futureQueue's heap sort

Windows ep-engine unit tests enabling fix..
Microsoft Visual Studio has a debug heap checker which
requires that STL container priority_queue always satisfies
the HEAPIFY property. In GIO's implementation it is possible
that futureQueue can disobey the heap sort property temporarily
when we wake and cancel tasks.
To fix, always re-sort queue when task is woken or cancelled
Change-Id: I5631a4ec7e609953f037cd5a7c689ed876b40c12
Reviewed-on: http://review.couchbase.org/34264
Reviewed-by: Chiyoung Seo <chiyoung@couchbase.com>
Tested-by: Chiyoung Seo <chiyoung@couchbase.com>
Fix leaking couchstore handles

Change-Id: Ib24667fe6c7cbf2c1cf25a20758b1f8157031786
Reviewed-on: http://review.couchbase.org/34394
Tested-by: Trond Norbye <trond.norbye@gmail.com>
Reviewed-by: Chiyoung Seo <chiyoung@couchbase.com>