MB-100: Fix false failure in "get meta followed by set" test

Change-Id: Ia8fea05d431b45901d9fa33d61677076ee0accda
Reviewed-on: http://review.couchbase.org/19450
Reviewed-by: Chiyoung Seo <chiyoung.seo@gmail.com>
Tested-by: Michael Wiederhold <mike@couchbase.com>
MB-6062: Better error checking in couchkv-store getPersistedStats

This fix checks to see if we have recieved an error code from the
tellg ifstream function and logs an error and returns from the
function if so. We also add a NULL termination character to the end
of our ifstream buffer just in case one doesn't exist. This prevents
an error when parsing this value as json and adding the extra byte
prevents us from having to copy the entire buffer if a NULL
terminator doesn't already exist.

Change-Id: I08fdb6476d633d3a7a36e133bb11b601974cb60c
Reviewed-on: http://review.couchbase.org/19465
Reviewed-by: Chiyoung Seo <chiyoung.seo@gmail.com>
Tested-by: Chiyoung Seo <chiyoung.seo@gmail.com>
Revert "MB-6086: Remove add meta command"

This reverts commit 1d7a13acd1841cd779093d784a2fcd07d910c09f.

Change-Id: I7dd91b72a7c45703108f28acee5e0046653a2370
Reviewed-on: http://review.couchbase.org/19489
Tested-by: Chiyoung Seo <chiyoung.seo@gmail.com>
Reviewed-by: Chiyoung Seo <chiyoung.seo@gmail.com>
MB-100: Refactor add_with_meta test function

Change-Id: Ia3013d7e2e5a2acaeabbe0979241692c45b6830a
Reviewed-on: http://review.couchbase.org/19490
Tested-by: Chiyoung Seo <chiyoung.seo@gmail.com>
Reviewed-by: Chiyoung Seo <chiyoung.seo@gmail.com>
MB-6176: expose TAP_FLAG_TAP_FIX_FLAG_BYTEORDER to python

Change-Id: I272b3c0e8a8b1961df31b2380de3808267902f43
Reviewed-on: http://review.couchbase.org/19496
Tested-by: Steve Yen <steve.yen@gmail.com>
Reviewed-by: Chiyoung Seo <chiyoung.seo@gmail.com>
MB-6194 Update access scanner run counter when it is completed.

Change-Id: Idb9481c5e30087dbe8ede37f26b9b01a71a26af5
Reviewed-on: http://review.couchbase.org/19504
Reviewed-by: Michael Wiederhold <mike@couchbase.com>
Tested-by: Chiyoung Seo <chiyoung.seo@gmail.com>
MB-3968: Catch exception if stats cmd fails

As a result, collect_info can move to next bucket in case memcached
bucket doesn't support some stats commands such as tap/hash/dispatcher

Change-Id: I0429f6a6991386c7bc8baf1f333a9c15c3fb3de2
Reviewed-on: http://review.couchbase.org/19565
Tested-by: Bin Cui <bin.cui@gmail.com>
Reviewed-by: Pavel Paulau <pavel.paulau@gmail.com>
MB-6211 Only one access scanner should be scheduled at any time

If a user sets the access scanner task interval to a shorter
period, there is a chance of having multiple acccess scanner
tasks scheduled in a very short time. This change makes sure
that there is only one access scanner task scheduled at any time.

Change-Id: Ida13541b9f2b315839abf7f136af188643f54240
Reviewed-on: http://review.couchbase.org/19572
Reviewed-by: Michael Wiederhold <mike@couchbase.com>
Tested-by: Chiyoung Seo <chiyoung.seo@gmail.com>
MB-6215 Check each vbucket's bg queue to set the task sleep time

Instead of relying on the bg fetch remaining counter, this change
checks each vbucket's bg fetch queue to determine if the bg
fetcher daemon task should sleep or not.

Change-Id: Ia98a71dfde30c1fa7bcea32fbe88b0a1e6dcc2bc
Reviewed-on: http://review.couchbase.org/19587
Reviewed-by: Michael Wiederhold <mike@couchbase.com>
Tested-by: Chiyoung Seo <chiyoung.seo@gmail.com>
MB-6161 Consider write queue size and disk usage for compaction

This change allows us to consider the disk write queue size and
current disk usage in determining if compaction is required or
can be skipped.

If the disk write queue size is above its max cap and the current
disk usage is still below 2/3 of disk space, we skip the
compaction temporarily.

On the other hand, if the current disk usage is above 90% of
disk space, we schedule the compaction as long as the
fragmentation ratio is above 2%.

In other cases, we schedule the compaction for a given vbucket
if its fragmentation is above the threshold (50% by default).

Change-Id: I54219b4d314a3d9b2e5163530f719d90f29801c6