MB-7255: Don't change current directory location

Lots of commands assume that bin directory is the current directory

Change-Id: I9fc05fe13f8384af461a34b391e7366ab608a3e8
Reviewed-on: http://review.couchbase.org/22826
Tested-by: Pavel Paulau <pavel.paulau@gmail.com>
Reviewed-by: Steve Yen <steve.yen@gmail.com>
MB-7238 Don't read ip file when node name is configured.

Change-Id: I2e196e8954c4202decd3f9e68415a2d476109a79
Reviewed-on: http://review.couchbase.org/22895
Tested-by: Aliaksey Artamonau <aliaksiej.artamonau@gmail.com>
Reviewed-by: Aliaksey Kandratsenka <alkondratenko@gmail.com>
Tested-by: Aliaksey Kandratsenka <alkondratenko@gmail.com>
MB-7254: run cbdump_config correctly

Since escript doesn't exit in the path defined in /usr/bin/env,
directive #!/usr/bin/env escript won't work under linux platform.
We need to explicitly specify path for escript. In this way, the
first line of escript will be ignored.

At the same time, always put the full path to escript so that
we can find it correctly no matter where to run the cbcollect_info

Change-Id: Ic952ce37ff540ff47029bf3732ba7f08190a0b80
Reviewed-on: http://review.couchbase.org/22888
Tested-by: Bin Cui <bin.cui@gmail.com>
Reviewed-by: Steve Yen <steve.yen@gmail.com>
Tested-by: Steve Yen <steve.yen@gmail.com>
MB-7254: Rename to cbdump_config

Update help text to be consistent with script name

Change-Id: Ibd5c3f7490f05f780953594f5004784fe2141d0e
Reviewed-on: http://review.couchbase.org/22887
Reviewed-by: Steve Yen <steve.yen@gmail.com>
Tested-by: Bin Cui <bin.cui@gmail.com>
Tested-by: Steve Yen <steve.yen@gmail.com>
MB-7313 Update port_servers during 1.8.1 -> 2.0 upgrade.

Change-Id: I25eee61395730f895b33f12310133d2359dfeb63
Reviewed-on: http://review.couchbase.org/23004
Reviewed-by: Aliaksey Kandratsenka <alkondratenko@gmail.com>
Tested-by: Aliaksey Kandratsenka <alkondratenko@gmail.com>
MB-7337 Wait for memcached termination really long.

With http://review.couchbase.org/20126 we don't delete buckets on
shutdown any more. Because of that memcached shutdown can take a long
time. So we should not give it up after 60 seconds.

Change-Id: I735b380f8809deb4fc0ffa62e5c99aaf837a4c73
Reviewed-on: http://review.couchbase.org/23020
Reviewed-by: Aliaksey Kandratsenka <alkondratenko@gmail.com>
Tested-by: Aliaksey Kandratsenka <alkondratenko@gmail.com>
MB-7307 Handle symlinks in db and index paths.

1. Node's heartbeat contains already resolved paths so that other
nodes could compute its disk stats.
2. When someone else wants to get their local disk stats,
the path should be resolved with respect to symlinks explicitly.

Change-Id: I7c88fc9728b807fefe55ece00d29e0b9d72b70cc
Reviewed-on: http://review.couchbase.org/23003
Reviewed-by: Aliaksey Kandratsenka <alkondratenko@gmail.com>
Tested-by: Aliaksey Kandratsenka <alkondratenko@gmail.com>
MB-7367: try starting os_mon each time we need disk usage data

I.e. so that os_mon crash due to timeout can't harm us.

Change-Id: Iaca935cb33c032f12da6f4f2842e3370815ae205
Reviewed-on: http://review.couchbase.org/23099
Reviewed-by: Aliaksey Artamonau <aliaksiej.artamonau@gmail.com>
Tested-by: Aliaksey Artamonau <aliaksiej.artamonau@gmail.com>
MB-7368 Ensure that db and index paths are normalized.

Previously after installation couchbase server would have a database
path with trailing slash in it. On index_path change, this trailing
slash would be stripped, which would make the server think that
database path had changed. And hence all buckets would be removed. To
avoid this, two things has been changed:

 1. Trailing slash removed from default database path in capi.ini.
 2. To be completely sure and to support upgrade from pre 2.0 customer
 release, set_db_and_ix_paths and get_db_and_ix_paths are also changed to
 always set/return normalized paths.

Change-Id: Ic1f2c52df2c5dc25e03f4050267f10e7168a5586
Reviewed-on: http://review.couchbase.org/23108
Tested-by: Aliaksey Kandratsenka <alkondratenko@gmail.com>
Reviewed-by: Aliaksey Kandratsenka <alkondratenko@gmail.com>
MB-7344: don't allow changing data path of provisioned nodes

So things are somewhat complicated. We started deleting all buckets on
path config change as part of original docloader integration
work. There's no much traces of this left and commit message is quite
short but I assume that's to clear sample buckets if somebody hits
reload while in middle of setup wizard.

Then MB-6423 "allow users to change index path at runtime" was
reported and we changed logic to only delete buckets when data path
changes. Not all the time.

And after that we filed and fixed MB-5669 "data files are preserved
after failover on a node with non-standard db path". That one is a bit
complex. We already have quite complex logic if handling "preserve
data files on failover but get rid of them when node is reused"
logic. Essentially when 2.0 node has custom data path and is failed
over. It will _keep_ custom data path and keep data files. When
somebody adds it back without changing data path, we get rid of data
files first, per our original logic. _But_ if somebody changes data
path back to default or other custom path we originally left data
files intact. So we added logic of deleting all "unused" bucket db
files if path is changing.

All this time we (ns_server team) were totally unaware that we have
documented and supported procedure that relies on implementation
details on 1.8.x behavior. I.e. here:
http://www.couchbase.com/docs/couchbase-manual-2.0/couchbase-data-files.html

The problem is, seemingly, we can't have both "failover preserves data
files" and that documented procedure above.

In order to avoid hitting issues for people aware of old procedure we
decided to prevent that possiblity of changing data path of
provisioned nodes completely.

Change-Id: Iceda1b7f40708fd2e032fcb94fd537d2b1788c1d
Reviewed-on: http://review.couchbase.org/23113
Tested-by: Aliaksey Artamonau <aliaksiej.artamonau@gmail.com>
Reviewed-by: Aliaksey Artamonau <aliaksiej.artamonau@gmail.com>
MB-7193: Make Views work that contain slashes

MapReduce and Spatial Views that contained slashed in either the
Design Document or the function name didn't work.

Those three commits need to be merged at the same time:
http://review.couchbase.org/23138
http://review.couchbase.org/23175
http://review.couchbase.org/23139

Change-Id: Ic40a6784667459af16a229aec755aee0f8d784da
Reviewed-on: http://review.couchbase.org/23139
Reviewed-by: Filipe David Borba Manana <fdmanana@gmail.com>
Tested-by: Filipe David Borba Manana <fdmanana@gmail.com>
Merge remote-tracking branch 'couchbase/2.0.1' into HEAD

* couchbase/2.0.1:
  MB-7193: Make Views work that contain slashes
  MB-7344: don't allow changing data path of provisioned nodes
  MB-7368 Ensure that db and index paths are normalized.
  MB-7367: try starting os_mon each time we need disk usage data

Change-Id: I52125cb20e905c6515a2511be7963a15c210897a
MB-7224: Capture all .ini files

Change-Id: Ifed1b1b30dfab7c568e3dd9a6c183af880c84dde
Reviewed-on: http://review.couchbase.org/23288
Reviewed-by: Aliaksey Kandratsenka <alkondratenko@gmail.com>
Tested-by: Bin Cui <bin.cui@gmail.com>
MB-7390: Do not allow backslashes in Mochiweb serve_file

On Windows, Mochiweb does not correctly safeguard against backslash
characters and so arbitrary files can be accessed. While we wait for
patch to make it's way into Mochiweb, this change closes the hole in
a few obvious places in ns_server.

Change-Id: Iab8d8320ac11cedb1ffcf7f6d9201514db807bc8
Reviewed-on: http://review.couchbase.org/23311
Tested-by: Sriram Melkote <siri@couchbase.com>
Reviewed-by: Aliaksey Kandratsenka <alkondratenko@gmail.com>
Tested-by: Aliaksey Kandratsenka <alkondratenko@gmail.com>
Merge remote-tracking branch 'origin/2.0.1'

* origin/2.0.1:
  MB-7390: Do not allow backslashes in Mochiweb serve_file
  MB-7224: Capture all .ini files

Change-Id: Id3e49a61b3820fab0aa321979568cba7945174b4
MB-7219: remove retired xdcr ns_config parameters

After we switch to priority checkpoint in ep_engine, the timeout
is totall controlled in hands of ep_engine and this parameter is
no longer needed.

Change-Id: Ib8ee03fa730195ec952c1d9ef3a51925ad27687d
Reviewed-on: http://review.couchbase.org/22659
Reviewed-by: Aliaksey Artamonau <aliaksiej.artamonau@gmail.com>
Reviewed-by: Ketaki Gangal <ketakigangal@gmail.com>
Tested-by: Aliaksey Kandratsenka <alkondratenko@gmail.com>
MB-7428: Use right destructor for tempfile

Change-Id: Ia2b10eb73808696bf63306c0fc9b68832ce7f264
Reviewed-on: http://review.couchbase.org/23373
Reviewed-by: Pavel Paulau <pavel.paulau@gmail.com>
Tested-by: Bin Cui <bin.cui@gmail.com>
MB-7369 MB-7370 Add "instance" vclock to important per-node keys.

The motivation is basically the same as in
http://review.couchbase.org/21999. But there's one important detail
that was missed before. During conflict resolution two conflicting
vclocks are merged to the vclock that descends both conflicting
vclocks. It means that if the node with faked vclock is removed from
the cluster and then added back, our trick will not work this
time. Because merged vlcock will descend our faked vclock. And the new
value will get overwritten. So the solution is to attach "instance"
vclock to such vulnerable keys during config initialization. So that
it appears that those keys have been modified by some random
node. This will cause conflict during config merge and the newer value
will be preferred.

Change-Id: I7977ada2f8aed2e13374aa2ea72deb5796fc3eb2
Reviewed-on: http://review.couchbase.org/23376
Tested-by: Aliaksey Kandratsenka <alkondratenko@gmail.com>
Reviewed-by: Aliaksey Kandratsenka <alkondratenko@gmail.com>
MB-7311: Reimplement collecting memcached logs

The new approach won't get stucked when no memcached logs around.

Change-Id: I7e795771f2d07f9c515d4950070920678c5592f0
Reviewed-on: http://review.couchbase.org/23378
Tested-by: Bin Cui <bin.cui@gmail.com>
Reviewed-by: Aliaksey Artamonau <aliaksiej.artamonau@gmail.com>
MB-6799: implemented api to pause/unpause view compaction

I.e. so that during vbucket movement we don't attempt any view
compaction on affected nodes and so that after movement is done we can
wait until compaction is started.

Change-Id: I54cbb63e19bed767e85523f9b10aba466defa40f
Reviewed-on: http://review.couchbase.org/23316
Tested-by: Aliaksey Kandratsenka <alkondratenko@gmail.com>
Reviewed-by: Aliaksey Artamonau <aliaksiej.artamonau@gmail.com>