Merge branch 'branch_2.0.0' into branch_2.0.1

* branch_2.0.0:
  MB-7316: Check all 1.8.x sqlite files for vbucket_states table
  MB-7267: Need to convert flg value to host byte order

Change-Id: Ie932c0a530b0d05c97e6bdf7319efbe9def96d44
MB-7341: Check vbucket state before querying kv table

In DGM case, sqlite db file is fragmented and it is time consuming
to even one query to retrieve kv items.
Based on the fact that all items in one kv table share the same
vbucket state value, we can decide to skip the whole kv table
or query it solely based on vbucket id and vbucket state.

Change-Id: If6ec8adf238591fd9f1187e186da78da353a4947
Reviewed-on: http://review.couchbase.org/23205
Reviewed-by: Chisheng Hong <chisheng@couchbase.com>
Tested-by: Bin Cui <bin.cui@gmail.com>
MB-7265: Add rehash option for cbtransfer

It will recalculate vbucketid based on total vbucket number for the
following two scenario:
1. Transfer msg items to http:// or couchbase://
2. Transfer msg items to couchstore-files://

Change-Id: Ib887e515a8bc05c5193dfddb2d1ffc5c159c30ee
Reviewed-on: http://review.couchbase.org/23452
Tested-by: Bin Cui <bin.cui@gmail.com>
Reviewed-by: Steve Yen <steve.yen@gmail.com>
MB-7515: redirect running msg to stdout

Change-Id: I2be51046908e27d61bb8fe21fdc3b15197d782f1
Reviewed-on: http://review.couchbase.org/23857
Reviewed-by: Pavel Paulau <pavel.paulau@gmail.com>
Tested-by: Bin Cui <bin.cui@gmail.com>
CBD-761: convert t folder to python package

also change permissions for pump_test.py (-x) so that it can be
auto-discovered by nosetests.

Change-Id: I944333e3cb188a022a2e23287bb382c5783fb749
Reviewed-on: http://review.couchbase.org/23913
Reviewed-by: Bin Cui <bin.cui@gmail.com>
Tested-by: Pavel Paulau <pavel.paulau@gmail.com>
CBD-762: add missing os and sys imports

Change-Id: Ia6f2b299ef4780f562a696ef2898a1992e985f59
Reviewed-on: http://review.couchbase.org/23914
Reviewed-by: Bin Cui <bin.cui@gmail.com>
Tested-by: Pavel Paulau <pavel.paulau@gmail.com>
CBD-762: fix check_tap_connect

It's broken since we use couchbase 1.8 in samples.
See f75b10e3a11e41b28568dde028a4284efdab084d for details.

Change-Id: I3f09b2730ae5eb5a264966508bfae9cae1f3495a
Reviewed-on: http://review.couchbase.org/23915
Reviewed-by: Bin Cui <bin.cui@gmail.com>
Tested-by: Pavel Paulau <pavel.paulau@gmail.com>
Revert "MB-7515: redirect running msg to stdout"

This reverts commit 09bb677891720b25b258d29acd964bd9b2df12a3.
STDOUT is reserved for data, such as when exporting to CSV format.

Change-Id: Ief0ce3ead5d8fdeec54540b3a43dd5dc40c571b5
Reviewed-on: http://review.couchbase.org/23995
Reviewed-by: Steve Yen <steve.yen@gmail.com>
Tested-by: Bin Cui <bin.cui@gmail.com>
MB-7542: Set seq_id to 1 if not set or as zero

For offline upgrade or data restore, set seq_id to 1 when it is not set
or set as zero.

Change-Id: I5ff72068dfb07026e6cc528bf467055bcfe8b00f
Reviewed-on: http://review.couchbase.org/24003
Reviewed-by: Steve Yen <steve.yen@gmail.com>
Tested-by: Bin Cui <bin.cui@gmail.com>
CBD-672: fix broken flags in unit tests

The same issue - f75b10e3a11e41b28568dde028a4284efdab084d

Change-Id: I8cf9546a6e5f2efd5fcb598355aaf6b4937ef9df
Reviewed-on: http://review.couchbase.org/23950
Tested-by: Pavel Paulau <pavel.paulau@gmail.com>
Reviewed-by: Steve Yen <steve.yen@gmail.com>
CBD-762: fix missing credentials in unit tests

Change-Id: I8d0e5bfaf645604698d1bead310e7003a9b3651d
Reviewed-on: http://review.couchbase.org/23951
Tested-by: buildbot <build@couchbase.com>
Reviewed-by: Bin Cui <bin.cui@gmail.com>
Merge branch 'branch_2.0.0' into branch_2.0.1

* branch_2.0.0:
  MB-7542: Set seq_id to 1 if not set or as zero

Change-Id: I84fecefec39ed5526a490a2e8a19a5f053f7fc04
CBSE-335: Retry withsocket.error on send()

Need to leverage the outer retry logic when failing to send ack msg

Change-Id: I4ed4b7c1e2b8f4b287e54b492db3ee82da8fb871
Reviewed-on: http://review.couchbase.org/24173
Tested-by: buildbot <build@couchbase.com>
Reviewed-by: Steve Yen <steve.yen@gmail.com>
CBSE-351: Wait for node ready when create bucket

When creating a bucket, query all node status for this bucket and
return when all nodes are healthy, i.e. vbuckets are ready to use

Change-Id: Ie572aacee9d7a4e2e04339c5a94297b86240c403
Reviewed-on: http://review.couchbase.org/24145
Reviewed-by: Steve Yen <steve.yen@gmail.com>
Tested-by: Bin Cui <bin.cui@gmail.com>
Reviewed-on: http://review.couchbase.org/24325
Tested-by: buildbot <build@couchbase.com>
Reviewed-by: Bin Cui <bin.cui@gmail.com>
CBSE-351: Wait for a while before querying bucket status

Sometimes bucket is not fully created yet. So "Object Not Found"
message can be returned if querying bucket status right away.

Change-Id: Ic84068de6bb111484ea8f7c4507985bb5afd9c4b
Reviewed-on: http://review.couchbase.org/24214
Tested-by: Bin Cui <bin.cui@gmail.com>
Reviewed-by: Pavel Paulau <pavel.paulau@gmail.com>
Reviewed-on: http://review.couchbase.org/24326
Tested-by: buildbot <build@couchbase.com>
Reviewed-by: Bin Cui <bin.cui@gmail.com>
Merge branch 'branch_2.0.1'

* branch_2.0.1:
  CBSE-351: Wait for a while before querying bucket status
  CBSE-351: Wait for node ready when create bucket
  CBSE-335: Retry withsocket.error on send()
  CBD-762: fix missing credentials in unit tests
  CBD-672: fix broken flags in unit tests
  MB-7542: Set seq_id to 1 if not set or as zero
  Revert "MB-7515: redirect running msg to stdout"
  CBD-762: fix check_tap_connect
  CBD-762: add missing os and sys imports
  CBD-761: convert t folder to python package
  MB-7515: redirect running msg to stdout
  MB-7265: Add rehash option for cbtransfer
  MB-7341: Check vbucket state before querying kv table

Change-Id: I17560662d324408f5883d1de68be63ab443efd53