You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@couchdb.apache.org by "Benjamin ter Kuile (Updated) (JIRA)" <ji...@apache.org> on 2011/12/21 15:35:30 UTC
[jira] [Updated] (COUCHDB-1347) Filtered replication does not work
when a target document is purged
[ https://issues.apache.org/jira/browse/COUCHDB-1347?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Benjamin ter Kuile updated COUCHDB-1347:
----------------------------------------
Attachment: passing_replication.log
failing_replication.log
Running the test script. Difference between failing and passing is specifying the filter in the replication command
> Filtered replication does not work when a target document is purged
> -------------------------------------------------------------------
>
> Key: COUCHDB-1347
> URL: https://issues.apache.org/jira/browse/COUCHDB-1347
> Project: CouchDB
> Issue Type: Bug
> Components: Replication
> Affects Versions: 1.0.1, 1.1
> Environment: OS X Lion: {"couchdb":"Welcome","version":"1.1.0"} (brew installation)
> Ubuntu 11.04 {"couchdb":"Welcome","version":"1.0.1"}
> Reporter: Benjamin ter Kuile
> Labels: purge, replication
> Attachments: failing_replication.log, passing_replication.log
>
>
> When a document with an id is deleted and purged, and a replication process tries to create a document with that id, it does not happen. The replication without the filter works. Ruby test script:
> require 'rubygems'
> require 'couchrest'
> # setup
> server = CouchRest.new("http://localhost:5984")
> a = server.database('a')
> b = server.database('b')
> a.recreate!
> b.recreate!
> # Add a document doc1 to database a and b
> a.save_doc("_id" => 'doc1')
> b_doc1 = b.save_doc("_id" => 'doc1')
> # Delete and purge doc1 from b
> b.delete_doc("_id" => 'doc1', "_rev" => b_doc1['rev'])
> RestClient.post(File.join(b.root, '_purge'), {'doc1' => [b_doc1['rev']]}.to_json, :content_type => :json )
> # Add design with filter
> design = a.save_doc("_id" => "_design/temp", "filters" => {"test" => %|function(doc, req){if(['doc1'].indexOf(doc['_id']) >= 0){return true;}{return false;}}|})
> # Replicate and wait for finish
> RestClient.post("http://localhost:5984/_replicate", {:source => a.root, :filter => "temp/test", :target => b.root}.to_json, :content_type => :json)
> sleep(0.01) while JSON.parse(RestClient.get("http://localhost:5984/_active_tasks")).size > 0
> abort "oops" unless b.all_docs['total_rows'] == 1
> puts "Test successful"
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira