RPM: Add %{dist} to output name

This helps us identify the particular release an RPM was built for.

Change-Id: I8dc497411e09c51bd0e81e078cf4ae81aad8f687
Reviewed-on: http://review.couchbase.org/39439
Tested-by: Mark Nunberg <mnunberg@haskalah.org>
Reviewed-by: Brett Lawson <brett19@gmail.com>
Delete unused win32/inttypes.h file

This file didn't do anything anyway

Change-Id: Ie7f608a45f0d257b57b32ead6658b4425797a33a
Reviewed-on: http://review.couchbase.org/39545
Reviewed-by: Brett Lawson <brett19@gmail.com>
Tested-by: Mark Nunberg <mnunberg@haskalah.org>
SSL Build fixups

- Fix noop definition of lcbio_ssl_new() [ was modified for the CCBC-475
  commit]
- Declare lcbio_ssl_check and lcbio_ssl_get_error to be exported via
  LCB_INTERNAL_API. This is needed as these functions are now used in
  ctx.c which is itself tested from within sock-tests

Change-Id: I34fbc58fdf319df77149b1824b2b9b624407c5ad
Reviewed-on: http://review.couchbase.org/39551
Reviewed-by: Brett Lawson <brett19@gmail.com>
Tested-by: Mark Nunberg <mnunberg@haskalah.org>
autotools: disable distcleancheck

distcheck is a very helpful way to verify the distribution files are in
tact and that the package is configured correctly. However by design we
leave some files in the source tree (specifically, ones we've
downloaded) to avoid re-downloading them in the event of make distclean
&& ./config/autorun.sh && ./configure - which is a good way to clean and
rebuild the distribution.

This file disables the distcleancheck rule which would otherwise return
an error code because those downloaded files are present.

See
http://www.gnu.org/software/automake/manual/html_node/Checking-the-Distribution.html
for more information

Change-Id: Ieaca5d4ae0d2c82ea1a9a1c342019747e6c8d7cb
Reviewed-on: http://review.couchbase.org/39552
Reviewed-by: Brett Lawson <brett19@gmail.com>
Tested-by: Mark Nunberg <mnunberg@haskalah.org>
Update observe example

Change-Id: I16483393e006b50227848b012f6908c3363dc5aa
Reviewed-on: http://review.couchbase.org/39751
Reviewed-by: Brett Lawson <brett19@gmail.com>
Tested-by: Mark Nunberg <mnunberg@haskalah.org>
Confmon: Log when a config is rejected due to no changes

This allows one to see that the library is indeed receiving a proper
config, but that the cluster has nothing new to report about it.

Change-Id: Ib2a258cd27a34fa259a833433824a474871031f8
Reviewed-on: http://review.couchbase.org/39752
Reviewed-by: Brett Lawson <brett19@gmail.com>
Tested-by: Mark Nunberg <mnunberg@haskalah.org>
mcreq: clean up flags definitions

This commit removes the unused F_PASSTHROUGH flag and documents the
F_DETACHED flag

Change-Id: I1b2d2a82def7eb94e6159d8743a65785fb71ba6d
Reviewed-on: http://review.couchbase.org/39821
Reviewed-by: Brett Lawson <brett19@gmail.com>
Tested-by: Mark Nunberg <mnunberg@haskalah.org>
check-all: don't ignore -j option

This option controls paralelism in tests. It was there with the 2.3
version of lcb, but accidentally got removed/clobbered while migrating
to cliopts

Change-Id: I669213ae20862f9e5d7798386339c9530872ad6a
Reviewed-on: http://review.couchbase.org/39459
Reviewed-by: Brett Lawson <brett19@gmail.com>
Tested-by: Mark Nunberg <mnunberg@haskalah.org>
vbucket: provide vbalternate() function

This function has a purpose similar to the older
vbucket_found_incorrect_master, except that it does not change the
vbucket state. Rather it simply tries to return a different index
than the default master.

As part of this change, the lcbvb_genconfig has also been modified to
generate unique indices for the master and replica slots for each
vbucket to accomodate the tests here (and function like a real config).

Change-Id: I44353375073735037dba54d55477d95316f0fc75
Reviewed-on: http://review.couchbase.org/39824
Reviewed-by: Brett Lawson <brett19@gmail.com>
Tested-by: Mark Nunberg <mnunberg@haskalah.org>
mcreq: Add extended packet structure

This extended packet structure is returned by the mcreq_renew_packet()
function (which has been renamed from mcreq_dup_packet()). It provides
APIs to 'tag' a packet with extra metadata stored under a unique string
key. This will be used by retry queue, and possibly others to store
additional error information therein.

Change-Id: Ibfa32d48865aea4c77591bf47fe88732bc30f8a9
Reviewed-on: http://review.couchbase.org/39753
Reviewed-by: Brett Lawson <brett19@gmail.com>
Tested-by: Mark Nunberg <mnunberg@haskalah.org>
newconfig: Only initiate connections to nodes that have commands

We don't need to connect to all the nodes (making logging messages quite
noisy). Only connect to those nodes that have commands waiting on them.

Change-Id: I24a4b3a5ec8cfab57310dd5b8abc767e13a6453b
Reviewed-on: http://review.couchbase.org/39832
Reviewed-by: Brett Lawson <brett19@gmail.com>
Tested-by: Mark Nunberg <mnunberg@haskalah.org>
Section out internal ctls into a different file

These settings are internal and are not needed by normal users. They are
in the public API because they are used by some SDKs for various reasons
and thus are not unsupported or deprecated; however it is unhelpful to
have them in the listing among the settings a user might actually care
about.

The settings hidden are:

* MEMDNODE_INFO, CONFINODE_INFO - these expose too much information
  about the nodes. Additionally they don't actually contain sufficient
  information about whether a node is a master, replica etc. With the
  new vbucket API this information is already available from there.

* IOPS_DEFAULT_TYPES - Knowing the default I/O settings is useful for
  tests that use various I/O plugins but doesn't concern most users.

* CONFIG_HTTP_NODES, CONFIG_CCCP_NODES, CONFIG_ALL_NODES, REINIT_CONNSTR
  These features may be useful in theory, however they are only
  guaranteed to work up until the first call to lcb_connect. This big
  caveat removes its usefulness for most use cases concerning users.

Change-Id: I3a1b4ab5aca1a7a54b957dd88077746ce57606c9
Reviewed-on: http://review.couchbase.org/39455
Reviewed-by: Brett Lawson <brett19@gmail.com>
Tested-by: Mark Nunberg <mnunberg@haskalah.org>
retryq: Use mc_EXPACKET

This uses mc_EXPACKET to preserve the original error information of the
packet.

Change-Id: Id89a2449c14daaa3879df5abc91e80d916412069
Reviewed-on: http://review.couchbase.org/39754
Tested-by: Mark Nunberg <mnunberg@haskalah.org>
Reviewed-by: Brett Lawson <brett19@gmail.com>
Attempt to unmask timeout errors for retried commands

If an operation has timed out, attempt to reveal the real cause of the
error, and only afterwards return a timeout error if the operation truly
timed out without a previous cause. This is done by querying the retry
queue to see if the packet is of a special, "Retried" type.

Change-Id: I4511d7e0d95394bff7505b30cff00ce996401893
Reviewed-on: http://review.couchbase.org/39833
Reviewed-by: Brett Lawson <brett19@gmail.com>
Tested-by: Mark Nunberg <mnunberg@haskalah.org>
Rework instance <-> cmdq relationship

This commit properly assigns the instance to the command queue via an
opaque 'cqdata' field. The field has been renamed from instance to
indicate the separation of concerns between the mc and lcb modules.

This commit also ensures the cqdata field is assigned during inital
instance creation, rather than each time we get a config

Change-Id: I6672550127d87a3436a9e30b02cbac2d1a8d300f
Reviewed-on: http://review.couchbase.org/39820
Tested-by: Mark Nunberg <mnunberg@haskalah.org>
Reviewed-by: Brett Lawson <brett19@gmail.com>
mcreq: add_pipelines should copy pipeline list

This makes it simpler to add extra data at the end of the pipeline list,
if necessary

Change-Id: I5e4a6be67f58d340cd0d99850fef7e5ae2f3d32e
Reviewed-on: http://review.couchbase.org/39877
Tested-by: Mark Nunberg <mnunberg@haskalah.org>
Reviewed-by: Brett Lawson <brett19@gmail.com>
CCBC-480: Attempt to re-schedule orphaned items

This helps alleviate the 'catch-22' situation where lcb returns
immediately with LCB_NO_MATCHING_SERVER when the cluster is in a
degraded state.

This patch adds a new API to mcreq which allows a custom handler to be
invoked for situations where there is no real pipeline object to receive
the item. In this case the callback is invoked with the orphaned packet
and should schedule the packet elsewhere to be retried. This
functionality is implemented by adding an additional pipeline object
whose flush_start() handler dispatches to the actual fallback handler.

Using this API is the retry queue, which inserts the packet within the
retry queue of the lcb_t instance

Change-Id: I50e7db48f67f694c97c5b10b7c64bceed9da4d96
Reviewed-on: http://review.couchbase.org/39822
Tested-by: Mark Nunberg <mnunberg@haskalah.org>
Reviewed-by: Brett Lawson <brett19@gmail.com>
newconfig: Don't perform redundant check for changes

We get the config from confmon, which itself already performs this check

Change-Id: Ibe0077fd1d449ac1db91c4d73eac3b58fe9f3b2a
Reviewed-on: http://review.couchbase.org/39881
Tested-by: Mark Nunberg <mnunberg@haskalah.org>
Reviewed-by: Brett Lawson <brett19@gmail.com>
mcreq: Remove unused 'remaining' field

Change-Id: I7da3c3184b7f6e57cbe8dba08ebdf3046660dd02
Reviewed-on: http://review.couchbase.org/39882
Reviewed-by: Brett Lawson <brett19@gmail.com>
Tested-by: Mark Nunberg <mnunberg@haskalah.org>
Rework retry setting options

This changeset makes the retry setting be an integer (lcb_U32) rather
than a structure, making it easier to be assigned using the traditional
'ctl' functions in other SDKs.

Additionally, a new string alias ("retry_policy") has been added so that
the setting can also be modified using a string.

To accomodate these changes, a more generic string-to-integer mapping
subsystem has been put into place for cntl.c as well, so as to reduce
boilerplate.

Change-Id: I854ebf274f2b941c0b03a028ba6aa1671c9085e1
Reviewed-on: http://review.couchbase.org/39924
Tested-by: Mark Nunberg <mnunberg@haskalah.org>
Reviewed-by: Brett Lawson <brett19@gmail.com>