MB-9738: Fix quick bucket deletion after recreate

Reset curWorkers to 0 when the last bucket disappears
so that the next set does not result in blocked
threads

Change-Id: I73bb8936be01beaac606c49b75982478e414f94c
Reviewed-on: http://review.couchbase.org/31306
Reviewed-by: Michael Wiederhold <mike@couchbase.com>
Tested-by: abhinav dangeti <abhinav@couchbase.com>
Remove warnings from c files

Change-Id: I4c86738cb25e6951c72d6b0a351675af5104fb4f
Reviewed-on: http://review.couchbase.org/31311
Reviewed-by: Trond Norbye <trond.norbye@gmail.com>
Tested-by: Trond Norbye <trond.norbye@gmail.com>
MB-9769: Test case where item_pager hangs

- Noticed that in test_item_pager testcase,
sometimes the chunk of data removed makes mem_used
just a little lesser than the high_water_mark,
in this case mem_used never goes all the way down
to being lesser than or equal to the low_wat_mark.

- Fix ensures that in the above mentioned case
whenever the mem_used crosses the high_wat_mark,
mem_used always comes down to being lesser than or
equal to the low_wat_mark.

Change-Id: I61ceb94bdc59909c40881785e48d500c5dd98e99
Reviewed-on: http://review.couchbase.org/31310
Reviewed-by: Sundararaman Sridharan <sundar.sridharan@gmail.com>
Tested-by: Sundararaman Sridharan <sundar.sridharan@gmail.com>
MB-9715: Fixup UPR step

Check the result value from the message producers and
propagate errors back to the core, and return
the correct return value to avoid spinning and
eating up the CPU.

Change-Id: I360d014884425a62e8e8ec1ae60614ceaf8a6ccb
Reviewed-on: http://review.couchbase.org/31121
Reviewed-by: David Liao <david.liao@couchbase.com>
Tested-by: David Liao <david.liao@couchbase.com>
Fix failing upr producer stream unit test

Change-Id: I41d56069240e0c2c84d58b638c936731f16b0414
Reviewed-on: http://review.couchbase.org/31352
Reviewed-by: Michael Wiederhold <mike@couchbase.com>
Tested-by: Michael Wiederhold <mike@couchbase.com>
Use forward_iterator_tag for histogram

Looks like we're missing some methods in order to be
a random iterator (getting tons of errors with MSVC).
Since we're not using them in both directions anyway
the easiest solution was just to move it to a forward
iterator (errors from template code generates a LOT
of unreadable errors ;-) )

Change-Id: I9a8df00b6b18b6096336cffcb31d09a88cdbf044
Reviewed-on: http://review.couchbase.org/31327
Reviewed-by: Michael Wiederhold <mike@couchbase.com>
Tested-by: Michael Wiederhold <mike@couchbase.com>
Remove unused optional parameter to ThreadLocal

Change-Id: I8f1dd362de01bd7ca7baa76326cb61beec3f534c
Reviewed-on: http://review.couchbase.org/31328
Reviewed-by: Michael Wiederhold <mike@couchbase.com>
Tested-by: Michael Wiederhold <mike@couchbase.com>
Remove unused functionality in AtomicQueue

Change-Id: Ic18d74484ed89d1d7e0debc7f007c38946c2b9a5
Reviewed-on: http://review.couchbase.org/31329
Reviewed-by: Michael Wiederhold <mike@couchbase.com>
Tested-by: Michael Wiederhold <mike@couchbase.com>
Create a simplified AtomicQueue for windows

This currenly use a single mutex for each operation.
Given that it is only used for TAP and UPR and that we won't
have _that_ many concurrent thread calling it it might be good
enough for windows currently.

Change-Id: Ibeed856c0694556e7e5caae3e9a412d7f5a1fb1a
Reviewed-on: http://review.couchbase.org/31330
Reviewed-by: Michael Wiederhold <mike@couchbase.com>
Tested-by: Michael Wiederhold <mike@couchbase.com>
Use C++ atomics if available for spinlock

Change-Id: I6b707f168b399015523926d3e7eb93aca382f497
Reviewed-on: http://review.couchbase.org/31331
Reviewed-by: Michael Wiederhold <mike@couchbase.com>
Tested-by: Michael Wiederhold <mike@couchbase.com>
fix unit test worker stats

Change-Id: I3c07fe3d8208d91531720e14460687b8590a06fc
Reviewed-on: http://review.couchbase.org/31350
Reviewed-by: Michael Wiederhold <mike@couchbase.com>
Tested-by: Michael Wiederhold <mike@couchbase.com>
add unit test for max_threads override feature

By default, ep-engine will spawn 2X times the number of cpu
cores, threads. But we also have an way to override this
by specifying a non-zero max_threads parameter.
Enhance existing unit test to test this feature too

Change-Id: I1f8e0a680bb79f0883a86e763fb13bcaab6ee6e4
Reviewed-on: http://review.couchbase.org/31384
Reviewed-by: David Liao <david.liao@couchbase.com>
Tested-by: David Liao <david.liao@couchbase.com>
Ignore win32 build artifacts

Change-Id: I53734cf77f2c301ec8c2fc877d384797f588d30a
Reviewed-on: http://review.couchbase.org/31414
Reviewed-by: Trond Norbye <trond.norbye@gmail.com>
Tested-by: Trond Norbye <trond.norbye@gmail.com>
MSVC don't support alarm()

It is just used as a safety net anyway

Change-Id: Ic2861abefe4363a25bdb75a35c826343922df2ba
Reviewed-on: http://review.couchbase.org/31412
Reviewed-by: Trond Norbye <trond.norbye@gmail.com>
Tested-by: Trond Norbye <trond.norbye@gmail.com>
Removed unused functionality in RCPtr

Change-Id: I262f6e4ffeabb968c989dead51d7db9319167898
Reviewed-on: http://review.couchbase.org/31336
Reviewed-by: Trond Norbye <trond.norbye@gmail.com>
Tested-by: Trond Norbye <trond.norbye@gmail.com>
Use our own thread wrapper for tests

Change-Id: Id32ebcaa3ae2967cbc4c8fbdcb6ccff641ff2353
Reviewed-on: http://review.couchbase.org/31411
Reviewed-by: Michael Wiederhold <mike@couchbase.com>
Tested-by: Michael Wiederhold <mike@couchbase.com>
Revert "MB-9715: Fixup UPR step"

This reverts commit cac72f4cd6abff127364c9251d42bb5a45a71c68.
Add a snapshot marker when backfill ends

Backfilling items from disk is considered a snapshot so we need
to make sure that we add a snapshot marker to the ready queue
once backfill finishes.

Change-Id: I171080e683087e3e6f10f43b599778a03cba0a87
Move stream class to its own source/header file

Change-Id: I9d865fd8f0129dd216bb843c23128289b79d3f99
Add an ActiveStream class

Change-Id: If884c335131da9f9138e63a2dda15d28fdc9a3b5