CBD-87: missing import

Change-Id: I9480182341655125adfcd56ef0ffc5497ff8f995
Reviewed-on: http://review.couchbase.org/19171
Reviewed-by: Bin Cui <bin.cui@gmail.com>
Tested-by: Steve Yen <steve.yen@gmail.com>
MB-6027: fixes for rebalance codepath

First, move the code to refresh our server map to the outer loop,
otherwise replies get out of sync with requests.

Also, have a 10 second bound on backoff sleep.

Change-Id: I2c483e29a9da809ae3704e6510ed4840ed6c6f61
Reviewed-on: http://review.couchbase.org/19172
Reviewed-by: Pavel Paulau <pavel.paulau@gmail.com>
Tested-by: Steve Yen <steve.yen@gmail.com>
MB-6027: don't backoff if we just refreshed the vbucket-map

This can happen during rebalance / NOT-MY-VBUCKET errors,
so if we refresh our vbucket-map, there's no need to
backoff or sleep.  Instead we can immediately retry.

Change-Id: If4337b9bd941203bd21ad825d798a7dae6e04ed8
Reviewed-on: http://review.couchbase.org/19173
Reviewed-by: Bin Cui <bin.cui@gmail.com>
Tested-by: Steve Yen <steve.yen@gmail.com>
MB-6059: Fix quoting so wrapper can handle spaces in path

Scripts generated with wrapper.in wouldn't run if the path to the
script contained spaces (as it always will on Mac OS.)

Also, the value '@prefix@' was being used in several places even
though it gets stored into a shell variable $prefix. I fixed this
so the Mac installer script install-couchbase.sh only has to fix
it in one place.

Change-Id: Iea936cc0e6226c72b627d55b13ef213ef9434bf1
Reviewed-on: http://review.couchbase.org/19052
Reviewed-by: Steve Yen <steve.yen@gmail.com>
Tested-by: Jens Alfke <jens@couchbase.com>
MB-100: README fixes

Change-Id: If9f5f29649e0795f2857ec75cbf41f742de31fa9
Reviewed-on: http://review.couchbase.org/19239
Reviewed-by: Ronnie Sun <ronnie@couchbase.com>
Reviewed-by: Bin Cui <bin.cui@gmail.com>
Tested-by: Steve Yen <steve.yen@gmail.com>
MB-100: whitespace / PEP-8

Change-Id: Iccd06799fe1ffd6a24a9a90c55c2e36e0d6ac8a1
Reviewed-on: http://review.couchbase.org/19242
Tested-by: Steve Yen <steve.yen@gmail.com>
Reviewed-by: Bin Cui <bin.cui@gmail.com>
MB-6101: backup design-docs from 2.0-DP4 with no auth

Change-Id: I91b5268fa76556f8178798c3c65c8629e6f2825c
Reviewed-on: http://review.couchbase.org/19243
Tested-by: Steve Yen <steve.yen@gmail.com>
Reviewed-by: Bin Cui <bin.cui@gmail.com>
MB-6090: source_node fallback if user used localhost/127.0.0.1

If we can't filter the source nodes because the user supplied
'localhost' or '127.0.0.1', just fallback to using all the source
nodes.

This has no effect for today's couchbase, which spreads a bucket
across all nodes.  One day, if couchbase supports assigning buckets to
less than all nodes in a cluster, this will need revisiting.

Change-Id: Ibd8911e82ced57fcb367f168b05830e420dc5529
Reviewed-on: http://review.couchbase.org/19244
Tested-by: Steve Yen <steve.yen@gmail.com>
Reviewed-by: Bin Cui <bin.cui@gmail.com>
MB-100: add .idea to gitignore

Change-Id: Ied70c3c3cc96c6d7e0337d001297cf5f90b8b4dc
Reviewed-on: http://review.couchbase.org/19276
Reviewed-by: Bin Cui <bin.cui@gmail.com>
Tested-by: Pavel Paulau <pavel.paulau@gmail.com>
MB-100: fix inconsistent indentation

Change-Id: I27e9365a637277485f693c4b85dff0c76e980da3
Reviewed-on: http://review.couchbase.org/19277
Reviewed-by: Bin Cui <bin.cui@gmail.com>
Tested-by: Pavel Paulau <pavel.paulau@gmail.com>
MB-6136: ddoc REST protocol changed

Couchbase 2.0's ddoc REST result changed, at least from build 1542,
for example, that looks like...

