MB-7471: Fix race condition in persistence checkpoint test

Thread 1 and 2 would issue a persist checkpoint command, both of
which are expected to time out. Thread 1's command would finish and
bump the timeout up and then go on to load items and call the
checkpoint persistence command again. This persistenc command would
finish and lower the time out value back to the default value. Thread
2's first checkpoint persistence command now finishes, but when we
check to see if the timeout was bumped up we fail the test.

We should just be checking that checkpoint persistence happens after
we join the threads in order to fix this problem.

Change-Id: Ie4b34e647684c2760a620e4c2aa40c3ea724caff
Reviewed-on: http://review.couchbase.org/23756
Reviewed-by: Jin Lim <jin@couchbase.com>
Tested-by: Michael Wiederhold <mike@couchbase.com>
MB-7500: Add averages to cbstats histograms

Below is an example of the what the new timing stats
will look like. Note the new "Avg" field.

rw:fsWriteTime (522402 total)
   2us - 4us     : ( 15.75%)  82276 ##############
   4us - 8us     : ( 47.23%) 164469 #############################
   8us - 16us    : ( 62.28%)  78614 ############
   16us - 32us   : ( 80.93%)  97422 ################
   32us - 64us   : ( 88.40%)  38999 #####
   64us - 128us  : ( 91.92%)  18389 ##
   128us - 256us : ( 94.04%)  11077 #
   256us - 512us : ( 99.70%)  29589 ####
   512us - 1ms   : ( 99.93%)   1178
   1ms - 2ms     : ( 99.98%)    276
   2ms - 4ms     : ( 99.99%)     40
   4ms - 8ms     : ( 99.99%)     14
   8ms - 16ms    : ( 99.99%)     30
   16ms - 32ms   : (100.00%)     25
   32ms - 65ms   : (100.00%)      2
   65ms - 131ms  : (100.00%)      1
   131ms - 262ms : (100.00%)      1
   Avg           : (   31us)

Change-Id: Ic3ec69fbac450dd49a4411208e6f634c839364e0
Reviewed-on: http://review.couchbase.org/23757
Reviewed-by: Jin Lim <jin@couchbase.com>
Tested-by: Michael Wiederhold <mike@couchbase.com>
MB-7498: Change high and low watermarks to 85 and 75 respectively

Change-Id: Ie37b79f979b7b7c713ce5a4d8785b2e94245aa33
Reviewed-on: http://review.couchbase.org/23794
Reviewed-by: Jin Lim <jin@couchbase.com>
Tested-by: Michael Wiederhold <mike@couchbase.com>
MB-7459 should count expired items during warmup

For better account of expired items, numExpiredItems must
also count any item that has expired (and deleted) during
the data loading phase of warmup.

Unit test case that requires memcached test api will be
merged with a separate patch

Change-Id: Ia1b8cce6daf29c5bca83179c63bfeb1e3e7c2be0
Reviewed-on: http://review.couchbase.org/23934
Tested-by: Jin Lim <jin@couchbase.com>
Reviewed-by: Chiyoung Seo <chiyoung.seo@gmail.com>
Reviewed-by: Michael Wiederhold <mike@couchbase.com>
MB-7532 Set the default value of a rev sequence num to 1.

As the XDCR always expects a positive value for a revision
sequence number, its default value should be initialized to 1.

Change-Id: I6a281ad55d9c5d7e4ed93a6d4e33c609606f7f29
Reviewed-on: http://review.couchbase.org/23964
Reviewed-by: Michael Wiederhold <mike@couchbase.com>
Reviewed-by: Jin Lim <jin@couchbase.com>
Tested-by: Chiyoung Seo <chiyoung.seo@gmail.com>
MB-7567: Don't copy chk_end when merging checkpoints

Change-Id: I2c195e1efb6b562ca3c3b71568512ffa8e535112
Reviewed-on: http://review.couchbase.org/24144
Reviewed-by: Michael Wiederhold <mike@couchbase.com>
Tested-by: Michael Wiederhold <mike@couchbase.com>
MB-7204: Invalid checkpoint displays error from cbstats

Change-Id: Ic429130e89d3014c22e28c6501647d06da027ab4
Reviewed-on: http://review.couchbase.org/24146
Reviewed-by: Michael Wiederhold <mike@couchbase.com>
Tested-by: Michael Wiederhold <mike@couchbase.com>
MB-7580: Make sure mutation number is always increasing

Change-Id: Ic079c9b78f3f4bd9cd88b0605853e80120b72ced
Reviewed-on: http://review.couchbase.org/24147
Reviewed-by: Jin Lim <jin@couchbase.com>
Reviewed-by: Chiyoung Seo <chiyoung.seo@gmail.com>
Tested-by: Chiyoung Seo <chiyoung.seo@gmail.com>
MB-7583: Move checkpoint cursors when checkpoints are merged

Change-Id: Id121b2567dac41c6c29e0aaf8793f2247b33f869
Reviewed-on: http://review.couchbase.org/24150
Reviewed-by: Chiyoung Seo <chiyoung.seo@gmail.com>
Tested-by: Chiyoung Seo <chiyoung.seo@gmail.com>
MB-7593: Increase queue_size when re-persisting an item in same chk

Change-Id: I88d9d92207db0a7a637ca6b58b23147a3d94c0a4
Reviewed-on: http://review.couchbase.org/24186
Reviewed-by: Chiyoung Seo <chiyoung.seo@gmail.com>
Tested-by: Chiyoung Seo <chiyoung.seo@gmail.com>
MB-7375: Return TMPFAIL for locked key when doing touch or gat

Change-Id: I7c5205a6c0a62c887e2681f98e46f056852b1ac7
Reviewed-on: http://review.couchbase.org/24281
Reviewed-by: Chiyoung Seo <chiyoung.seo@gmail.com>
Tested-by: Michael Wiederhold <mike@couchbase.com>
MB-7652: Make sure to register cursors in chks when moving them

This was accidnetally left out of my previous checkpoint cheanges

Change-Id: Ib6ded7ba88bd2589a6a243cdecbbf9bf1b7985ec
Reviewed-on: http://review.couchbase.org/24327
Reviewed-by: Chiyoung Seo <chiyoung.seo@gmail.com>
Reviewed-by: Michael Wiederhold <mike@couchbase.com>
Tested-by: Michael Wiederhold <mike@couchbase.com>
MB-100: Remove unused variables and redundent assignments

Change-Id: Ic31c276a06c09f91e6cbf5ddaf9accb7184761df
Reviewed-on: http://review.couchbase.org/24335
Reviewed-by: Chiyoung Seo <chiyoung.seo@gmail.com>
Tested-by: Michael Wiederhold <mike@couchbase.com>
MB-7519: Better flusher batching for writes

This change removes the outgoing queue in ep.cc and pushes
dirty items directly from the checkpoint queues into the
couchkvstore where they are persisted to disk. This
improves batching because we are now able to grab all
dirty items in a vbucket as opposed to grabbing items
an putting them into an intermediate queue where they
would wait to be persisted.

Change-Id: I39e9c25ad3380b3e045002967c9532b16758e187
Reviewed-on: http://review.couchbase.org/24190
Reviewed-by: Chiyoung Seo <chiyoung.seo@gmail.com>
Tested-by: Michael Wiederhold <mike@couchbase.com>
MB-7476: Prepend bucket name to all log messages

Change-Id: I1053494b5359c702c25e4bffa7e88959cb87be53
Reviewed-on: http://review.couchbase.org/24249
Reviewed-by: Chiyoung Seo <chiyoung.seo@gmail.com>
Tested-by: Chiyoung Seo <chiyoung.seo@gmail.com>
MB-7532 Set the default value of a rev sequence num to 1.

As the XDCR always expects a positive value for a revision
sequence number, its default value should be initialized to 1.

Change-Id: I7a281ad55d9c5d7e4ed93a6d4e33c609606f7f29
Reviewed-on: http://review.couchbase.org/23964
Reviewed-by: Michael Wiederhold <mike@couchbase.com>
Reviewed-by: Jin Lim <jin@couchbase.com>
Tested-by: Chiyoung Seo <chiyoung.seo@gmail.com>
Reviewed-on: http://review.couchbase.org/24002
MB-7543 Rev sequence number shouldn't be set to zero.

We should make sure that the revision sequence number shouldn't
be zero during warmup or when we receive tap_deletion,
tap_mutation, set_with_meta, and delete_with_meta.

Change-Id: I3316e0b688e2f29efc94533fab6fe61df0ea871a
Reviewed-on: http://review.couchbase.org/24004
Reviewed-by: Jin Lim <jin@couchbase.com>
Tested-by: Chiyoung Seo <chiyoung.seo@gmail.com>
Merge remote-tracking branch 'gerrit/2.0.0' into 2.0.1

Change-Id: Ifef980916191adc0b7bc60e9d50bf201e051add6
MB-7597: correct the logic of updating bgfetcher global variable

Change-Id: Ib2f460e04ec7bf0cf2c4e06b45774f9f2dd4d91c
Reviewed-on: http://review.couchbase.org/24553
Reviewed-by: Michael Wiederhold <mike@couchbase.com>
Tested-by: Michael Wiederhold <mike@couchbase.com>
Merge remote-tracking branch 'gerrit/2.0.1' into 2.0.2

Change-Id: Icc38e08ae2b7684e64dd260c014c6e711dcdcaf0