You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@couchdb.apache.org by GitBox <gi...@apache.org> on 2019/03/26 15:48:48 UTC
[GitHub] [couchdb] brianewilkins edited a comment on issue #1734: Stop
replications on target document write failures
brianewilkins edited a comment on issue #1734: Stop replications on target document write failures
URL: https://github.com/apache/couchdb/pull/1734#issuecomment-476707751
The replication of a document silently fails if the sum of the sizes of its attachments is high enough. There is no indication of which documents failed to replicate or why.
Below is a sequence of commands to reproduce the problem using Cloudant.
When you run this sequence of commands the variables ACCOUNTNAME and PASSWORD must have been set to appropriate values.
```
SOURCE_DB=https://$ACCOUNTNAME:$PASSWORD@$ACCOUNTNAME.cloudant.com/fb110773_source
TARGET_DB=https://$ACCOUNTNAME:$PASSWORD@$ACCOUNTNAME.cloudant.com/fb110773_target
REPLICATOR_DB=https://$ACCOUNTNAME:$PASSWORD@$ACCOUNTNAME.cloudant.com/_replicator
ATTACHMENT_FILE=attachment_file
ATTACHMENT_MIME_TYPE=application/octet-stream
curl -X DELETE $SOURCE_DB
curl -X DELETE $TARGET_DB
curl -X PUT $SOURCE_DB
curl -X PUT $TARGET_DB
dd if=<(yes | tr -d "\n") of=$ATTACHMENT_FILE bs=1024 count=10240 # create a 10 MB file
REV=`curl -X PUT $SOURCE_DB/doc1 -H "Content-Type: application/json" -d {} | jq .rev | tr -d '"'`
REV=`curl -X PUT $SOURCE_DB/doc1/attachment1?rev=$REV -H "Content-Type: $ATTACHMENT_MIME_TYPE" -d @$ATTACHMENT_FILE | jq .rev | tr -d '"'`
REV=`curl -X PUT $SOURCE_DB/doc1/attachment2?rev=$REV -H "Content-Type: $ATTACHMENT_MIME_TYPE" -d @$ATTACHMENT_FILE | jq .rev | tr -d '"'`
REV=`curl -X PUT $SOURCE_DB/doc1/attachment3?rev=$REV -H "Content-Type: $ATTACHMENT_MIME_TYPE" -d @$ATTACHMENT_FILE | jq .rev | tr -d '"'`
REV=`curl -X PUT $SOURCE_DB/doc1/attachment4?rev=$REV -H "Content-Type: $ATTACHMENT_MIME_TYPE" -d @$ATTACHMENT_FILE | jq .rev | tr -d '"'`
REV=`curl -X PUT $SOURCE_DB/doc1/attachment5?rev=$REV -H "Content-Type: $ATTACHMENT_MIME_TYPE" -d @$ATTACHMENT_FILE | jq .rev | tr -d '"'`
REV=`curl -X PUT $SOURCE_DB/doc1/attachment6?rev=$REV -H "Content-Type: $ATTACHMENT_MIME_TYPE" -d @$ATTACHMENT_FILE | jq .rev | tr -d '"'`
REV=`curl -X PUT $SOURCE_DB/doc1/attachment7?rev=$REV -H "Content-Type: $ATTACHMENT_MIME_TYPE" -d @$ATTACHMENT_FILE | jq .rev | tr -d '"'`
REV=`curl -X PUT $SOURCE_DB/doc2 -H "Content-Type: application/json" -d {} | jq .rev | tr -d '"'`
REV=`curl -X PUT $SOURCE_DB/doc2/attachment1?rev=$REV -H "Content-Type: $ATTACHMENT_MIME_TYPE" -d @$ATTACHMENT_FILE | jq .rev | tr -d '"'`
curl -X PUT $REPLICATOR_DB
REPLICATOR_DOCID=fb110773_`date +%Y%m%d_%H%M%S`
curl -X PUT $REPLICATOR_DB/$REPLICATOR_DOCID -H "Content-Type: application/json" -d "
{
\"source\": \"$SOURCE_DB\",
\"target\": \"$TARGET_DB\"
}"
sleep 30
curl -s $TARGET_DB/_all_docs
curl -s $REPLICATOR_DB/$REPLICATOR_DOCID?include_docs=true | jq .
```
When you run that sequence of commands the document doc2, whose attachment size is no more than 10 MB, is replicated to the target database. But the document doc1 is not replicated to the target database, and that must be because the sum of the size of its attachments exceeds the effective value of httpd/max_http_request_size.
What is problematic is that it fails silently to replicate:
1) The "_replication_state" of the _replicator document is not an error state.
2) There is no indication of which documents failed to replicate or why.
Here is what the _replicator document eventually became (except that I have replaced my Cloudant account name with <account_redacted> and replaced my password with <password_redacted>):
```
$ curl -s $REPLICATOR_DB/$REPLICATOR_DOCID?include_docs=true | jq .
{
"_id": "fb110773_20181102_003011",
"_rev": "5-9d892a5b73b8099960ff97277a283f6c",
"source": "https://<account_redacted>:<password_redacted>@<account_redacted>.cloudant.com/fb110773_source",
"target": "https://<account_redacted>:<password_redacted>@<account_redacted>.cloudant.com/fb110773_target",
"owner": "<account_redacted>",
"_replication_state": "completed",
"_replication_state_time": "2018-11-02T00:36:55Z",
"_replication_id": "5c41510d28d26e691e1466c6e2eb0708",
"_replication_stats": {
"revisions_checked": 2,
"missing_revisions_found": 1,
"docs_read": 1,
"docs_written": 0,
"changes_pending": 1,
"doc_write_failures": 1,
"checkpointed_source_seq": "10-g1AAAAGbeJyNz8EKgkAQBuBBhepBOq6406Z1ylfZ2VkxWVcIPdeb1ZvZYkEUhF5mYBi-n98BQFLHDFsm011syYSYUiuMEaydyDA1rhtY-z71tnfhPdJAp3EcmzrW0IbDqqjU8SD3DJvBs63O3vIPKWdIKsOk61uNJlWbwmq2S53vRJnPJPokTLiFFULvny6kkDHH_12kWiQ_XvLUZz3JGZodGrXUap4XVn2S",
"start_time": "2018-11-02T00:30:11Z"
}
}
```
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services