[ 
https://issues.apache.org/jira/browse/COUCHDB-1363?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13170157#comment-13170157
 ] 

Filipe Manana commented on COUCHDB-1363:
----------------------------------------

Hi Randall,

This would only minimize the "problem", as right after re-opening the database 
some changes can happen.

As for the replicator_db.js test, the only case I can see this happening is 
when triggering a non-continuous replication, immediately after add some docs 
to the source database and then assert the docs were written to the target. I 
think this would be more a problem of the test then anything else. I don't 
recall if there's any test function which does that in replicator_db.js. Is 
there any? Which one did you find?

Also the following line you changed is a bit dangerous:

-                fun({_, DbName}) when DbName == Db#db.name ->
+                fun({_, DbName}) ->

The DbName inside the fun is shadowing the DbName in the handle_changes clause. 
This means you'll accept updates for any database.
The compiler should give you a warning about this.

I would also prefer you update the commit's title because this is not 
replication specific, but rather couch_changes specific.

I'm mostly convinced it's a test issue anyway.
                
> Race condition edge case when pulling local changes
> ---------------------------------------------------
>
>                 Key: COUCHDB-1363
>                 URL: https://issues.apache.org/jira/browse/COUCHDB-1363
>             Project: CouchDB
>          Issue Type: Bug
>          Components: Database Core
>    Affects Versions: 1.0.3, 1.1.1
>            Reporter: Randall Leeds
>            Assignee: Filipe Manana
>            Priority: Minor
>             Fix For: 1.2, 1.3
>
>         Attachments: 0001-Fix-a-race-condition-starting-replications.patch
>
>
> It's necessary to re-open the #db after subscribing to notifications so that 
> updates are not lost. In practice, this is rarely problematic because the 
> next change will cause everything to catch up, but if a quick burst of 
> changes happens while replication is starting the replication can go stale. 
> Detected by intermittent replicator_db js test failures.

--
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

        

Reply via email to