New Features and Behaviour Changes in 1.1-beta
The "delete" command now also supports persitence constraints like set, add, replace or CAS do.
client.delete("my_key", PersistTo.MASTER, ReplicateTo.ONE);Issues: JCBC-162
To assist with better debugging on view queries, a new method on the "Query" class, "setDebug(boolean)" has been introduced. When it is set to true, the client will log the view results including debug information to the INFO level, which is by default turned on. This can be very helpful on debugging misbehaving view queries and to provide vital information for support tickets.
Issues: JCBC-158
The regular view timeout has been increased from 60 to 75 seconds (because the server-side view timeout is 60 seconds and now the corresponding timeout on the client is slightly higher). It is now possible to configure it through the CouchbaseConnectionFactoryBuilder. Use the corresponding "setViewTimeout" method on it if you want to change the setting. Note that the lower threshold is set to 500ms, and it will print a warning if it's lower than 2500ms because this can lead to undesired effects in production.
Issues: JCBC-153
Support for spatial view queries has been added to the SDK. Not that at this stage, spatial view queries are expermimental and should be treated as such. Since spatial queries differ a little bit from classic map/reduce ones, a new "bbox" param has been added to the Query object as well to accomodate the needs. Note that there has been taken lots of care not to break the current API by adding this feature. The main difference to normal map/reduce is to use the "getSpatialView" method instead of the "getView" method on the CouchbaseClient object. Here is a short example on how to use it:
SpatialView view = client.getSpatialView("my_design", "my_spatial_view"); Query query = new Query(); ViewResponse response = client.query(view, query); for(ViewRow row : response) { // Work with bbox data: row.getBbox(); // Work with geometry data: row.getGeometry(); // Work with the value: row.getValue(); }
Issues: JCBC-136
To "fail fast" on observe constraints (when operations like "set" are used with PersistTo and/or ReplicateTo), the client now checks if there are enough nodes in the cluster to theoretically fulfill the request. This means if PersistTo.THREE is used when there are only two nodes in the cluster, the operations may succeed but the observation surely fails because the constraint can't be fulfilled. In this case, the OperationFuture would return false and the message respons with something like this: "Currently, there are less nodes in the cluster than required to satisfy the replication/persistence constraint.". Keep in mind that replication constraints always require one additional node to be fulfilled correctly. So a ReplicateTo.TWO with only two nodes in the cluster will fail.
Issues: JCBC-148
Starting from this beta release, it is now possible to manage design documents through the SDK as well. Design documents can be created, loaded and deleted through their corresponding methods from the CouchbaseClient class. Use the "createDesignDoc()" and "deleteDesignDoc()" methods for creating or deleting design documents as a whole. Here is a short example on how to use it:
List<ViewDesign> views = new ArrayList<ViewDesign>(); List<SpatialViewDesign> spviews = new ArrayList<SpatialViewDesign>(); ViewDesign view1 = new ViewDesign( "view1", "function(a, b) {}" ); views.add(view1); SpatialViewDesign spview = new SpatialViewDesign( "spatialfoo", "function(map) {}" ); spviews.add(spview); DesignDocument doc = new DesignDocument("mydesign", views, spviews); Boolean success = client.createDesignDoc(doc);
Note that creating design documents may take some time, so make sure to wait some time and poll with "getDesignDocument()" to see if it is already correctly loaded.
Issues: JCBC-63
The "getViews" method has been renamed to "getDesignDocument" and the arguments have been changed to make it easier to use in combination with "createDesignDocument" and "deleteDesignDocument". The method takes the name of the design document and returns an instance of a "DesignDocument". This can be modified and then passed back to "createDesignDocument" to update it accordingly. Here is a quick example:
DesignDocument design = client.getDesignDocument("rawdesign"); design.getName(); // Returns the name of the design document design.getViews(); // Contains the stored views design.getSpatialViews(); // contains the stored spatial views
Issues: JCBC-147
When a view with a defined reduce-function is used, the client now implicitly sets "setReduce()" to "true". This behavour is now much more intuitive and also irons-out some bugs associated with it.
Issues: JCBC-150
Pagination support got a lot more attention in the previous weeks and therefore some bugs have been ironed out. NullPointerExceptions should not be raised anymore. Note that is currently not possible to paginate over reduced or spatial results, this will be added in a future release.
Issues: JCBC-40
When no replicas are defined in the cluster and a node fails (or more nodes fail at the same time than replicas are defined), then it is possible that there is no single master responsible for a given vbucket. This has been a problem in previous tests and is now handled that a RuntimeException is thrown which a explanatory message. Since the cluster may now be in a very bad state, it is up to the developer at the application level to ensure the correct behavior of the following operation (since this may be very different depending on the application requirements).
Issues: JCBC-123
It is now possible to read every kind of included document through views. Previously all documents were casted to strings when fetched with "setIncludeDocs(true)", which did not allow it to be (for example) serialized java objects. This is now possible since those objects are not implicitly casted to strings anymore. Note that this only applies to the included documents, view results are still interpreted as strings (JSON).
Issues: JCBC-125
When using memcache-type buckets instead of couchbase-type buckets, the reconfiguration should now work as expected. The client previously tried to compare the vbuckets all the time, but since memcache-type buckets don't contain vbuckets it failed (now only the server nodes themselves are compared).
Issues: JCBC-35
Additional checkpoints have been added to make sure all ViewConnection threads are properly closed during the shutdown phase.
Issues: JCBC-94