MB-9723: Spawn threads based on CPU core count

Spawn fixed number of threads based on the number of CPU
cores present in each machine and allocate these threads
to the various Task Groups as follows...
1. Spawn 2 X number of cpu cores threads in total
2. ceil(10 % of total threads) are aux io threads
3. ceil(10 % of total threads) are non io threads
4. floor (half of the remaining threads) are writer threads
5. finally the remaining threads are reader threads
Examples:
CPU COUNT | # READERS | # WRITERS | # AUX IO | # NON IO
2         | 1         | 1         | 1        | 1
4         | 3         | 3         | 1        | 1
8         | 6         | 6         | 2        | 2
Change-Id: I9c572cfc4e2ff051b87b27e652b467d5087baf37
Reviewed-on: http://review.couchbase.org/31031
Reviewed-by: Chiyoung Seo <chiyoung@couchbase.com>
Tested-by: Chiyoung Seo <chiyoung@couchbase.com>
MB-9712: Add the infrastructure to add metadata to UPR

Note that currently no metadata is being sent

Change-Id: I4f12cdf4070a85624e9e86237208615ceaf288f1
Reviewed-on: http://review.couchbase.org/31018
Reviewed-by: Michael Wiederhold <mike@couchbase.com>
Tested-by: Michael Wiederhold <mike@couchbase.com>
Don't assume that isdigit is in std namespace

Change-Id: Ic219afa4a659d743fbadbde16154e32f403433d8
Reviewed-on: http://review.couchbase.org/31194
Reviewed-by: Trond Norbye <trond.norbye@gmail.com>
Tested-by: Trond Norbye <trond.norbye@gmail.com>
Cast the 0 in assignment to the type

Change-Id: I201bea9d39d9b93dbce2c57f08ba91c2ce6e5679
Reviewed-on: http://review.couchbase.org/31195
Reviewed-by: Trond Norbye <trond.norbye@gmail.com>
Tested-by: Trond Norbye <trond.norbye@gmail.com>
Add prototypes for the atomic functions for win32

No implementation currently. Just trying to make the
other stuff compile so far.

Change-Id: I168c92e0f36f610a6c5def57d16b8985b319139b
Reviewed-on: http://review.couchbase.org/31196
Reviewed-by: Trond Norbye <trond.norbye@gmail.com>
Tested-by: Trond Norbye <trond.norbye@gmail.com>
Added more prototypes for the msvc atomics

Change-Id: Iaee5efb23c04518218240017db6d1d44aba2dda4
Reviewed-on: http://review.couchbase.org/31208
Reviewed-by: Trond Norbye <trond.norbye@gmail.com>
Tested-by: Trond Norbye <trond.norbye@gmail.com>
Don't name the variable we're not using

That eliminates the compiler warning that we're not using it ;-)

Change-Id: I6581889d930e1055bd5f8815ca6174701ea8e877
Reviewed-on: http://review.couchbase.org/31199
Reviewed-by: Michael Wiederhold <mike@couchbase.com>
Tested-by: Michael Wiederhold <mike@couchbase.com>
MB-9766: Don't assume that the string is zero terminated

Change-Id: I7804843d3e411000806c7f6532a7dab3835100ca
Reviewed-on: http://review.couchbase.org/31233
Reviewed-by: Michael Wiederhold <mike@couchbase.com>
Tested-by: Michael Wiederhold <mike@couchbase.com>
Don't abort on upr noop functions

These are getting called by a background task and causing crashes.
Let's just remove the aborts, but leave a comment that we will
implement those functions later.

Change-Id: I232af2e06afc9dd142680188178743bb0fc20d8f
Reviewed-on: http://review.couchbase.org/31235
Reviewed-by: Trond Norbye <trond.norbye@gmail.com>
Tested-by: Trond Norbye <trond.norbye@gmail.com>
Cast the decrement to a signed value

This allows it to work on unsigned datatypes ;-)

Change-Id: Ia6fa5c1a85f0b7f9ce87e625b67dce8d1168354e
Reviewed-on: http://review.couchbase.org/31201
Reviewed-by: Michael Wiederhold <mike@couchbase.com>
Tested-by: Michael Wiederhold <mike@couchbase.com>
No point of specifying C linkage for static func in c++

The function is called directly from C++

Change-Id: I56ef2644380d36b1845753a08a0eeea2a4862665
Reviewed-on: http://review.couchbase.org/31202
Tested-by: Trond Norbye <trond.norbye@gmail.com>
Reviewed-by: Michael Wiederhold <mike@couchbase.com>
Tested-by: Michael Wiederhold <mike@couchbase.com>
use _mkdir on win32

Change-Id: Ie91f4a61dd2afcf4f5690840989e5634a54c6a28
Reviewed-on: http://review.couchbase.org/31206
Tested-by: Trond Norbye <trond.norbye@gmail.com>
Reviewed-by: Michael Wiederhold <mike@couchbase.com>
Don't put using namespace in the headerfile

It caused compile failure on WIN32 due to ambiguity for
symbols.

Change-Id: Ica038cf0ee1919e9257646694aad03ff3e206e20
Reviewed-on: http://review.couchbase.org/31207
Tested-by: Trond Norbye <trond.norbye@gmail.com>
Reviewed-by: Michael Wiederhold <mike@couchbase.com>
Fix directory utilities for win32

Change-Id: I615d84e7c577d5b494d1e23a955cf552b409511f
Reviewed-on: http://review.couchbase.org/31210
Tested-by: Trond Norbye <trond.norbye@gmail.com>
Reviewed-by: Michael Wiederhold <mike@couchbase.com>
Comment out code so that it compiles on win32

Change-Id: Iba34801d05a6c9d64c5883c98b84a8654c284057
Reviewed-on: http://review.couchbase.org/31205
Reviewed-by: Michael Wiederhold <mike@couchbase.com>
Tested-by: Michael Wiederhold <mike@couchbase.com>
Refactor add stream test cases

Change-Id: I8f9e14c252d7c00fe4f654448bd706262120df0b
Reviewed-on: http://review.couchbase.org/31076
Reviewed-by: Trond Norbye <trond.norbye@gmail.com>
Tested-by: Trond Norbye <trond.norbye@gmail.com>
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
WIP

Change-Id: I4f5d6a49e31e992bd34b2bce5d8089ccbaffb1f4