{u'rows': [
  {u'controllers': {
     u'compact': u'/pools/default/buckets/default/ddocs/_design%2Fdev_t/controller/compactView'},
     u'doc': {u'json': {u'_id': u'_design/dev_t',
                        u'views': {u't2': {u'map': u'function (doc) {\n emit(doc._id, null);\n}'},
                                   u't': {u'map': u'function (doc) {\n emit(doc._id, null);\n}'}}},
              u'meta': {u'rev': u'1-f6e4da1c', u'id': u'_design/dev_t'}}},
  {u'controllers': {
     u'compact': u'/pools/default/buckets/default/ddocs/_design%2Fdev_s/controller/compactView'},
     u'doc': {u'json': {u'_id': u'_design/dev_s',
                        u'views': {u's': {u'map': u'function (doc) {\n  emit(doc._id, null);\n}'}}},
              u'meta': {u'rev': u'1-ef1e6fe0', u'id': u'_design/dev_s'}}}
]}

This change handles that ddoc output and the older, 2.0DP4 REST output
during provide_design/consume_design.

Change-Id: Ibcc9f7ba5a34ae094fea67a30430057b3d403ea3
Reviewed-on: http://review.couchbase.org/19316
Tested-by: Steve Yen <steve.yen@gmail.com>
Reviewed-by: Ronnie Sun <ronnie@couchbase.com>
MB-6167: snapshot mc files for TAP_FIX_FLAG_BYTEORDER

Change-Id: I6e71f1cb698a3f36e2786940498eac2fcee1ef93
Reviewed-on: http://review.couchbase.org/19499
Reviewed-by: Bin Cui <bin.cui@gmail.com>
Tested-by: Steve Yen <steve.yen@gmail.com>
MB-6176: use TAP_FLAG_TAP_FIX_FLAG_BYTEORDER during tap connect

Change-Id: I17c2bcb8390652e19c115d307c28f8124df8db8f
Reviewed-on: http://review.couchbase.org/19500
Reviewed-by: Bin Cui <bin.cui@gmail.com>
Tested-by: Steve Yen <steve.yen@gmail.com>
MB-6134: handle socket.error exception on pump_mc send()

Change-Id: I3ae27a109ca7d61e3001e5d909c0948215fdc9b9
Reviewed-on: http://review.couchbase.org/19503
Reviewed-by: Bin Cui <bin.cui@gmail.com>
Tested-by: Steve Yen <steve.yen@gmail.com>
MB-6195: handle exception during SASL auth

Change-Id: I0e687fbab255edb79626079aa17669002184b1bf
Reviewed-on: http://review.couchbase.org/19506
Reviewed-by: Bin Cui <bin.cui@gmail.com>
Tested-by: Steve Yen <steve.yen@gmail.com>
MB-5948: add timeout decorator

Change-Id: Id5ad9542b90adabcdc1df1c746fc367f2b537b9d
Reviewed-on: http://review.couchbase.org/19278
Reviewed-by: Steve Yen <steve.yen@gmail.com>
Tested-by: Pavel Paulau <pavel.paulau@gmail.com>
MB-5948: limit execution of bucket commands by 1 minute

Change-Id: Ifebdbcecf4b391fe492238c822507b9870afca1e
Reviewed-on: http://review.couchbase.org/19279
Reviewed-by: Steve Yen <steve.yen@gmail.com>
Tested-by: Pavel Paulau <pavel.paulau@gmail.com>
MB-5945: raise exception if trying to failover inactive node

Change-Id: I3cb1a4540fb1f6238b17f5b37e3d59fe355c1291
Reviewed-on: http://review.couchbase.org/19545
Reviewed-by: Bin Cui <bin.cui@gmail.com>
Tested-by: Pavel Paulau <pavel.paulau@gmail.com>
MB-6916: check deleted flag before using getContents()

Change-Id: I8267de178e310143277a55f3aab8126418ee3608
Reviewed-on: http://review.couchbase.org/19568
Reviewed-by: Bin Cui <bin.cui@gmail.com>
Tested-by: Steve Yen <steve.yen@gmail.com>
MB-6197: design docs from pump_sfd now matches pump_tap schema.

Related to the recent "ddocs" REST API change, the pump_sfd now
matches the pump_tap-style JSON format for design docs, where there
is no longer a 'rows" level of indirection.

Also, using the right revSequence instead of revMeta for the captured
"_rev" field.

Change-Id: I68309528f0c5faac5789fda77ef51c7524337b30
Reviewed-on: http://review.couchbase.org/19570
Reviewed-by: Bin Cui <bin.cui@gmail.com>
Reviewed-by: Pavel Paulau <pavel.paulau@gmail.com>
Tested-by: Steve Yen <steve.yen@gmail.com>