How do I test row errors

Hello, I’m using the Java Client and CouchBase 2.0.1 community edition (build-185)
I am executing a query with a view and checking response.getErrors(), which according to the docs will return an array of com.couchbase.client.protocol.views.RowError objects.
How can I deliberately cause errors while executing a view to test my error handling routine?
I am calling the Java library from CFML. Here is a code snippet for reference:

local.allView = getCouchBaseClient().getView(‘CacheBox_allKeys’,‘allKeys’);
local.query = getJavaLoader().create(“com.couchbase.client.protocol.views.Query”).init();
local.response = getCouchBaseClient().query(local.allView,local.query);

// Were there errors
if(arrayLen(local.response.getErrors())){
// This will throw
handleRowErrors(local.response.getErrors());
}

Hello,
Not sure, but if you have a cluster, kill one of the node and do the query you should see some errors.
Regards

I’ll fire up a VM to add a second node to my cluster and try that right now.
Question though-- does this mean that CouchBase clusters are not resilient against querying views when nodes go down in a cluster? Regular bucket get/set behaviors pause for a few seconds until auto-failover kicks in, but usually I don’t get any errors when killing a node as long as I have at least one replica of all my documents.

Ahh, I just realized that the response I was getting back that was accompanied by errors did not contain the full result set, but instead only keys from the remaining good node. So that makes a bit more sense I suppose. If I get errors back, also get whatever results the CouchBase client was able to muster, but it won’t necessarily be all the results. (I had taken a node offline, but not yet failed it over in this case)
So I guess my application needs to determine whether it feels like settling for a partial results in that instance?

Ok, I was able to successfully produce rowErrors by turning off nodes in a cluster. However, I was surprised to find that even though getErrors() returned errors, the response object also had a proper response in it as well.
I guess I assumed that the presence of errors would preclude the successful querying of the view. If getErrors() returned anything I was going to throw that error to the application and abort the request. Was I wrong in that assumption? Are the errors more like warnings that something didn’t quite go right but CouchBase was still able to process my request?
Please advise how I should treat errors in the response from a query.

Hi,

So based on the discussion you found the solution by testing the error/status and you are right your application has to manage partial or complete result set.

regards
Tug
@tgrall

Hi,

So based on the discussion you found the solution by testing the error/status and you are right your application has to manage partial or complete result set.

regards
Tug
@tgrall