Comments (10)
Assuming the db record gets written on one node then we should return a 202 Accepted as the dbs db will be replicated and at that point we'll have created the database.
from couchdb.
I also have observed same behavior for my production cluster. Any idea, when it's going to be fixed? Is it targeted for specific release?
from couchdb.
Hi there, can you please include an excerpt from couch.log
showing what happens when the 500 is returned? Also, if possible, can you include the exact message returned to your client along with the 500, if any? Thanks.
from couchdb.
Sure!!
$ curl -X PUT "http://admin:[email protected]:5984/newtestdb2"
{"error":"error","reason":"internal_server_error"}
and the log, in debug mode
[debug] 2017-06-20T13:42:58.420676Z [email protected] <0.18754.0> ac122995ef cache miss for admin
[debug] 2017-06-20T13:42:58.421663Z [email protected] <0.18754.0> ac122995ef no record of user admin
[notice] 2017-06-20T13:42:58.564874Z [email protected] <0.18754.0> ac122995ef 127.0.0.1:5984 127.0.0.1 undefined PUT /newtestdb2 500 ok 144
from couchdb.
This one is a bit tricky. We are throwing internal_server_error
here when the writers quorum not met, but we can only know that after the fact, i.e. after we created db on all available nodes and didn't get enough replies from the writers.
The database is available after that, we can add docs to it and it'll be replicated to the rest of the nodes when they get up, so strictly speaking this is not a complete failure. But at the same time we want to have some kind of warning that the cluster is unstable, after all, if we'll get available nodes down and previously unavailable nodes up at the same time the database will as if suddenly disappear.
I guess we can add a check for the nodes availability on db creation/deletion before starting operations and throw 412 there if we know we wouldn't have the quorum. It wouldn't solve the issue completely, the nodes could go down during db creation, but at least it'll narrow the confusion gap. @davisp what do you think? Is it worth of try to implement?
from couchdb.
In addition to this, When I was testing behavior with 3 nodes cluster. Whenever 1 of the node is down then I was able to create database and receiving 200 status code.
But, it sends 500 status code when 2 nodes (out of 3) are down & only 1 is up.
from couchdb.
I've also noticed this issue during my cluster testing.
I think the problem is here
couchdb/src/fabric/src/fabric_db_create.erl
Line 143 in d16f2db
Accepted is returned if the number of responses are at least (W div 2 + 1). If you get less than this value an internal server error is returned.
In a three node cluster where the quorum is 2, you need at least 2 responses in order to get accepted as response which is the same number you need for a 200 status code response.
This seems not to be consistent with this description in the documentation "11.2 Theory" which applies to document reads/writes not to db creation but I expected a similar behaviour .
The number of copies of a document with the same revision that have to be read before CouchDB returns with a 200 is equal to a half of total copies of the document plus one. It is the same for the number of nodes that need to save a document before a write is returned with 201. If there are less nodes than that number, then 202 is returned. Both read and write numbers can be specified with a request as r and w parameters accordingly.
W div 2 + 1, seems to be the default quorum required for a 200 status code, not for a 202 status code response
from couchdb.
Same question as @ChiragMoradiya : "When will this fix make it to a Debian package?" Asking here as I was not able to find info about CouchDB release cycle.
from couchdb.
@jjrodrig thanks for the fix, closing this issue.
As to when it will be available in a package, the answer is "with the next release of CouchDB." Our intention is to release CouchDB approximately twice a year.
The last release of CouchDB was November 7, 2017.
from couchdb.
I experience the same issue as the OP on a single node, when cluster.n=1
has been set in the config.
I've been trying to post a document to a newly created user db (with the Couch Per User feature).
Typical log output look like this:
[notice] 2018-12-30T00:18:28.028842Z [email protected] <0.8860.0> 4cf3f1a0e6 localhost:5984 127.0.0.1 admin POST /userdb-*** 404 ok 17
[debug] 2018-12-30T00:18:29.031705Z [email protected] <0.8872.0> 8f64a178af no record of user admin
[notice] 2018-12-30T00:18:29.032887Z [email protected] <0.8872.0> 8f64a178af localhost:5984 127.0.0.1 admin POST /userdb-**** 404 ok 2
[debug] 2018-12-30T00:18:31.036855Z [email protected] <0.9002.0> 6745f08438 no record of user admin
[notice] 2018-12-30T00:18:31.038036Z [email protected] <0.9002.0> 6745f08438 localhost:5984 127.0.0.1 admin POST /userdb-**** 404 ok 2
[debug] 2018-12-30T00:18:35.041849Z [email protected] <0.9086.0> c3579d0751 no record of user admin
[notice] 2018-12-30T00:18:35.047631Z [email protected] <0.9086.0> c3579d0751 localhost:5984 127.0.0.1 admin POST /userdb-**** 404 ok 6
[debug] 2018-12-30T00:18:43.054896Z [email protected] <0.9199.0> 6a15101a52 no record of user admin
[notice] 2018-12-30T00:18:43.056778Z [email protected] <0.9199.0> 6a15101a52 localhost:5984 127.0.0.1 admin POST /userdb-**** 404 ok 3
Where posts to /userdb-****
are all the same recently created DB. The 5 calls are made rough 4 seconds apart, in a 20 second interval, and by that time, /userdb-****
had definitely been created.
It happens somewhat inconsistently too, which is surprising, because if cluster.n=1
, I shouldn't have to worry about the chance of the POST going to a non existent node, isn't that right?
from couchdb.
Related Issues (20)
- failed shard open and then high CPU usage HOT 4
- Previous response state retained when an ibrowse client is reused HOT 2
- [Question] _design/repl_filters HOT 3
- ERROR INSTALLING COUCHDB!! HOT 2
- Error message all of the sudden HOT 1
- Inconsistent behavior between `config:get*` accessors during cache failures HOT 1
- "fabric_rpc:open_revs/3 error:undef" print stack HOT 3
- `config:reload/0` ignores delete markers HOT 3
- Replication stopped for several databases after some days, couchdb version 3.3.1 HOT 6
- no match of right hand value HOT 5
- Configurable "Special Character" to allow JSON fieldnames beginning with underscore "_" HOT 3
- Chttpd request processing does not reset pdict predictably HOT 7
- Database size growing unexpectdly after upgrading couchdb to 3.2.2 from 3.1 HOT 1
- FreeBSD ARM64 CI Failures HOT 2
- Regex containing umlauts in square brackets not matching HOT 4
- Huge ram usage HOT 4
- Connection refused in Macbook M1 HOT 2
- Documentation: add default values HOT 1
- Database not reachable after snap auto refresh to 3.3.3 HOT 4
- Snap 3.3.3 breaks previous version (3.1.1) functionality HOT 11
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from couchdb.