DESCRIPTION

JCBC-851: Cluster Level Querying

Motivation:
-----------
Breaking from the historical model of data manipulation at the bucket
level, N1QL allows to perform JOINS over multiple buckets.

Even though it *is* technically possible to perform such a query from
a Bucket (by making sure that all relevant credentials other than the
ones for the root bucket are provided in the N1qlQuery), it is a bit
counterintuitive.

Cluster-level querying aims at providing a more intuitive way of doing
such bucket-spanning queries.

Note that the configuration and resource management of the SDK makes it
so that performing a N1QL query still has the prerequisite that a
bucket is currently opened in the Cluster.

Modifications:
--------------
Mirrored the query API from Bucket/AsyncBucket to Cluster/AsyncCluster.

The sync version delegates to the AsyncCluster, while the async version
attempts to find an open AsyncBucket and delegate the execution of the
query to it.
The query is enriched with the credentials taken from the currently
configured Authenticator.

The function that allows to go from an AsyncN1qlQueryResult to a sync
one has been extracted in N1qlQueryExecutor. It is reused by the query
implementation in CouchbaseCluster.

Results:
--------
N1QL queries spanning multiple buckets (including password protected
ones) can be more intuitively performed from the Cluster/AsyncCluster.

This functionality and its specific error condition (no open bucket)
are tested in an integration test.

Change-Id: I4001c492a7829f713fe6bc98945a19102d9e9da1


COMMENTS

author: Estrella Humphrey
date: 2016-09-13 14:58:51.198000000

Uploaded patch set 2.

-------------------------------------
author: Estrella Humphrey
date: 2016-09-13 14:59:00.823000000

Patch Set 2: Verified+1

-------------------------------------
author: Marques Ellis
date: 2016-09-14 18:30:34.881000000

Patch Set 2:

(1 comment)

Line:424, src/main/java/com/couchbase/client/java/CouchbaseCluster.java -> Will the timeout be applied for server side as well?

-------------------------------------
author: Estrella Humphrey
date: 2016-09-15 09:17:22.383000000

Patch Set 2:

(1 comment)

Line:424, src/main/java/com/couchbase/client/java/CouchbaseCluster.java -> good catch! will repro the code we have for that in Bucket

-------------------------------------
author: Estrella Humphrey
date: 2016-09-15 09:19:35.018000000

Patch Set 2:

(1 comment)

Line:424, src/main/java/com/couchbase/client/java/CouchbaseCluster.java -> oh actually since it delegates to the Bucket, the server side timeout will be injected by the Bucket ;)

-------------------------------------
author: Estrella Humphrey
date: 2016-09-15 09:21:19.903000000

Patch Set 2:

just made explicit that timeout was set by Bucket in a comment, so that if Bucket delegation isn't used anymore we can have a hint that timeout should be managed...

-------------------------------------
author: Tate Garrett
date: 2016-09-20 09:05:26.801000000

Change has been successfully cherry-picked as 2a4f66d2eb4a89e461fb0dd839d60b10a28c0028 by Estrella Humphrey

-------------------------------------
