-
Notifications
You must be signed in to change notification settings - Fork 145
Search Timeout with BigCouch #176
Comments
in fact, the log I put was from a 0.9 couchdb-lucene. But its the same thing with 0.10...
|
Anything interesting in the bigcouch log? |
I don't if its related... I have a bunch of these:
|
Grab the url that couchdb-lucene is trying from the log and try it independently on the command line? |
I set the log level of bigcouch to I can see couchdb-lucene queries but no error ?? doing a cURL
|
Thanks. I'll try it out tomorrow and see if I can get the same error. |
I did many more tests and its driving me crazy... if I don't set the security on the database, it works fine. If I secure it, it timeout. But if i remove the security, then it still doesn't work. curl 10.0.1.52:5985/local/data_96e130282817487a71d73b73fa1a7e43/_design/js/all?q=bar* Then I change the security curl 10.0.1.52:5985/local/data_96e130282817487a71d73b73fa1a7e43/_design/js/all?q=bar* broken... Ok, then put it back to no security but I have the same time error... The url contains the admin:password@localhost:5984 The other issue (maybe related ?) is if a replicate the database (futon replicator), for some target database name, it can't copy the two design docs: {"session_id":"84bf95b8d4690f7c2dfa3be91783ed95","start_time":"Mon, 15 Jul 2013 21:15:04 GMT","end_time":"Mon, 15 Jul 2013 21:15:04 GMT","start_last_seq":0,"end_last_seq":[2,"g1AAAAFDeJzLYWBg4MhgTmHgL87JLzd0MDTQM9Az1DM3zAFKMCUyJMn___8_K5EBrsQYrsQYrCRJAUgm2YNVMcJVGcFVGUFUOYBUxaOpQrcuKQGkqp6AjXksQJKhAUgBFc5HVoluK0TlAojK_cgq0W2GqDwAUXmfsO0PICpB7swCAM7JV3g"],"recorded_seq":[2,"g1AAAAFDeJzLYWBg4MhgTmHgL87JLzd0MDTQM9Az1DM3zAFKMCUyJMn___8_K5EBrsQYrsQYrCRJAUgm2YNVMcJVGcFVGUFUOYBUxaOpQrcuKQGkqp6AjXksQJKhAUgBFc5HVoluK0TlAojK_cgq0W2GqDwAUXmfsO0PICpB7swCAM7JV3g"],"missing_checked":0,"missing_found":2,"docs_read":2,"docs_written":0,"doc_write_failures":2} For target database "foo", it can't copy. But for "foo_foo", its alright!
Regular queries on the bigcouch cluster works as expected... It can GET, PUT, POST, docs without issues. Any ideas to fix this would be very much welcome. Thanks. |
Getting closer. It seems couchdb-lucene does send the _changes call to index new changes but does not get a response from bigcouch 0.4. The timeout then fires (as expected). |
In my test, couchdb-lucene is expecting a higher last_seq than the database sends in the changes feed. Quite strange. |
Could you show the output of the following two commands to confirm this?
This seems like a bug in bigcouch's _changes feed when descending=true, which is how bigcouch figures out what update sequence to wait for. Since it never appears, the search eventually times out. |
Here it is: curl 10.0.1.52:5984/data_b8008162df528b2008b72781dc007b94/_changes |
In the couchdb-lucene console, it output: 2013-07-16 03:29:14,023 INFO [data_b8008162df528b2008b72781dc007b94] Indexing from update_seq [5,"g1AAAAFDeJzLYWBg4MhgTmHgT0ssLjF0MDTQM9Az1DM1zAFKMCUyJMn___8_K5ERrKQ4J7_cGKbE3BisJEkBSCbZg1Ux4TQoyQGkKh7JLJAqI7gqI4iqBJCqerAqBpw25rEASYYGIAVUOB-mEpt5EJULICr3I6tEdx9E5QGIyvv43AhR-QCiEuTOLABwOlbj"] |
No security set: bin:$ curl 10.0.1.52:5984/data_b8008162df528b2008b72781dc02a4bf/ bin:$ curl 10.0.1.52:5984/data_b8008162df528b2008b72781dc02a4bf/_changes => Both last_seq and are update_seq are the same. I set the security. curl 10.0.1.52:5984/data_b8008162df528b2008b72781dc02a4bf/ => last_seq stick to [3, ... but update_seq has bump to [11,... Is that Ok ? |
I don't think security is the problem here, just that the index is now caught up but the mechanism that couchdb-lucene uses to confirm them doesn't work with bigcouch. The issue, at base, is that bigcouch reports a higher update sequence for changes?descending=true than it reports at the end of changes?descending=false. |
humm, here a database with no security. bin:$ curl admin:password@10.0.1.52:5984/data_b8008162df528b2008b72781dc0e77f3/_changes?descending=false descending lucene query I can Add more document and couchdb-lucene still works fine. But when I modify the security: bin:$ curl admin:password@10.0.1.52:5984/data_b8008162df528b2008b72781dc0e77f3/_changes?descending=false descending lucene query The security change affect the _changes stream in BigCouch. Regular Couchdb doesn't do that. Do you experience the same thing ? Maybe my cluster is wrong somehow... |
Changing security settings bumps the update_seq of the database but doesn't add any rows to _changes (since no document changed). |
Could it be the root of the problem ? I mean, couchdb-lucene with BigCouch works fine before I set the security... |
Yes, I think that's the root cause. If your last database update is to _security rather than a document, you'll get stuck like this. I think that's a bug in the last_seq that BigCouch emits. |
Unfortunately, even if i do a lot changes after I changed the security, it doesn't fix couchdb-lucene. If I revert the security settings and restart couchdb-lucene, its still stuck. The only way to make it works is to never touch the security. Its a big deal for a couchapp. Do you think its possible to workaround the issue in your code ? I don't think there will anymore BigCouch release before the couchdb 2.0 merge. |
well, I also code bigcouch and couchdb, so I'm sure I can figure something out. Not a lot of time free right now, though. |
👍 You are the man the job. Thanks! |
When a couchdb database's _security is updated, the update_seq of the db is updated. A BigCouch database consists of multiple couchdb databases ("q") each of which will receive the _security update. The sequence value is thus counting the _security bump multiple times, and I think that's what's confusing things. Not sure what can be done about it yet. |
So here's the plan. I'll change couchdb-lucene. It's clearly relying on behavior that it shouldn't. In order to ensure an index is 'caught up' when you query it, I'll have to make an http request to _changes with the since value, process every item, then run the search. I can't just rely on knowing when I pass an epoch in the already running _changes?feed=continuous request. |
If I understand well, each search query to the index will perform a request to _changes with since value to the last sequence it perform an update. No more feed=continuous request ? That's exactly how I process my queries for my spatial cache. I use a PostgreSQL database to index the geomtries and front it by a nodejs sever that perform the _change call, update the database with the new changes, store the last sequence in a special PG table and generate the proper SQL. It works well with both Couchdb and Bigcouch so far. |
Ah, no, not quite that. It'll be both. When you first query an index we'll do /_changes?since=, process all rows, and service your query (assuming you didn't do stale=ok, if you did, we'd skip the changes call). A separate feed=continuous job will be spun off to keep it fresh. |
That or figure out how to reliably know when we've gone past "current". Using the first seq from _changes?descending=true isn't it (for bigcouch). |
In a situation where there are thousands of databases (one per users), would couchdb-lucene keep one feed=continuous connection for each db that have been query at least once since couchdb-lucene run ? If yes, is there a configuration to disable the continuous feed ? |
Currently it would and there's no configuration option to turn that off.
|
🤔 I'm facing pretty much the problem here #264 ... any updates on that? I know, 5 years... 🤣 |
sorry, nope. I might have time to review a pull request but not to write it myself any time soon. |
Im using couchdb-lucene with couchdb with no issue. I do my queries on the jetty server through a nodejs server.
I want to use BigCouch but I can't make it work. I always get a timeout.
curl localhost:5985/local/data_96e130282817487a71d73b73fa1049f5/_design/js/all?q=hello
{"reason":"Search timed out.","code":500}
Logs:
How can I find out what is wrong ?
I use the latest (master) couchdb-lucene with bigcouch 0.4. Timeout is 10000 and I have less then 10 docs in the database.
The text was updated successfully, but these errors were encountered: