Pregunta

I just started using Couchbase and am trying to execute a simple query.

When I set a key that actully exists in my bucket the query works and I get a result. But when I set a key that doesn't exist the query seems to never return.

I'm using the Java client to create and execute the query. When I execute it from the Couchbase management UI it works properly.

Any ideas?

The view:

function (doc, meta) {
    if (doc.doc_type && doc.doc_type == "MyType") {
        emit(doc.myStr);
    }
}

The query:

Query query = new Query();
query.setIncludeDocs(true);
query.setStale(Stale.FALSE);
query.setKey("BB"); // i have no document with myStr == "BB"
ViewResponse res = client.query(view, query); // this row never returns

Thank you

Inbal

¿Fue útil?

Solución

Which version of the java sdk are you using?

It could be related to the issue SPY-163 http://www.couchbase.com/issues/browse/SPY-163

From the release notes of Java sdk 1.4.1 (where the fix is):

SPY-163: A deadlock has been fixed in the asyncGetBulk method (which is also facilitated by the view querying mechanism if setIncludeDocs(true) is used) that happened when an empty list of keys is passed in. This can happen also if a view request does not return results, so the empty list is passed down the stack, resulting in a thread that does not respond.

http://docs.couchbase.com/couchbase-sdk-java-1.4/#release-notes-for-couchbase-client-library-java-141-ga-8-may-2014

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top