You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@couchdb.apache.org by "Jens Alfke (JIRA)" <ji...@apache.org> on 2011/08/24 00:25:29 UTC
[jira] [Created] (COUCHDB-1259) Replication ID is not stable if
local server has a dynamic port number
Replication ID is not stable if local server has a dynamic port number
----------------------------------------------------------------------
Key: COUCHDB-1259
URL: https://issues.apache.org/jira/browse/COUCHDB-1259
Project: CouchDB
Issue Type: Bug
Components: Replication
Affects Versions: 1.1
Reporter: Jens Alfke
I noticed that when Couchbase Mobile running on iOS replicates to/from a remote server (on iriscouch in this case), the replication has to fetch the full _changes feed every time it starts. Filipe helped me track down the problem -- the replication ID is coming out different every time. The reason for this is that the local port number, which is one of the inputs to the hash that generates the replication ID, is randomly assigned by the OS. (I.e. it uses a port number of 0 when opening its listener socket.) This is because there could be multiple apps using Couchbase Mobile running on the same device and we can't have their ports colliding.
The underlying problem is that CouchDB is attempting to generate a unique ID for a particular pair of {source, destination} databases, but it's basing it on attributes that aren't fundamental to the database and can change, like the hostname or port number.
One solution, proposed by Filipe and me, is to assign each database (or each server?) a random UUID when it's created, and use that to generate replication IDs.
Another solution, proposed by Damien, is to have CouchDB let the client work out the replication ID on its own, and set it as a property in the replication document (or the JSON body of a _replicate request.) This is even more flexible and will handle tricky scenarios like full P2P replication where there may be no low-level way to uniquely identify the remote database being synced with.
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
Re: [jira] [Commented] (COUCHDB-1259) Replication ID is not stable if
local server has a dynamic port number
Posted by Benoit Chesneau <bc...@gmail.com>.
Ok, I will do it again. This isn't a bug but a question of what do you expect.
I think it is expected in some cases that the replication won't
restart if the address change. Or it should be a application design
not something by default in couch.
On Mon, Nov 5, 2012 at 5:48 AM, Dale Harvey <da...@arandomurl.com> wrote:
> Benoit
>
> This problem has nothing to do with any application, its a bug in CouchDB
> with a simple fix
>
>
> On 4 November 2012 20:43, Benoit Chesneau (JIRA) <ji...@apache.org> wrote:
>
>>
>> [
>> https://issues.apache.org/jira/browse/COUCHDB-1259?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13490449#comment-13490449]
>>
>> Benoit Chesneau commented on COUCHDB-1259:
>> ------------------------------------------
>>
>> Hello.... are you understanding that this isn't only about your
>> application? Some may have different uses. And different routing policy.
>> And this is not the role of couchdb to fix them.
>>
>> > Replication ID is not stable if local server has a dynamic port number
>> > ----------------------------------------------------------------------
>> >
>> > Key: COUCHDB-1259
>> > URL: https://issues.apache.org/jira/browse/COUCHDB-1259
>> > Project: CouchDB
>> > Issue Type: Bug
>> > Components: Replication
>> > Affects Versions: 1.1
>> > Reporter: Jens Alfke
>> > Assignee: Robert Newson
>> > Priority: Blocker
>> > Fix For: 1.3
>> >
>> > Attachments: couchdb-1259.patch, couchdb-1259.patch
>> >
>> >
>> > I noticed that when Couchbase Mobile running on iOS replicates to/from a
>> remote server (on iriscouch in this case), the replication has to fetch the
>> full _changes feed every time it starts. Filipe helped me track down the
>> problem -- the replication ID is coming out different every time. The
>> reason for this is that the local port number, which is one of the inputs
>> to the hash that generates the replication ID, is randomly assigned by the
>> OS. (I.e. it uses a port number of 0 when opening its listener socket.)
>> This is because there could be multiple apps using Couchbase Mobile running
>> on the same device and we can't have their ports colliding.
>> > The underlying problem is that CouchDB is attempting to generate a
>> unique ID for a particular pair of {source, destination} databases, but
>> it's basing it on attributes that aren't fundamental to the database and
>> can change, like the hostname or port number.
>> > One solution, proposed by Filipe and me, is to assign each database (or
>> each server?) a random UUID when it's created, and use that to generate
>> replication IDs.
>> > Another solution, proposed by Damien, is to have CouchDB let the client
>> work out the replication ID on its own, and set it as a property in the
>> replication document (or the JSON body of a _replicate request.) This is
>> even more flexible and will handle tricky scenarios like full P2P
>> replication where there may be no low-level way to uniquely identify the
>> remote database being synced with.
>>
>> --
>> This message is automatically generated by JIRA.
>> If you think it was sent incorrectly, please contact your JIRA
>> administrators
>> For more information on JIRA, see: http://www.atlassian.com/software/jira
>>
Re: [jira] [Commented] (COUCHDB-1259) Replication ID is not stable if
local server has a dynamic port number
Posted by Dale Harvey <da...@arandomurl.com>.
Benoit
This problem has nothing to do with any application, its a bug in CouchDB
with a simple fix
On 4 November 2012 20:43, Benoit Chesneau (JIRA) <ji...@apache.org> wrote:
>
> [
> https://issues.apache.org/jira/browse/COUCHDB-1259?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13490449#comment-13490449]
>
> Benoit Chesneau commented on COUCHDB-1259:
> ------------------------------------------
>
> Hello.... are you understanding that this isn't only about your
> application? Some may have different uses. And different routing policy.
> And this is not the role of couchdb to fix them.
>
> > Replication ID is not stable if local server has a dynamic port number
> > ----------------------------------------------------------------------
> >
> > Key: COUCHDB-1259
> > URL: https://issues.apache.org/jira/browse/COUCHDB-1259
> > Project: CouchDB
> > Issue Type: Bug
> > Components: Replication
> > Affects Versions: 1.1
> > Reporter: Jens Alfke
> > Assignee: Robert Newson
> > Priority: Blocker
> > Fix For: 1.3
> >
> > Attachments: couchdb-1259.patch, couchdb-1259.patch
> >
> >
> > I noticed that when Couchbase Mobile running on iOS replicates to/from a
> remote server (on iriscouch in this case), the replication has to fetch the
> full _changes feed every time it starts. Filipe helped me track down the
> problem -- the replication ID is coming out different every time. The
> reason for this is that the local port number, which is one of the inputs
> to the hash that generates the replication ID, is randomly assigned by the
> OS. (I.e. it uses a port number of 0 when opening its listener socket.)
> This is because there could be multiple apps using Couchbase Mobile running
> on the same device and we can't have their ports colliding.
> > The underlying problem is that CouchDB is attempting to generate a
> unique ID for a particular pair of {source, destination} databases, but
> it's basing it on attributes that aren't fundamental to the database and
> can change, like the hostname or port number.
> > One solution, proposed by Filipe and me, is to assign each database (or
> each server?) a random UUID when it's created, and use that to generate
> replication IDs.
> > Another solution, proposed by Damien, is to have CouchDB let the client
> work out the replication ID on its own, and set it as a property in the
> replication document (or the JSON body of a _replicate request.) This is
> even more flexible and will handle tricky scenarios like full P2P
> replication where there may be no low-level way to uniquely identify the
> remote database being synced with.
>
> --
> This message is automatically generated by JIRA.
> If you think it was sent incorrectly, please contact your JIRA
> administrators
> For more information on JIRA, see: http://www.atlassian.com/software/jira
>
Re: [jira] [Commented] (COUCHDB-1259) Replication ID is not stable if
local server has a dynamic port number
Posted by Benoit Chesneau <bc...@gmail.com>.
On Thu, Nov 8, 2012 at 7:19 PM, Randall Leeds <ra...@gmail.com> wrote:
> Benoit, could you explain a bit more what you mean by "the issue related to
> the coordinated node".
>
I was referrering to the scenario where a couchdb node acts as a
replication gateway only (where source and remotes are different nodes
than the one coordinating the replication).
> I feel that TLS is the real security. I also favor using the _replicator
> document ID as the checkpoint ID (it makes it impossible to have two
> identical replications with different names, and I think this is good). I
> would support the ability to specify the checkpoint ID, in any case, as I
> believe Benoit is right that applications may want or needer finer control
> over routing and checkpoints.
>
+1
>
> On Mon, Nov 5, 2012 at 3:06 PM, Benoit Chesneau (JIRA) <ji...@apache.org>wrote:
>
>>
>> [
>> https://issues.apache.org/jira/browse/COUCHDB-1259?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13491019#comment-13491019]
>>
>> Benoit Chesneau commented on COUCHDB-1259:
>> ------------------------------------------
>>
>> There is a potential security issue using a remote node id like in the
>> second part of the patch. Local to local there is none.
>>
>>
>> I am + 1 for fixing the issue related to the coodinated node.
>>
>> > Replication ID is not stable if local server has a dynamic port number
>> > ----------------------------------------------------------------------
>> >
>> > Key: COUCHDB-1259
>> > URL: https://issues.apache.org/jira/browse/COUCHDB-1259
>> > Project: CouchDB
>> > Issue Type: Bug
>> > Components: Replication
>> > Affects Versions: 1.1
>> > Reporter: Jens Alfke
>> > Assignee: Robert Newson
>> > Priority: Blocker
>> > Fix For: 1.3
>> >
>> > Attachments: couchdb-1259.patch, couchdb-1259.patch
>> >
>> >
>> > I noticed that when Couchbase Mobile running on iOS replicates to/from a
>> remote server (on iriscouch in this case), the replication has to fetch the
>> full _changes feed every time it starts. Filipe helped me track down the
>> problem -- the replication ID is coming out different every time. The
>> reason for this is that the local port number, which is one of the inputs
>> to the hash that generates the replication ID, is randomly assigned by the
>> OS. (I.e. it uses a port number of 0 when opening its listener socket.)
>> This is because there could be multiple apps using Couchbase Mobile running
>> on the same device and we can't have their ports colliding.
>> > The underlying problem is that CouchDB is attempting to generate a
>> unique ID for a particular pair of {source, destination} databases, but
>> it's basing it on attributes that aren't fundamental to the database and
>> can change, like the hostname or port number.
>> > One solution, proposed by Filipe and me, is to assign each database (or
>> each server?) a random UUID when it's created, and use that to generate
>> replication IDs.
>> > Another solution, proposed by Damien, is to have CouchDB let the client
>> work out the replication ID on its own, and set it as a property in the
>> replication document (or the JSON body of a _replicate request.) This is
>> even more flexible and will handle tricky scenarios like full P2P
>> replication where there may be no low-level way to uniquely identify the
>> remote database being synced with.
>>
>> --
>> This message is automatically generated by JIRA.
>> If you think it was sent incorrectly, please contact your JIRA
>> administrators
>> For more information on JIRA, see: http://www.atlassian.com/software/jira
>>
Re: [jira] [Commented] (COUCHDB-1259) Replication ID is not stable if
local server has a dynamic port number
Posted by Randall Leeds <ra...@gmail.com>.
Benoit, could you explain a bit more what you mean by "the issue related to
the coordinated node".
I feel that TLS is the real security. I also favor using the _replicator
document ID as the checkpoint ID (it makes it impossible to have two
identical replications with different names, and I think this is good). I
would support the ability to specify the checkpoint ID, in any case, as I
believe Benoit is right that applications may want or needer finer control
over routing and checkpoints.
On Mon, Nov 5, 2012 at 3:06 PM, Benoit Chesneau (JIRA) <ji...@apache.org>wrote:
>
> [
> https://issues.apache.org/jira/browse/COUCHDB-1259?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13491019#comment-13491019]
>
> Benoit Chesneau commented on COUCHDB-1259:
> ------------------------------------------
>
> There is a potential security issue using a remote node id like in the
> second part of the patch. Local to local there is none.
>
>
> I am + 1 for fixing the issue related to the coodinated node.
>
> > Replication ID is not stable if local server has a dynamic port number
> > ----------------------------------------------------------------------
> >
> > Key: COUCHDB-1259
> > URL: https://issues.apache.org/jira/browse/COUCHDB-1259
> > Project: CouchDB
> > Issue Type: Bug
> > Components: Replication
> > Affects Versions: 1.1
> > Reporter: Jens Alfke
> > Assignee: Robert Newson
> > Priority: Blocker
> > Fix For: 1.3
> >
> > Attachments: couchdb-1259.patch, couchdb-1259.patch
> >
> >
> > I noticed that when Couchbase Mobile running on iOS replicates to/from a
> remote server (on iriscouch in this case), the replication has to fetch the
> full _changes feed every time it starts. Filipe helped me track down the
> problem -- the replication ID is coming out different every time. The
> reason for this is that the local port number, which is one of the inputs
> to the hash that generates the replication ID, is randomly assigned by the
> OS. (I.e. it uses a port number of 0 when opening its listener socket.)
> This is because there could be multiple apps using Couchbase Mobile running
> on the same device and we can't have their ports colliding.
> > The underlying problem is that CouchDB is attempting to generate a
> unique ID for a particular pair of {source, destination} databases, but
> it's basing it on attributes that aren't fundamental to the database and
> can change, like the hostname or port number.
> > One solution, proposed by Filipe and me, is to assign each database (or
> each server?) a random UUID when it's created, and use that to generate
> replication IDs.
> > Another solution, proposed by Damien, is to have CouchDB let the client
> work out the replication ID on its own, and set it as a property in the
> replication document (or the JSON body of a _replicate request.) This is
> even more flexible and will handle tricky scenarios like full P2P
> replication where there may be no low-level way to uniquely identify the
> remote database being synced with.
>
> --
> This message is automatically generated by JIRA.
> If you think it was sent incorrectly, please contact your JIRA
> administrators
> For more information on JIRA, see: http://www.atlassian.com/software/jira
>
Re: [jira] [Commented] (COUCHDB-1259) Replication ID is not stable if
local server has a dynamic port number
Posted by Benoit Chesneau <bc...@gmail.com>.
i will once i find a device that can do it. in the meantime can we fix jira
so it can accept again the responses by mails? This is now on my priority
list.
benoit
On Nov 5, 2012 10:32 AM, "Robert Newson" <rn...@apache.org> wrote:
> please reply on the ticket.
>
>
> On 5 November 2012 09:27, Benoit Chesneau <bc...@gmail.com> wrote:
>
> > On Nov 5, 2012 10:25 AM, "Robert Newson (JIRA)" <ji...@apache.org> wrote:
> > >
> > >
> > > [
> >
> >
> https://issues.apache.org/jira/browse/COUCHDB-1259?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13490527#comment-13490527
> > ]
> > >
> > > Robert Newson commented on COUCHDB-1259:
> > > ----------------------------------------
> > >
> > > Benoit, are you vetoing this change? If so, please include a reason why
> > improving the hit rate for replication checkpoints should not be included
> > in our next release.
> >
> > how does it improve the hit rate? how is it related to this ticket?
> > >
> > > Everyone else, please comment on the patch itself, I want feedback on
> 1)
> > the quality and correctness of the patch and 2) whether, when using UUID,
> > whether it is correct to use UUID instead of the {Scheme, UserInfo, UUID,
> > Path} tuple that I've chosen as I would prefer to simply use the UUID if
> > it's correct to do so for clarity.
> > >
> > > https://github.com/apache/couchdb/pull/35
> > >
> > >
> > > > Replication ID is not stable if local server has a dynamic port
> number
> > > >
> ----------------------------------------------------------------------
> > > >
> > > > Key: COUCHDB-1259
> > > > URL:
> > https://issues.apache.org/jira/browse/COUCHDB-1259
> > > > Project: CouchDB
> > > > Issue Type: Bug
> > > > Components: Replication
> > > > Affects Versions: 1.1
> > > > Reporter: Jens Alfke
> > > > Assignee: Robert Newson
> > > > Priority: Blocker
> > > > Fix For: 1.3
> > > >
> > > > Attachments: couchdb-1259.patch, couchdb-1259.patch
> > > >
> > > >
> > > > I noticed that when Couchbase Mobile running on iOS replicates
> to/from
> > a remote server (on iriscouch in this case), the replication has to fetch
> > the full _changes feed every time it starts. Filipe helped me track down
> > the problem -- the replication ID is coming out different every time. The
> > reason for this is that the local port number, which is one of the inputs
> > to the hash that generates the replication ID, is randomly assigned by
> the
> > OS. (I.e. it uses a port number of 0 when opening its listener socket.)
> > This is because there could be multiple apps using Couchbase Mobile
> running
> > on the same device and we can't have their ports colliding.
> > > > The underlying problem is that CouchDB is attempting to generate a
> > unique ID for a particular pair of {source, destination} databases, but
> > it's basing it on attributes that aren't fundamental to the database and
> > can change, like the hostname or port number.
> > > > One solution, proposed by Filipe and me, is to assign each database
> (or
> > each server?) a random UUID when it's created, and use that to generate
> > replication IDs.
> > > > Another solution, proposed by Damien, is to have CouchDB let the
> client
> > work out the replication ID on its own, and set it as a property in the
> > replication document (or the JSON body of a _replicate request.) This is
> > even more flexible and will handle tricky scenarios like full P2P
> > replication where there may be no low-level way to uniquely identify the
> > remote database being synced with.
> > >
> > > --
> > > This message is automatically generated by JIRA.
> > > If you think it was sent incorrectly, please contact your JIRA
> > administrators
> > > For more information on JIRA, see:
> > http://www.atlassian.com/software/jira
> >
>
Re: [jira] [Commented] (COUCHDB-1259) Replication ID is not stable if
local server has a dynamic port number
Posted by Robert Newson <rn...@apache.org>.
please reply on the ticket.
On 5 November 2012 09:27, Benoit Chesneau <bc...@gmail.com> wrote:
> On Nov 5, 2012 10:25 AM, "Robert Newson (JIRA)" <ji...@apache.org> wrote:
> >
> >
> > [
>
> https://issues.apache.org/jira/browse/COUCHDB-1259?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13490527#comment-13490527
> ]
> >
> > Robert Newson commented on COUCHDB-1259:
> > ----------------------------------------
> >
> > Benoit, are you vetoing this change? If so, please include a reason why
> improving the hit rate for replication checkpoints should not be included
> in our next release.
>
> how does it improve the hit rate? how is it related to this ticket?
> >
> > Everyone else, please comment on the patch itself, I want feedback on 1)
> the quality and correctness of the patch and 2) whether, when using UUID,
> whether it is correct to use UUID instead of the {Scheme, UserInfo, UUID,
> Path} tuple that I've chosen as I would prefer to simply use the UUID if
> it's correct to do so for clarity.
> >
> > https://github.com/apache/couchdb/pull/35
> >
> >
> > > Replication ID is not stable if local server has a dynamic port number
> > > ----------------------------------------------------------------------
> > >
> > > Key: COUCHDB-1259
> > > URL:
> https://issues.apache.org/jira/browse/COUCHDB-1259
> > > Project: CouchDB
> > > Issue Type: Bug
> > > Components: Replication
> > > Affects Versions: 1.1
> > > Reporter: Jens Alfke
> > > Assignee: Robert Newson
> > > Priority: Blocker
> > > Fix For: 1.3
> > >
> > > Attachments: couchdb-1259.patch, couchdb-1259.patch
> > >
> > >
> > > I noticed that when Couchbase Mobile running on iOS replicates to/from
> a remote server (on iriscouch in this case), the replication has to fetch
> the full _changes feed every time it starts. Filipe helped me track down
> the problem -- the replication ID is coming out different every time. The
> reason for this is that the local port number, which is one of the inputs
> to the hash that generates the replication ID, is randomly assigned by the
> OS. (I.e. it uses a port number of 0 when opening its listener socket.)
> This is because there could be multiple apps using Couchbase Mobile running
> on the same device and we can't have their ports colliding.
> > > The underlying problem is that CouchDB is attempting to generate a
> unique ID for a particular pair of {source, destination} databases, but
> it's basing it on attributes that aren't fundamental to the database and
> can change, like the hostname or port number.
> > > One solution, proposed by Filipe and me, is to assign each database (or
> each server?) a random UUID when it's created, and use that to generate
> replication IDs.
> > > Another solution, proposed by Damien, is to have CouchDB let the client
> work out the replication ID on its own, and set it as a property in the
> replication document (or the JSON body of a _replicate request.) This is
> even more flexible and will handle tricky scenarios like full P2P
> replication where there may be no low-level way to uniquely identify the
> remote database being synced with.
> >
> > --
> > This message is automatically generated by JIRA.
> > If you think it was sent incorrectly, please contact your JIRA
> administrators
> > For more information on JIRA, see:
> http://www.atlassian.com/software/jira
>
Re: [jira] [Commented] (COUCHDB-1259) Replication ID is not stable if
local server has a dynamic port number
Posted by Benoit Chesneau <bc...@gmail.com>.
On Nov 5, 2012 10:25 AM, "Robert Newson (JIRA)" <ji...@apache.org> wrote:
>
>
> [
https://issues.apache.org/jira/browse/COUCHDB-1259?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13490527#comment-13490527]
>
> Robert Newson commented on COUCHDB-1259:
> ----------------------------------------
>
> Benoit, are you vetoing this change? If so, please include a reason why
improving the hit rate for replication checkpoints should not be included
in our next release.
how does it improve the hit rate? how is it related to this ticket?
>
> Everyone else, please comment on the patch itself, I want feedback on 1)
the quality and correctness of the patch and 2) whether, when using UUID,
whether it is correct to use UUID instead of the {Scheme, UserInfo, UUID,
Path} tuple that I've chosen as I would prefer to simply use the UUID if
it's correct to do so for clarity.
>
> https://github.com/apache/couchdb/pull/35
>
>
> > Replication ID is not stable if local server has a dynamic port number
> > ----------------------------------------------------------------------
> >
> > Key: COUCHDB-1259
> > URL: https://issues.apache.org/jira/browse/COUCHDB-1259
> > Project: CouchDB
> > Issue Type: Bug
> > Components: Replication
> > Affects Versions: 1.1
> > Reporter: Jens Alfke
> > Assignee: Robert Newson
> > Priority: Blocker
> > Fix For: 1.3
> >
> > Attachments: couchdb-1259.patch, couchdb-1259.patch
> >
> >
> > I noticed that when Couchbase Mobile running on iOS replicates to/from
a remote server (on iriscouch in this case), the replication has to fetch
the full _changes feed every time it starts. Filipe helped me track down
the problem -- the replication ID is coming out different every time. The
reason for this is that the local port number, which is one of the inputs
to the hash that generates the replication ID, is randomly assigned by the
OS. (I.e. it uses a port number of 0 when opening its listener socket.)
This is because there could be multiple apps using Couchbase Mobile running
on the same device and we can't have their ports colliding.
> > The underlying problem is that CouchDB is attempting to generate a
unique ID for a particular pair of {source, destination} databases, but
it's basing it on attributes that aren't fundamental to the database and
can change, like the hostname or port number.
> > One solution, proposed by Filipe and me, is to assign each database (or
each server?) a random UUID when it's created, and use that to generate
replication IDs.
> > Another solution, proposed by Damien, is to have CouchDB let the client
work out the replication ID on its own, and set it as a property in the
replication document (or the JSON body of a _replicate request.) This is
even more flexible and will handle tricky scenarios like full P2P
replication where there may be no low-level way to uniquely identify the
remote database being synced with.
>
> --
> This message is automatically generated by JIRA.
> If you think it was sent incorrectly, please contact your JIRA
administrators
> For more information on JIRA, see: http://www.atlassian.com/software/jira
Re: [jira] [Commented] (COUCHDB-1259) Replication ID is not stable if
local server has a dynamic port number
Posted by Benoit Chesneau <bc...@gmail.com>.
it is working again . Someone fixed the jira conf.
On Tue, Nov 6, 2012 at 4:40 PM, Jan Lehnardt <ja...@apache.org> wrote:
>
> On Nov 5, 2012, at 08:54 , Benoit Chesneau <bc...@gmail.com> wrote:
>
>> btw sound like jira isn't handling mails now so we should continue
>> this discussion on the ticket.
>
> It never has, to my knowledge.
>
> IIRC it works with GitHub Issues/Pull Requests, but not here. Would be
> a great feature though.
>
> Cheers
> Jan
> --
>
>>
>> On Mon, Nov 5, 2012 at 8:53 AM, Benoit Chesneau <bc...@gmail.com> wrote:
>>> On Mon, Nov 5, 2012 at 7:48 AM, Dustin Sallings <du...@spy.net> wrote:
>>>> Benoit Chesneau <bc...@gmail.com>
>>>> writes:
>>>>
>>>>>> 1. My home couchdb server (by hostname, only available from inside my
>>>>>> house)
>>>>>> 2. My work couchdb server (by hostname, available inside and outside,
>>>>>> but the IP addresses are different in each location).
>>>>>> 3. Iriscouch (by hostname, available everywhere on the same address)
>>>>>>
>>>>>> In all three cases, it can stop replication, but will resume again if
>>>>>> I restart.
>>>>>>
>>>>> Most of these cases already work if you are using the new _replicator api.
>>>>
>>>> If you're referring to the replicator DB, then yes, that's the way
>>>> I set up all my replications, and why it starts back up when I restart.
>>>>
>>>>>> Under what circumstances do you consider "stop replicating after
>>>>>> sleep, but start again if the user restarts CouchDB" good behavior?
>>>>>
>>>>> - local replications should always restart.
>>>>> - replication with remote should restart only if the remote didn't
>>>>> change and my network didn't change.
>>>>>
>>>>> In other cases I need to rely on a mecanism to validate that I can
>>>>> continue the replication. In that case I agree it can be automated and
>>>>> we have different solution to do it. But that should never be a
>>>>> default mecanism imo.
>>>>
>>>> Let's assume what you're saying is OK and that the real bug here is
>>>> that it *does* restart when I kill and restart CouchDB...
>>>
>>> Any log in couch? Does it simply stop the replication?
>>>>
>>>> The one that I notice the most is an application that collects data in
>>>> my house that replicates to my laptop. The *only* time this can
>>>> possibly work is when my laptop is on my home LAN. That means, for it
>>>> to start properly, it has to be connected to my home LAN before I ever
>>>> see anything.
>>>>
>>>> Then I go somewhere else. Let's assume the somewhere else has a
>>>> host named "menudo" (which is the unfortunate hostname of the machine in
>>>> my house running CouchDB). Because I'm on a different network, the
>>>> replicator decides it's probably not the menudo I'm looking for, so it
>>>> ceases replication.
>>>>
>>>> When I go back home, shouldn't it start back up?
>>>
>>> At this point the replication should be stopped because it retried
>>> too many time on your other network. I am not sure anyway that it is
>>> desirable to restart it from the old replication doc at least without
>>> checking that the remote is the remote.
>>>
>>>
>>>>
>>>> Doesn't this whole thing get a lot more simple and inline with what
>>>> any reasonable user might expect if you just say, "configured
>>>> replications run as configured"?
>>>
>>> I agree, that it is interresting to have such features and i know at
>>> least 2 projects proposing layers to handle that. Imo that is
>>> requiring a small change in the the replicator client to check the
>>> remote and eventually associate a remote id to an replication id and
>>> change have a mapping [remote id, {Host, Port}] that is change after a
>>> conversation with the remote node. That is this part that should be
>>> switchable so for people that want it they could eventually check
>>> against a node id . The logic depends on the application policy imo.
>>>
>>> - benoît
>
Re: [jira] [Commented] (COUCHDB-1259) Replication ID is not stable if local server has a dynamic port number
Posted by Jan Lehnardt <ja...@apache.org>.
On Nov 5, 2012, at 08:54 , Benoit Chesneau <bc...@gmail.com> wrote:
> btw sound like jira isn't handling mails now so we should continue
> this discussion on the ticket.
It never has, to my knowledge.
IIRC it works with GitHub Issues/Pull Requests, but not here. Would be
a great feature though.
Cheers
Jan
--
>
> On Mon, Nov 5, 2012 at 8:53 AM, Benoit Chesneau <bc...@gmail.com> wrote:
>> On Mon, Nov 5, 2012 at 7:48 AM, Dustin Sallings <du...@spy.net> wrote:
>>> Benoit Chesneau <bc...@gmail.com>
>>> writes:
>>>
>>>>> 1. My home couchdb server (by hostname, only available from inside my
>>>>> house)
>>>>> 2. My work couchdb server (by hostname, available inside and outside,
>>>>> but the IP addresses are different in each location).
>>>>> 3. Iriscouch (by hostname, available everywhere on the same address)
>>>>>
>>>>> In all three cases, it can stop replication, but will resume again if
>>>>> I restart.
>>>>>
>>>> Most of these cases already work if you are using the new _replicator api.
>>>
>>> If you're referring to the replicator DB, then yes, that's the way
>>> I set up all my replications, and why it starts back up when I restart.
>>>
>>>>> Under what circumstances do you consider "stop replicating after
>>>>> sleep, but start again if the user restarts CouchDB" good behavior?
>>>>
>>>> - local replications should always restart.
>>>> - replication with remote should restart only if the remote didn't
>>>> change and my network didn't change.
>>>>
>>>> In other cases I need to rely on a mecanism to validate that I can
>>>> continue the replication. In that case I agree it can be automated and
>>>> we have different solution to do it. But that should never be a
>>>> default mecanism imo.
>>>
>>> Let's assume what you're saying is OK and that the real bug here is
>>> that it *does* restart when I kill and restart CouchDB...
>>
>> Any log in couch? Does it simply stop the replication?
>>>
>>> The one that I notice the most is an application that collects data in
>>> my house that replicates to my laptop. The *only* time this can
>>> possibly work is when my laptop is on my home LAN. That means, for it
>>> to start properly, it has to be connected to my home LAN before I ever
>>> see anything.
>>>
>>> Then I go somewhere else. Let's assume the somewhere else has a
>>> host named "menudo" (which is the unfortunate hostname of the machine in
>>> my house running CouchDB). Because I'm on a different network, the
>>> replicator decides it's probably not the menudo I'm looking for, so it
>>> ceases replication.
>>>
>>> When I go back home, shouldn't it start back up?
>>
>> At this point the replication should be stopped because it retried
>> too many time on your other network. I am not sure anyway that it is
>> desirable to restart it from the old replication doc at least without
>> checking that the remote is the remote.
>>
>>
>>>
>>> Doesn't this whole thing get a lot more simple and inline with what
>>> any reasonable user might expect if you just say, "configured
>>> replications run as configured"?
>>
>> I agree, that it is interresting to have such features and i know at
>> least 2 projects proposing layers to handle that. Imo that is
>> requiring a small change in the the replicator client to check the
>> remote and eventually associate a remote id to an replication id and
>> change have a mapping [remote id, {Host, Port}] that is change after a
>> conversation with the remote node. That is this part that should be
>> switchable so for people that want it they could eventually check
>> against a node id . The logic depends on the application policy imo.
>>
>> - benoît
Re: [jira] [Commented] (COUCHDB-1259) Replication ID is not stable if
local server has a dynamic port number
Posted by Benoit Chesneau <bc...@gmail.com>.
btw sound like jira isn't handling mails now so we should continue
this discussion on the ticket.
On Mon, Nov 5, 2012 at 8:53 AM, Benoit Chesneau <bc...@gmail.com> wrote:
> On Mon, Nov 5, 2012 at 7:48 AM, Dustin Sallings <du...@spy.net> wrote:
>> Benoit Chesneau <bc...@gmail.com>
>> writes:
>>
>>>> 1. My home couchdb server (by hostname, only available from inside my
>>>> house)
>>>> 2. My work couchdb server (by hostname, available inside and outside,
>>>> but the IP addresses are different in each location).
>>>> 3. Iriscouch (by hostname, available everywhere on the same address)
>>>>
>>>> In all three cases, it can stop replication, but will resume again if
>>>> I restart.
>>>>
>>> Most of these cases already work if you are using the new _replicator api.
>>
>> If you're referring to the replicator DB, then yes, that's the way
>> I set up all my replications, and why it starts back up when I restart.
>>
>>>> Under what circumstances do you consider "stop replicating after
>>>> sleep, but start again if the user restarts CouchDB" good behavior?
>>>
>>> - local replications should always restart.
>>> - replication with remote should restart only if the remote didn't
>>> change and my network didn't change.
>>>
>>> In other cases I need to rely on a mecanism to validate that I can
>>> continue the replication. In that case I agree it can be automated and
>>> we have different solution to do it. But that should never be a
>>> default mecanism imo.
>>
>> Let's assume what you're saying is OK and that the real bug here is
>> that it *does* restart when I kill and restart CouchDB...
>
> Any log in couch? Does it simply stop the replication?
>>
>> The one that I notice the most is an application that collects data in
>> my house that replicates to my laptop. The *only* time this can
>> possibly work is when my laptop is on my home LAN. That means, for it
>> to start properly, it has to be connected to my home LAN before I ever
>> see anything.
>>
>> Then I go somewhere else. Let's assume the somewhere else has a
>> host named "menudo" (which is the unfortunate hostname of the machine in
>> my house running CouchDB). Because I'm on a different network, the
>> replicator decides it's probably not the menudo I'm looking for, so it
>> ceases replication.
>>
>> When I go back home, shouldn't it start back up?
>
> At this point the replication should be stopped because it retried
> too many time on your other network. I am not sure anyway that it is
> desirable to restart it from the old replication doc at least without
> checking that the remote is the remote.
>
>
>>
>> Doesn't this whole thing get a lot more simple and inline with what
>> any reasonable user might expect if you just say, "configured
>> replications run as configured"?
>
> I agree, that it is interresting to have such features and i know at
> least 2 projects proposing layers to handle that. Imo that is
> requiring a small change in the the replicator client to check the
> remote and eventually associate a remote id to an replication id and
> change have a mapping [remote id, {Host, Port}] that is change after a
> conversation with the remote node. That is this part that should be
> switchable so for people that want it they could eventually check
> against a node id . The logic depends on the application policy imo.
>
> - benoît
Re: [jira] [Commented] (COUCHDB-1259) Replication ID is not stable if
local server has a dynamic port number
Posted by Benoit Chesneau <bc...@gmail.com>.
On Mon, Nov 5, 2012 at 7:48 AM, Dustin Sallings <du...@spy.net> wrote:
> Benoit Chesneau <bc...@gmail.com>
> writes:
>
>>> 1. My home couchdb server (by hostname, only available from inside my
>>> house)
>>> 2. My work couchdb server (by hostname, available inside and outside,
>>> but the IP addresses are different in each location).
>>> 3. Iriscouch (by hostname, available everywhere on the same address)
>>>
>>> In all three cases, it can stop replication, but will resume again if
>>> I restart.
>>>
>> Most of these cases already work if you are using the new _replicator api.
>
> If you're referring to the replicator DB, then yes, that's the way
> I set up all my replications, and why it starts back up when I restart.
>
>>> Under what circumstances do you consider "stop replicating after
>>> sleep, but start again if the user restarts CouchDB" good behavior?
>>
>> - local replications should always restart.
>> - replication with remote should restart only if the remote didn't
>> change and my network didn't change.
>>
>> In other cases I need to rely on a mecanism to validate that I can
>> continue the replication. In that case I agree it can be automated and
>> we have different solution to do it. But that should never be a
>> default mecanism imo.
>
> Let's assume what you're saying is OK and that the real bug here is
> that it *does* restart when I kill and restart CouchDB...
Any log in couch? Does it simply stop the replication?
>
> The one that I notice the most is an application that collects data in
> my house that replicates to my laptop. The *only* time this can
> possibly work is when my laptop is on my home LAN. That means, for it
> to start properly, it has to be connected to my home LAN before I ever
> see anything.
>
> Then I go somewhere else. Let's assume the somewhere else has a
> host named "menudo" (which is the unfortunate hostname of the machine in
> my house running CouchDB). Because I'm on a different network, the
> replicator decides it's probably not the menudo I'm looking for, so it
> ceases replication.
>
> When I go back home, shouldn't it start back up?
At this point the replication should be stopped because it retried
too many time on your other network. I am not sure anyway that it is
desirable to restart it from the old replication doc at least without
checking that the remote is the remote.
>
> Doesn't this whole thing get a lot more simple and inline with what
> any reasonable user might expect if you just say, "configured
> replications run as configured"?
I agree, that it is interresting to have such features and i know at
least 2 projects proposing layers to handle that. Imo that is
requiring a small change in the the replicator client to check the
remote and eventually associate a remote id to an replication id and
change have a mapping [remote id, {Host, Port}] that is change after a
conversation with the remote node. That is this part that should be
switchable so for people that want it they could eventually check
against a node id . The logic depends on the application policy imo.
- benoît
Re: [jira] [Commented] (COUCHDB-1259) Replication ID is not stable if local server has a dynamic port number
Posted by Dustin Sallings <du...@spy.net>.
Benoit Chesneau <bc...@gmail.com>
writes:
>> 1. My home couchdb server (by hostname, only available from inside my
>> house)
>> 2. My work couchdb server (by hostname, available inside and outside,
>> but the IP addresses are different in each location).
>> 3. Iriscouch (by hostname, available everywhere on the same address)
>>
>> In all three cases, it can stop replication, but will resume again if
>> I restart.
>>
> Most of these cases already work if you are using the new _replicator api.
If you're referring to the replicator DB, then yes, that's the way
I set up all my replications, and why it starts back up when I restart.
>> Under what circumstances do you consider "stop replicating after
>> sleep, but start again if the user restarts CouchDB" good behavior?
>
> - local replications should always restart.
> - replication with remote should restart only if the remote didn't
> change and my network didn't change.
>
> In other cases I need to rely on a mecanism to validate that I can
> continue the replication. In that case I agree it can be automated and
> we have different solution to do it. But that should never be a
> default mecanism imo.
Let's assume what you're saying is OK and that the real bug here is
that it *does* restart when I kill and restart CouchDB...
The one that I notice the most is an application that collects data in
my house that replicates to my laptop. The *only* time this can
possibly work is when my laptop is on my home LAN. That means, for it
to start properly, it has to be connected to my home LAN before I ever
see anything.
Then I go somewhere else. Let's assume the somewhere else has a
host named "menudo" (which is the unfortunate hostname of the machine in
my house running CouchDB). Because I'm on a different network, the
replicator decides it's probably not the menudo I'm looking for, so it
ceases replication.
When I go back home, shouldn't it start back up?
Doesn't this whole thing get a lot more simple and inline with what
any reasonable user might expect if you just say, "configured
replications run as configured"?
--
dustin
Re: [jira] [Commented] (COUCHDB-1259) Replication ID is not stable if
local server has a dynamic port number
Posted by Benoit Chesneau <bc...@gmail.com>.
On Mon, Nov 5, 2012 at 7:27 AM, Dustin Sallings <du...@spy.net> wrote:
> Benoit Chesneau <bc...@gmail.com>
> writes:
>
>> Just ask around you how many people aren't changing the default port
>> of couchdb and pur their servers in usual ip ranges you expect from a
>> server. Imo a port change is a significant event.
>
> I am completely failing to understand what you're saying. This fails
> for me on my laptop for three cases:
>
> 1. My home couchdb server (by hostname, only available from inside my
> house)
> 2. My work couchdb server (by hostname, available inside and outside,
> but the IP addresses are different in each location).
> 3. Iriscouch (by hostname, available everywhere on the same address)
>
> In all three cases, it can stop replication, but will resume again if
> I restart.
>
Most of these cases already work if you are using the new _replicator api.
> Under what circumstances do you consider "stop replicating after
> sleep, but start again if the user restarts CouchDB" good behavior?
- local replications should always restart.
- replication with remote should restart only if the remote didn't
change and my network didn't change.
In other cases I need to rely on a mecanism to validate that I can
continue the replication. In that case I agree it can be automated and
we have different solution to do it. But that should never be a
default mecanism imo.
- benoît
Re: [jira] [Commented] (COUCHDB-1259) Replication ID is not stable if local server has a dynamic port number
Posted by Dustin Sallings <du...@spy.net>.
Benoit Chesneau <bc...@gmail.com>
writes:
> Just ask around you how many people aren't changing the default port
> of couchdb and pur their servers in usual ip ranges you expect from a
> server. Imo a port change is a significant event.
I am completely failing to understand what you're saying. This fails
for me on my laptop for three cases:
1. My home couchdb server (by hostname, only available from inside my
house)
2. My work couchdb server (by hostname, available inside and outside,
but the IP addresses are different in each location).
3. Iriscouch (by hostname, available everywhere on the same address)
In all three cases, it can stop replication, but will resume again if
I restart.
Under what circumstances do you consider "stop replicating after
sleep, but start again if the user restarts CouchDB" good behavior?
--
dustin
Re: [jira] [Commented] (COUCHDB-1259) Replication ID is not stable if
local server has a dynamic port number
Posted by Benoit Chesneau <bc...@gmail.com>.
On Mon, Nov 5, 2012 at 7:08 AM, Dustin Sallings <du...@spy.net> wrote:
> Benoit Chesneau <bc...@gmail.com>
> writes:
>
>> i am with my laptop in an office. Start a replication with a remote node.
>>
>> my laptop get an ip/port from dhcp, the remote has an ip / address.
>>
>> I'm moving in another office. connect to the dhcp. there is also a
>> remote node with same ip/adress port than the first one but for
>> confidentiality i shouldn't replicate to it. It is expected that the
>> replication stop at this point.
>>
>> This scenario is more obvious if we take the example of someone gong
>> from one stair to the other using the wifi.
>
> IMO, it makes more sense to optimize for the case where people don't
> create two servers with the same name and/or IP address in two different
> networks a single user is likely to connect to, but where the two
> servers have different replication policies that should be handled
> implicitly and SSL/TLS is not used to confirm the correct server is in
> place.
>
> Mysteriously running either two or zero replicas on my laptop for a
> single configured backend would *almost* be excusable with your
> justifications if it didn't fix itself when I restarted CouchDB.
>
> --
> dustin
>
Just ask around you how many people aren't changing the default port
of couchdb and pur their servers in usual ip ranges you expect from a
server. Imo a port change is a significant event.
- benoit
Re: [jira] [Commented] (COUCHDB-1259) Replication ID is not stable if local server has a dynamic port number
Posted by Dustin Sallings <du...@spy.net>.
Benoit Chesneau <bc...@gmail.com>
writes:
> i am with my laptop in an office. Start a replication with a remote node.
>
> my laptop get an ip/port from dhcp, the remote has an ip / address.
>
> I'm moving in another office. connect to the dhcp. there is also a
> remote node with same ip/adress port than the first one but for
> confidentiality i shouldn't replicate to it. It is expected that the
> replication stop at this point.
>
> This scenario is more obvious if we take the example of someone gong
> from one stair to the other using the wifi.
IMO, it makes more sense to optimize for the case where people don't
create two servers with the same name and/or IP address in two different
networks a single user is likely to connect to, but where the two
servers have different replication policies that should be handled
implicitly and SSL/TLS is not used to confirm the correct server is in
place.
Mysteriously running either two or zero replicas on my laptop for a
single configured backend would *almost* be excusable with your
justifications if it didn't fix itself when I restarted CouchDB.
--
dustin
Re: [jira] [Commented] (COUCHDB-1259) Replication ID is not stable if
local server has a dynamic port number
Posted by Benoit Chesneau <bc...@gmail.com>.
On Mon, Nov 5, 2012 at 6:31 AM, Dustin Sallings (JIRA) <ji...@apache.org> wrote:
>
> [ https://issues.apache.org/jira/browse/COUCHDB-1259?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13490465#comment-13490465 ]
>
> Dustin Sallings commented on COUCHDB-1259:
> ------------------------------------------
>
> Note: My local address changes at least twice a day when I go into the office. The other end of my replication doesn't. It's hard to argue that this behavior is desirable.
>
i am with my laptop in an office. Start a replication with a remote node.
my laptop get an ip/port from dhcp, the remote has an ip / address.
I'm moving in another office. connect to the dhcp. there is also a
remote node with same ip/adress port than the first one but for
confidentiality i shouldn't replicate to it. It is expected that the
replication stop at this point.
This scenario is more obvious if we take the example of someone gong
from one stair to the other using the wifi.
- benoit
[jira] [Commented] (COUCHDB-1259) Replication ID is not stable if
local server has a dynamic port number
Posted by "Jens Alfke (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/COUCHDB-1259?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13490352#comment-13490352 ]
Jens Alfke commented on COUCHDB-1259:
-------------------------------------
Benoit: I think you're misunderstanding the issue. This isn't something about P2P. It's just that if the local CouchDB is not *listening* on a fixed port number, then replications made by that server to/from another server aren't handled efficiently ... even though the local server's port number has nothing at all to do with the replication (since it's the one making the connections.)
In a real P2P case, this change makes even more sense, because the addresses of the servers are unimportant -- as you said, it's the databases and their data that are the important thing. A UUID helps identify those.
> Replication ID is not stable if local server has a dynamic port number
> ----------------------------------------------------------------------
>
> Key: COUCHDB-1259
> URL: https://issues.apache.org/jira/browse/COUCHDB-1259
> Project: CouchDB
> Issue Type: Bug
> Components: Replication
> Affects Versions: 1.1
> Reporter: Jens Alfke
> Assignee: Robert Newson
> Priority: Blocker
> Fix For: 1.3
>
> Attachments: couchdb-1259.patch, couchdb-1259.patch
>
>
> I noticed that when Couchbase Mobile running on iOS replicates to/from a remote server (on iriscouch in this case), the replication has to fetch the full _changes feed every time it starts. Filipe helped me track down the problem -- the replication ID is coming out different every time. The reason for this is that the local port number, which is one of the inputs to the hash that generates the replication ID, is randomly assigned by the OS. (I.e. it uses a port number of 0 when opening its listener socket.) This is because there could be multiple apps using Couchbase Mobile running on the same device and we can't have their ports colliding.
> The underlying problem is that CouchDB is attempting to generate a unique ID for a particular pair of {source, destination} databases, but it's basing it on attributes that aren't fundamental to the database and can change, like the hostname or port number.
> One solution, proposed by Filipe and me, is to assign each database (or each server?) a random UUID when it's created, and use that to generate replication IDs.
> Another solution, proposed by Damien, is to have CouchDB let the client work out the replication ID on its own, and set it as a property in the replication document (or the JSON body of a _replicate request.) This is even more flexible and will handle tricky scenarios like full P2P replication where there may be no low-level way to uniquely identify the remote database being synced with.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (COUCHDB-1259) Replication ID is not stable if
local server has a dynamic port number
Posted by "Jason Smith (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/COUCHDB-1259?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13089935#comment-13089935 ]
Jason Smith commented on COUCHDB-1259:
--------------------------------------
Couch already has a unique identifier: its URL. I'm not sure another per-server UUID buys you much. With a second unique identifier, you can determine that (this couch has moved on the Internet || this couch has a configuration error). Maybe the first condition is more likely. Meh.
Couch already has a per-server UUID: _config/couch_httpd_auth/secret. Hashing this value can produce a public unique ID.
Normal users may not read the config, so you have to expose this value to them somehow. Is that a new global handler? Or is it added to the {"couchdb":"Welcome"} response?
For these reasons, I'm not sure the solution is to assign a random UUID to the Couch.
> Replication ID is not stable if local server has a dynamic port number
> ----------------------------------------------------------------------
>
> Key: COUCHDB-1259
> URL: https://issues.apache.org/jira/browse/COUCHDB-1259
> Project: CouchDB
> Issue Type: Bug
> Components: Replication
> Affects Versions: 1.1
> Reporter: Jens Alfke
>
> I noticed that when Couchbase Mobile running on iOS replicates to/from a remote server (on iriscouch in this case), the replication has to fetch the full _changes feed every time it starts. Filipe helped me track down the problem -- the replication ID is coming out different every time. The reason for this is that the local port number, which is one of the inputs to the hash that generates the replication ID, is randomly assigned by the OS. (I.e. it uses a port number of 0 when opening its listener socket.) This is because there could be multiple apps using Couchbase Mobile running on the same device and we can't have their ports colliding.
> The underlying problem is that CouchDB is attempting to generate a unique ID for a particular pair of {source, destination} databases, but it's basing it on attributes that aren't fundamental to the database and can change, like the hostname or port number.
> One solution, proposed by Filipe and me, is to assign each database (or each server?) a random UUID when it's created, and use that to generate replication IDs.
> Another solution, proposed by Damien, is to have CouchDB let the client work out the replication ID on its own, and set it as a property in the replication document (or the JSON body of a _replicate request.) This is even more flexible and will handle tricky scenarios like full P2P replication where there may be no low-level way to uniquely identify the remote database being synced with.
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Resolved] (COUCHDB-1259) Replication ID is not stable if
local server has a dynamic port number
Posted by "Robert Newson (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/COUCHDB-1259?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Robert Newson resolved COUCHDB-1259.
------------------------------------
Resolution: Fixed
The basic version is committed (where we use UUID instead of the local hostname:port).
> Replication ID is not stable if local server has a dynamic port number
> ----------------------------------------------------------------------
>
> Key: COUCHDB-1259
> URL: https://issues.apache.org/jira/browse/COUCHDB-1259
> Project: CouchDB
> Issue Type: Bug
> Components: Replication
> Affects Versions: 1.1
> Reporter: Jens Alfke
> Assignee: Robert Newson
> Priority: Blocker
> Fix For: 1.3
>
> Attachments: couchdb-1259.patch, couchdb-1259.patch
>
>
> I noticed that when Couchbase Mobile running on iOS replicates to/from a remote server (on iriscouch in this case), the replication has to fetch the full _changes feed every time it starts. Filipe helped me track down the problem -- the replication ID is coming out different every time. The reason for this is that the local port number, which is one of the inputs to the hash that generates the replication ID, is randomly assigned by the OS. (I.e. it uses a port number of 0 when opening its listener socket.) This is because there could be multiple apps using Couchbase Mobile running on the same device and we can't have their ports colliding.
> The underlying problem is that CouchDB is attempting to generate a unique ID for a particular pair of {source, destination} databases, but it's basing it on attributes that aren't fundamental to the database and can change, like the hostname or port number.
> One solution, proposed by Filipe and me, is to assign each database (or each server?) a random UUID when it's created, and use that to generate replication IDs.
> Another solution, proposed by Damien, is to have CouchDB let the client work out the replication ID on its own, and set it as a property in the replication document (or the JSON body of a _replicate request.) This is even more flexible and will handle tricky scenarios like full P2P replication where there may be no low-level way to uniquely identify the remote database being synced with.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Updated] (COUCHDB-1259) Replication ID is not stable if
local server has a dynamic port number
Posted by "Jan Lehnardt (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/COUCHDB-1259?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Jan Lehnardt updated COUCHDB-1259:
----------------------------------
Priority: Blocker (was: Major)
Fix Version/s: 1.3
> Replication ID is not stable if local server has a dynamic port number
> ----------------------------------------------------------------------
>
> Key: COUCHDB-1259
> URL: https://issues.apache.org/jira/browse/COUCHDB-1259
> Project: CouchDB
> Issue Type: Bug
> Components: Replication
> Affects Versions: 1.1
> Reporter: Jens Alfke
> Assignee: Filipe Manana
> Priority: Blocker
> Fix For: 1.3
>
> Attachments: couchdb-1259.patch, couchdb-1259.patch
>
>
> I noticed that when Couchbase Mobile running on iOS replicates to/from a remote server (on iriscouch in this case), the replication has to fetch the full _changes feed every time it starts. Filipe helped me track down the problem -- the replication ID is coming out different every time. The reason for this is that the local port number, which is one of the inputs to the hash that generates the replication ID, is randomly assigned by the OS. (I.e. it uses a port number of 0 when opening its listener socket.) This is because there could be multiple apps using Couchbase Mobile running on the same device and we can't have their ports colliding.
> The underlying problem is that CouchDB is attempting to generate a unique ID for a particular pair of {source, destination} databases, but it's basing it on attributes that aren't fundamental to the database and can change, like the hostname or port number.
> One solution, proposed by Filipe and me, is to assign each database (or each server?) a random UUID when it's created, and use that to generate replication IDs.
> Another solution, proposed by Damien, is to have CouchDB let the client work out the replication ID on its own, and set it as a property in the replication document (or the JSON body of a _replicate request.) This is even more flexible and will handle tricky scenarios like full P2P replication where there may be no low-level way to uniquely identify the remote database being synced with.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (COUCHDB-1259) Replication ID is not stable if
local server has a dynamic port number
Posted by "Benoit Chesneau (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/COUCHDB-1259?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13490444#comment-13490444 ]
Benoit Chesneau commented on COUCHDB-1259:
------------------------------------------
Except if you are using either the same port on each devices (which is generally what does an application) or the ephemeral port "0" which is also the same then for reach replication. Also in that case you will also have to handle the full address change and security implications. Relying on a unique ids to continue the replication may be a design flaw or at least a non expected/wanted behaviour. What will prevents an hostile node to connect back to your node with the same id? How do you invalidate it?
I am pretty sure anyway we should let to the application or final user the choice of the routing policy. I will have a patch for that later in the day.
> Replication ID is not stable if local server has a dynamic port number
> ----------------------------------------------------------------------
>
> Key: COUCHDB-1259
> URL: https://issues.apache.org/jira/browse/COUCHDB-1259
> Project: CouchDB
> Issue Type: Bug
> Components: Replication
> Affects Versions: 1.1
> Reporter: Jens Alfke
> Assignee: Robert Newson
> Priority: Blocker
> Fix For: 1.3
>
> Attachments: couchdb-1259.patch, couchdb-1259.patch
>
>
> I noticed that when Couchbase Mobile running on iOS replicates to/from a remote server (on iriscouch in this case), the replication has to fetch the full _changes feed every time it starts. Filipe helped me track down the problem -- the replication ID is coming out different every time. The reason for this is that the local port number, which is one of the inputs to the hash that generates the replication ID, is randomly assigned by the OS. (I.e. it uses a port number of 0 when opening its listener socket.) This is because there could be multiple apps using Couchbase Mobile running on the same device and we can't have their ports colliding.
> The underlying problem is that CouchDB is attempting to generate a unique ID for a particular pair of {source, destination} databases, but it's basing it on attributes that aren't fundamental to the database and can change, like the hostname or port number.
> One solution, proposed by Filipe and me, is to assign each database (or each server?) a random UUID when it's created, and use that to generate replication IDs.
> Another solution, proposed by Damien, is to have CouchDB let the client work out the replication ID on its own, and set it as a property in the replication document (or the JSON body of a _replicate request.) This is even more flexible and will handle tricky scenarios like full P2P replication where there may be no low-level way to uniquely identify the remote database being synced with.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (COUCHDB-1259) Replication ID is not stable if
local server has a dynamic port number
Posted by "Paul Joseph Davis (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/COUCHDB-1259?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13089973#comment-13089973 ]
Paul Joseph Davis commented on COUCHDB-1259:
--------------------------------------------
@Jason
URL's are nice and all, but they're fairly unstable. What's the URL for a couch on a phone? Or after it changes networks? Or if its behind a proxy? And how would that couch figure out what's URL is?
Randall's comment about copying files is why its not viable to just generate a UUID for each database. Because its quite likely that a sysadmin would copy that file which would result in to db's having the same UUID making the UUID not so UI.
> Replication ID is not stable if local server has a dynamic port number
> ----------------------------------------------------------------------
>
> Key: COUCHDB-1259
> URL: https://issues.apache.org/jira/browse/COUCHDB-1259
> Project: CouchDB
> Issue Type: Bug
> Components: Replication
> Affects Versions: 1.1
> Reporter: Jens Alfke
>
> I noticed that when Couchbase Mobile running on iOS replicates to/from a remote server (on iriscouch in this case), the replication has to fetch the full _changes feed every time it starts. Filipe helped me track down the problem -- the replication ID is coming out different every time. The reason for this is that the local port number, which is one of the inputs to the hash that generates the replication ID, is randomly assigned by the OS. (I.e. it uses a port number of 0 when opening its listener socket.) This is because there could be multiple apps using Couchbase Mobile running on the same device and we can't have their ports colliding.
> The underlying problem is that CouchDB is attempting to generate a unique ID for a particular pair of {source, destination} databases, but it's basing it on attributes that aren't fundamental to the database and can change, like the hostname or port number.
> One solution, proposed by Filipe and me, is to assign each database (or each server?) a random UUID when it's created, and use that to generate replication IDs.
> Another solution, proposed by Damien, is to have CouchDB let the client work out the replication ID on its own, and set it as a property in the replication document (or the JSON body of a _replicate request.) This is even more flexible and will handle tricky scenarios like full P2P replication where there may be no low-level way to uniquely identify the remote database being synced with.
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (COUCHDB-1259) Replication ID is not stable if
local server has a dynamic port number
Posted by "Robert Newson (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/COUCHDB-1259?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13490895#comment-13490895 ]
Robert Newson commented on COUCHDB-1259:
----------------------------------------
Jens, Yes, the patch goes further than the ticket, I said as much in my first comment when I took the ticket. As you note, it has no security implications.
There are three host:port values in play for any one replication task, it seems only a partial solution to fix the stability issue for one of them (though, I agree, that if we only fixed one, it would be the co-ordinating node).
It is true that the host:port of the co-ordinating node does not affect the replication per se, as long as you ignore what would go wrong if two processes were doing the same replication. This is also true of the host:port of the "source" and "target" servers too.
I am happy to solve just the initial problem identified in the ticket if that will allow Benoit to retract his veto, however I felt it important that we were all clear about the security implications here (namely, that there are none) before proceeding. If, as seems the case now, we all agree on the security aspect, I don't see the harm in all 3 participants having a stable identifier allowing replication checkpoints to be used if a machine changes name or port.
> Replication ID is not stable if local server has a dynamic port number
> ----------------------------------------------------------------------
>
> Key: COUCHDB-1259
> URL: https://issues.apache.org/jira/browse/COUCHDB-1259
> Project: CouchDB
> Issue Type: Bug
> Components: Replication
> Affects Versions: 1.1
> Reporter: Jens Alfke
> Assignee: Robert Newson
> Priority: Blocker
> Fix For: 1.3
>
> Attachments: couchdb-1259.patch, couchdb-1259.patch
>
>
> I noticed that when Couchbase Mobile running on iOS replicates to/from a remote server (on iriscouch in this case), the replication has to fetch the full _changes feed every time it starts. Filipe helped me track down the problem -- the replication ID is coming out different every time. The reason for this is that the local port number, which is one of the inputs to the hash that generates the replication ID, is randomly assigned by the OS. (I.e. it uses a port number of 0 when opening its listener socket.) This is because there could be multiple apps using Couchbase Mobile running on the same device and we can't have their ports colliding.
> The underlying problem is that CouchDB is attempting to generate a unique ID for a particular pair of {source, destination} databases, but it's basing it on attributes that aren't fundamental to the database and can change, like the hostname or port number.
> One solution, proposed by Filipe and me, is to assign each database (or each server?) a random UUID when it's created, and use that to generate replication IDs.
> Another solution, proposed by Damien, is to have CouchDB let the client work out the replication ID on its own, and set it as a property in the replication document (or the JSON body of a _replicate request.) This is even more flexible and will handle tricky scenarios like full P2P replication where there may be no low-level way to uniquely identify the remote database being synced with.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (COUCHDB-1259) Replication ID is not stable if
local server has a dynamic port number
Posted by "Filipe Manana (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/COUCHDB-1259?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13089836#comment-13089836 ]
Filipe Manana commented on COUCHDB-1259:
----------------------------------------
Thanks Jens for filing this and the detailed description.
To be more clear, the idea would be to add a UUID to each server and use it as input to the replication id generation instead of the local port number. It would be something similar to what is done for the cookie authentication handler:
https://github.com/apache/couchdb/blob/trunk/src/couchdb/couch_httpd_auth.erl#L240
If such uuid doesn't exist in the .ini (replicator section), we generate a new uuid and save it.
Damien's thought about allowing the client to name them, sounds also very simple - perhaps using the "_replication_id" field in replication documents (which already exists and is currently automatically set by the replication manager).
> Replication ID is not stable if local server has a dynamic port number
> ----------------------------------------------------------------------
>
> Key: COUCHDB-1259
> URL: https://issues.apache.org/jira/browse/COUCHDB-1259
> Project: CouchDB
> Issue Type: Bug
> Components: Replication
> Affects Versions: 1.1
> Reporter: Jens Alfke
>
> I noticed that when Couchbase Mobile running on iOS replicates to/from a remote server (on iriscouch in this case), the replication has to fetch the full _changes feed every time it starts. Filipe helped me track down the problem -- the replication ID is coming out different every time. The reason for this is that the local port number, which is one of the inputs to the hash that generates the replication ID, is randomly assigned by the OS. (I.e. it uses a port number of 0 when opening its listener socket.) This is because there could be multiple apps using Couchbase Mobile running on the same device and we can't have their ports colliding.
> The underlying problem is that CouchDB is attempting to generate a unique ID for a particular pair of {source, destination} databases, but it's basing it on attributes that aren't fundamental to the database and can change, like the hostname or port number.
> One solution, proposed by Filipe and me, is to assign each database (or each server?) a random UUID when it's created, and use that to generate replication IDs.
> Another solution, proposed by Damien, is to have CouchDB let the client work out the replication ID on its own, and set it as a property in the replication document (or the JSON body of a _replicate request.) This is even more flexible and will handle tricky scenarios like full P2P replication where there may be no low-level way to uniquely identify the remote database being synced with.
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (COUCHDB-1259) Replication ID is not stable if
local server has a dynamic port number
Posted by "Robert Newson (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/COUCHDB-1259?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13483382#comment-13483382 ]
Robert Newson commented on COUCHDB-1259:
----------------------------------------
I've picked up this task and prepared a branch with my work (1259-stable_replication_ids). This patch goes beyond filipe's original and applies to the source and target as well. If couchdb believes either is using a dynamic port (it's configurable, but defaults to any port in the 14192-65535 range), it will ask the server for its uuid (emitted in the / welcome message). If it has one, it uses that instead of the port (specifically it uses {Scheme, UserInfo, UUID, Path} instead of the full url).
> Replication ID is not stable if local server has a dynamic port number
> ----------------------------------------------------------------------
>
> Key: COUCHDB-1259
> URL: https://issues.apache.org/jira/browse/COUCHDB-1259
> Project: CouchDB
> Issue Type: Bug
> Components: Replication
> Affects Versions: 1.1
> Reporter: Jens Alfke
> Assignee: Robert Newson
> Priority: Blocker
> Fix For: 1.3
>
> Attachments: couchdb-1259.patch, couchdb-1259.patch
>
>
> I noticed that when Couchbase Mobile running on iOS replicates to/from a remote server (on iriscouch in this case), the replication has to fetch the full _changes feed every time it starts. Filipe helped me track down the problem -- the replication ID is coming out different every time. The reason for this is that the local port number, which is one of the inputs to the hash that generates the replication ID, is randomly assigned by the OS. (I.e. it uses a port number of 0 when opening its listener socket.) This is because there could be multiple apps using Couchbase Mobile running on the same device and we can't have their ports colliding.
> The underlying problem is that CouchDB is attempting to generate a unique ID for a particular pair of {source, destination} databases, but it's basing it on attributes that aren't fundamental to the database and can change, like the hostname or port number.
> One solution, proposed by Filipe and me, is to assign each database (or each server?) a random UUID when it's created, and use that to generate replication IDs.
> Another solution, proposed by Damien, is to have CouchDB let the client work out the replication ID on its own, and set it as a property in the replication document (or the JSON body of a _replicate request.) This is even more flexible and will handle tricky scenarios like full P2P replication where there may be no low-level way to uniquely identify the remote database being synced with.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (COUCHDB-1259) Replication ID is not stable if
local server has a dynamic port number
Posted by "Robert Newson (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/COUCHDB-1259?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13490609#comment-13490609 ]
Robert Newson commented on COUCHDB-1259:
----------------------------------------
I'll summarize my reasons for not finding a technical justification in your veto as follows: "We do not trust the host:port pair today, we will not trust the uuid substitute with this patch, no security aspect has changed". Your argument implies that seeing foo:5984 now, and seeing foo:5984 five minutes from now means that you are talking to the same machine. This is obviously false. if we are talking to https://foo:5984, and we trust the certificate now, and five minutes from now, then we are sure we are talking to the same machine.
All this patch does is give a stable identifier to a couchdb server. To date, we have assumed that full-qualified hostname and port number is a stable identifier. It is, up to a point.
So, I would like comments on whether the patch does what it claims, and on the separate point about clarifying the meaning of the patch by using UUID in place of Host and Port in the replication_id calculations.
I will also note that, at your step 3, replication could not resume, since the node could not be contacted on the old port. A new replication, with the new port, would start up, and I see no reason why it should redo from start.
All this said, I think we need other voices on this ticket now.
> Replication ID is not stable if local server has a dynamic port number
> ----------------------------------------------------------------------
>
> Key: COUCHDB-1259
> URL: https://issues.apache.org/jira/browse/COUCHDB-1259
> Project: CouchDB
> Issue Type: Bug
> Components: Replication
> Affects Versions: 1.1
> Reporter: Jens Alfke
> Assignee: Robert Newson
> Priority: Blocker
> Fix For: 1.3
>
> Attachments: couchdb-1259.patch, couchdb-1259.patch
>
>
> I noticed that when Couchbase Mobile running on iOS replicates to/from a remote server (on iriscouch in this case), the replication has to fetch the full _changes feed every time it starts. Filipe helped me track down the problem -- the replication ID is coming out different every time. The reason for this is that the local port number, which is one of the inputs to the hash that generates the replication ID, is randomly assigned by the OS. (I.e. it uses a port number of 0 when opening its listener socket.) This is because there could be multiple apps using Couchbase Mobile running on the same device and we can't have their ports colliding.
> The underlying problem is that CouchDB is attempting to generate a unique ID for a particular pair of {source, destination} databases, but it's basing it on attributes that aren't fundamental to the database and can change, like the hostname or port number.
> One solution, proposed by Filipe and me, is to assign each database (or each server?) a random UUID when it's created, and use that to generate replication IDs.
> Another solution, proposed by Damien, is to have CouchDB let the client work out the replication ID on its own, and set it as a property in the replication document (or the JSON body of a _replicate request.) This is even more flexible and will handle tricky scenarios like full P2P replication where there may be no low-level way to uniquely identify the remote database being synced with.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (COUCHDB-1259) Replication ID is not stable if
local server has a dynamic port number
Posted by "Robert Newson (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/COUCHDB-1259?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13490527#comment-13490527 ]
Robert Newson commented on COUCHDB-1259:
----------------------------------------
Benoit, are you vetoing this change? If so, please include a reason why improving the hit rate for replication checkpoints should not be included in our next release.
Everyone else, please comment on the patch itself, I want feedback on 1) the quality and correctness of the patch and 2) whether, when using UUID, whether it is correct to use UUID instead of the {Scheme, UserInfo, UUID, Path} tuple that I've chosen as I would prefer to simply use the UUID if it's correct to do so for clarity.
https://github.com/apache/couchdb/pull/35
> Replication ID is not stable if local server has a dynamic port number
> ----------------------------------------------------------------------
>
> Key: COUCHDB-1259
> URL: https://issues.apache.org/jira/browse/COUCHDB-1259
> Project: CouchDB
> Issue Type: Bug
> Components: Replication
> Affects Versions: 1.1
> Reporter: Jens Alfke
> Assignee: Robert Newson
> Priority: Blocker
> Fix For: 1.3
>
> Attachments: couchdb-1259.patch, couchdb-1259.patch
>
>
> I noticed that when Couchbase Mobile running on iOS replicates to/from a remote server (on iriscouch in this case), the replication has to fetch the full _changes feed every time it starts. Filipe helped me track down the problem -- the replication ID is coming out different every time. The reason for this is that the local port number, which is one of the inputs to the hash that generates the replication ID, is randomly assigned by the OS. (I.e. it uses a port number of 0 when opening its listener socket.) This is because there could be multiple apps using Couchbase Mobile running on the same device and we can't have their ports colliding.
> The underlying problem is that CouchDB is attempting to generate a unique ID for a particular pair of {source, destination} databases, but it's basing it on attributes that aren't fundamental to the database and can change, like the hostname or port number.
> One solution, proposed by Filipe and me, is to assign each database (or each server?) a random UUID when it's created, and use that to generate replication IDs.
> Another solution, proposed by Damien, is to have CouchDB let the client work out the replication ID on its own, and set it as a property in the replication document (or the JSON body of a _replicate request.) This is even more flexible and will handle tricky scenarios like full P2P replication where there may be no low-level way to uniquely identify the remote database being synced with.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Updated] (COUCHDB-1259) Replication ID is not stable if
local server has a dynamic port number
Posted by "Filipe Manana (Updated) (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/COUCHDB-1259?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Filipe Manana updated COUCHDB-1259:
-----------------------------------
Attachment: couchdb-1259.patch
couchdb-1259.patch
The following patch solves the issue by using the same approach as the auth cookie handler - using a node uuid which is stored in .ini config.
The new replication ID generation no longer uses the hostname and port pair, but instead this uuid. It fallbacks to the current method when searching for existing checkpoints however (thanks to Randall's replication ID upgrade scheme).
Besides mobile, desktop couch (Ubuntu One) is another example where the port is dynamic. I've also seen a desktop running normal CouchDB where the ID for a replication was different the first time it was generated from subsequent times - I suspect it was an issue with inet:gethostname/0 but unable to prove it.
Personally I don't think using the .ini for a single parameter is that bad (unlike things like OAuth tokens for e.g.) like others commented here before - an alternative would be to store it in a local document of the replicator database for e.g.
I would very much like to see this issue fixed in 1.2.0.
> Replication ID is not stable if local server has a dynamic port number
> ----------------------------------------------------------------------
>
> Key: COUCHDB-1259
> URL: https://issues.apache.org/jira/browse/COUCHDB-1259
> Project: CouchDB
> Issue Type: Bug
> Components: Replication
> Affects Versions: 1.1
> Reporter: Jens Alfke
> Attachments: couchdb-1259.patch, couchdb-1259.patch
>
>
> I noticed that when Couchbase Mobile running on iOS replicates to/from a remote server (on iriscouch in this case), the replication has to fetch the full _changes feed every time it starts. Filipe helped me track down the problem -- the replication ID is coming out different every time. The reason for this is that the local port number, which is one of the inputs to the hash that generates the replication ID, is randomly assigned by the OS. (I.e. it uses a port number of 0 when opening its listener socket.) This is because there could be multiple apps using Couchbase Mobile running on the same device and we can't have their ports colliding.
> The underlying problem is that CouchDB is attempting to generate a unique ID for a particular pair of {source, destination} databases, but it's basing it on attributes that aren't fundamental to the database and can change, like the hostname or port number.
> One solution, proposed by Filipe and me, is to assign each database (or each server?) a random UUID when it's created, and use that to generate replication IDs.
> Another solution, proposed by Damien, is to have CouchDB let the client work out the replication ID on its own, and set it as a property in the replication document (or the JSON body of a _replicate request.) This is even more flexible and will handle tricky scenarios like full P2P replication where there may be no low-level way to uniquely identify the remote database being synced with.
--
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
[jira] [Commented] (COUCHDB-1259) Replication ID is not stable if
local server has a dynamic port number
Posted by "Randall Leeds (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/COUCHDB-1259?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13089841#comment-13089841 ]
Randall Leeds commented on COUCHDB-1259:
----------------------------------------
I'd rather see the replicator respect a naming field. CouchDB core places no specific significance on the replication documents, treating them as any other document in the _local/ namespace. And we've heard a number of times, especially in the last few weeks, about how config files (and specifically ones that change) are ugly.
I proposed UUIDs at the DB level a long time ago for this reason, and relatedly so that you could trigger push/pull without using HTTP at both sides and have it be the same replication (discover that you are a host via UUID). Configuration files would work to make it server level, but it's hacky. DB-level is a bad idea because sysadmins might copy couch files. Ultimately, the client should identify the replication if it can. I think that's the best solution.
> Replication ID is not stable if local server has a dynamic port number
> ----------------------------------------------------------------------
>
> Key: COUCHDB-1259
> URL: https://issues.apache.org/jira/browse/COUCHDB-1259
> Project: CouchDB
> Issue Type: Bug
> Components: Replication
> Affects Versions: 1.1
> Reporter: Jens Alfke
>
> I noticed that when Couchbase Mobile running on iOS replicates to/from a remote server (on iriscouch in this case), the replication has to fetch the full _changes feed every time it starts. Filipe helped me track down the problem -- the replication ID is coming out different every time. The reason for this is that the local port number, which is one of the inputs to the hash that generates the replication ID, is randomly assigned by the OS. (I.e. it uses a port number of 0 when opening its listener socket.) This is because there could be multiple apps using Couchbase Mobile running on the same device and we can't have their ports colliding.
> The underlying problem is that CouchDB is attempting to generate a unique ID for a particular pair of {source, destination} databases, but it's basing it on attributes that aren't fundamental to the database and can change, like the hostname or port number.
> One solution, proposed by Filipe and me, is to assign each database (or each server?) a random UUID when it's created, and use that to generate replication IDs.
> Another solution, proposed by Damien, is to have CouchDB let the client work out the replication ID on its own, and set it as a property in the replication document (or the JSON body of a _replicate request.) This is even more flexible and will handle tricky scenarios like full P2P replication where there may be no low-level way to uniquely identify the remote database being synced with.
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Assigned] (COUCHDB-1259) Replication ID is not stable if
local server has a dynamic port number
Posted by "Robert Newson (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/COUCHDB-1259?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Robert Newson reassigned COUCHDB-1259:
--------------------------------------
Assignee: Robert Newson (was: Filipe Manana)
> Replication ID is not stable if local server has a dynamic port number
> ----------------------------------------------------------------------
>
> Key: COUCHDB-1259
> URL: https://issues.apache.org/jira/browse/COUCHDB-1259
> Project: CouchDB
> Issue Type: Bug
> Components: Replication
> Affects Versions: 1.1
> Reporter: Jens Alfke
> Assignee: Robert Newson
> Priority: Blocker
> Fix For: 1.3
>
> Attachments: couchdb-1259.patch, couchdb-1259.patch
>
>
> I noticed that when Couchbase Mobile running on iOS replicates to/from a remote server (on iriscouch in this case), the replication has to fetch the full _changes feed every time it starts. Filipe helped me track down the problem -- the replication ID is coming out different every time. The reason for this is that the local port number, which is one of the inputs to the hash that generates the replication ID, is randomly assigned by the OS. (I.e. it uses a port number of 0 when opening its listener socket.) This is because there could be multiple apps using Couchbase Mobile running on the same device and we can't have their ports colliding.
> The underlying problem is that CouchDB is attempting to generate a unique ID for a particular pair of {source, destination} databases, but it's basing it on attributes that aren't fundamental to the database and can change, like the hostname or port number.
> One solution, proposed by Filipe and me, is to assign each database (or each server?) a random UUID when it's created, and use that to generate replication IDs.
> Another solution, proposed by Damien, is to have CouchDB let the client work out the replication ID on its own, and set it as a property in the replication document (or the JSON body of a _replicate request.) This is even more flexible and will handle tricky scenarios like full P2P replication where there may be no low-level way to uniquely identify the remote database being synced with.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Assigned] (COUCHDB-1259) Replication ID is not stable if
local server has a dynamic port number
Posted by "Filipe Manana (Assigned) (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/COUCHDB-1259?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Filipe Manana reassigned COUCHDB-1259:
--------------------------------------
Assignee: Filipe Manana
> Replication ID is not stable if local server has a dynamic port number
> ----------------------------------------------------------------------
>
> Key: COUCHDB-1259
> URL: https://issues.apache.org/jira/browse/COUCHDB-1259
> Project: CouchDB
> Issue Type: Bug
> Components: Replication
> Affects Versions: 1.1
> Reporter: Jens Alfke
> Assignee: Filipe Manana
> Attachments: couchdb-1259.patch, couchdb-1259.patch
>
>
> I noticed that when Couchbase Mobile running on iOS replicates to/from a remote server (on iriscouch in this case), the replication has to fetch the full _changes feed every time it starts. Filipe helped me track down the problem -- the replication ID is coming out different every time. The reason for this is that the local port number, which is one of the inputs to the hash that generates the replication ID, is randomly assigned by the OS. (I.e. it uses a port number of 0 when opening its listener socket.) This is because there could be multiple apps using Couchbase Mobile running on the same device and we can't have their ports colliding.
> The underlying problem is that CouchDB is attempting to generate a unique ID for a particular pair of {source, destination} databases, but it's basing it on attributes that aren't fundamental to the database and can change, like the hostname or port number.
> One solution, proposed by Filipe and me, is to assign each database (or each server?) a random UUID when it's created, and use that to generate replication IDs.
> Another solution, proposed by Damien, is to have CouchDB let the client work out the replication ID on its own, and set it as a property in the replication document (or the JSON body of a _replicate request.) This is even more flexible and will handle tricky scenarios like full P2P replication where there may be no low-level way to uniquely identify the remote database being synced with.
--
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
[jira] [Commented] (COUCHDB-1259) Replication ID is not stable if
local server has a dynamic port number
Posted by "Dustin Sallings (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/COUCHDB-1259?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13490465#comment-13490465 ]
Dustin Sallings commented on COUCHDB-1259:
------------------------------------------
If this is true, it explains why someone pointed me to this bug for the two issues I've been experiencing with replication:
1. My permanent replication sessions die almost every single day and come back after I restart CouchDB.
2. Sometimes I end up with more than one replication running for the same configured replica.
Note: My local address changes at least twice a day when I go into the office. The other end of my replication doesn't. It's hard to argue that this behavior is desirable.
> Replication ID is not stable if local server has a dynamic port number
> ----------------------------------------------------------------------
>
> Key: COUCHDB-1259
> URL: https://issues.apache.org/jira/browse/COUCHDB-1259
> Project: CouchDB
> Issue Type: Bug
> Components: Replication
> Affects Versions: 1.1
> Reporter: Jens Alfke
> Assignee: Robert Newson
> Priority: Blocker
> Fix For: 1.3
>
> Attachments: couchdb-1259.patch, couchdb-1259.patch
>
>
> I noticed that when Couchbase Mobile running on iOS replicates to/from a remote server (on iriscouch in this case), the replication has to fetch the full _changes feed every time it starts. Filipe helped me track down the problem -- the replication ID is coming out different every time. The reason for this is that the local port number, which is one of the inputs to the hash that generates the replication ID, is randomly assigned by the OS. (I.e. it uses a port number of 0 when opening its listener socket.) This is because there could be multiple apps using Couchbase Mobile running on the same device and we can't have their ports colliding.
> The underlying problem is that CouchDB is attempting to generate a unique ID for a particular pair of {source, destination} databases, but it's basing it on attributes that aren't fundamental to the database and can change, like the hostname or port number.
> One solution, proposed by Filipe and me, is to assign each database (or each server?) a random UUID when it's created, and use that to generate replication IDs.
> Another solution, proposed by Damien, is to have CouchDB let the client work out the replication ID on its own, and set it as a property in the replication document (or the JSON body of a _replicate request.) This is even more flexible and will handle tricky scenarios like full P2P replication where there may be no low-level way to uniquely identify the remote database being synced with.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (COUCHDB-1259) Replication ID is not stable if
local server has a dynamic port number
Posted by "Benoit Chesneau (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/COUCHDB-1259?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13491019#comment-13491019 ]
Benoit Chesneau commented on COUCHDB-1259:
------------------------------------------
There is a potential security issue using a remote node id like in the second part of the patch. Local to local there is none.
I am + 1 for fixing the issue related to the coodinated node.
> Replication ID is not stable if local server has a dynamic port number
> ----------------------------------------------------------------------
>
> Key: COUCHDB-1259
> URL: https://issues.apache.org/jira/browse/COUCHDB-1259
> Project: CouchDB
> Issue Type: Bug
> Components: Replication
> Affects Versions: 1.1
> Reporter: Jens Alfke
> Assignee: Robert Newson
> Priority: Blocker
> Fix For: 1.3
>
> Attachments: couchdb-1259.patch, couchdb-1259.patch
>
>
> I noticed that when Couchbase Mobile running on iOS replicates to/from a remote server (on iriscouch in this case), the replication has to fetch the full _changes feed every time it starts. Filipe helped me track down the problem -- the replication ID is coming out different every time. The reason for this is that the local port number, which is one of the inputs to the hash that generates the replication ID, is randomly assigned by the OS. (I.e. it uses a port number of 0 when opening its listener socket.) This is because there could be multiple apps using Couchbase Mobile running on the same device and we can't have their ports colliding.
> The underlying problem is that CouchDB is attempting to generate a unique ID for a particular pair of {source, destination} databases, but it's basing it on attributes that aren't fundamental to the database and can change, like the hostname or port number.
> One solution, proposed by Filipe and me, is to assign each database (or each server?) a random UUID when it's created, and use that to generate replication IDs.
> Another solution, proposed by Damien, is to have CouchDB let the client work out the replication ID on its own, and set it as a property in the replication document (or the JSON body of a _replicate request.) This is even more flexible and will handle tricky scenarios like full P2P replication where there may be no low-level way to uniquely identify the remote database being synced with.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (COUCHDB-1259) Replication ID is not stable if
local server has a dynamic port number
Posted by "Jason Smith (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/COUCHDB-1259?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13090680#comment-13090680 ]
Jason Smith commented on COUCHDB-1259:
--------------------------------------
Hi, Jens. Yes, I take your point to stick to the specific topic. Thanks.
To summarize my long rants: A Couch UUID already exists. A database UUID won't work. Allowing the client to provide the replication ID would be great!
> Replication ID is not stable if local server has a dynamic port number
> ----------------------------------------------------------------------
>
> Key: COUCHDB-1259
> URL: https://issues.apache.org/jira/browse/COUCHDB-1259
> Project: CouchDB
> Issue Type: Bug
> Components: Replication
> Affects Versions: 1.1
> Reporter: Jens Alfke
>
> I noticed that when Couchbase Mobile running on iOS replicates to/from a remote server (on iriscouch in this case), the replication has to fetch the full _changes feed every time it starts. Filipe helped me track down the problem -- the replication ID is coming out different every time. The reason for this is that the local port number, which is one of the inputs to the hash that generates the replication ID, is randomly assigned by the OS. (I.e. it uses a port number of 0 when opening its listener socket.) This is because there could be multiple apps using Couchbase Mobile running on the same device and we can't have their ports colliding.
> The underlying problem is that CouchDB is attempting to generate a unique ID for a particular pair of {source, destination} databases, but it's basing it on attributes that aren't fundamental to the database and can change, like the hostname or port number.
> One solution, proposed by Filipe and me, is to assign each database (or each server?) a random UUID when it's created, and use that to generate replication IDs.
> Another solution, proposed by Damien, is to have CouchDB let the client work out the replication ID on its own, and set it as a property in the replication document (or the JSON body of a _replicate request.) This is even more flexible and will handle tricky scenarios like full P2P replication where there may be no low-level way to uniquely identify the remote database being synced with.
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (COUCHDB-1259) Replication ID is not stable if
local server has a dynamic port number
Posted by "Benoit Chesneau (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/COUCHDB-1259?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13490596#comment-13490596 ]
Benoit Chesneau commented on COUCHDB-1259:
------------------------------------------
@rnewson part of the patch that make the checkpoint locally constant is fine for me (but not relying on a remote uuid) though i don't think we need a server id for that but that can probably be changed later.
Anyway following the discussion (and that will be post 1.3) I think that what we should really do here is handling the following scenario:
1. port, ip changed, port crashed, restared -> a checkpooint is orphelin
2. node come back
3. Instead of restarting the replication , ask what to do and mark the replication task as paused
By "ask" I mean having a switchable middle ware that could handle the scenario or just let the application do what it want. Since that is a braking change I guess it could only happen on 2.0 if some want.
> Replication ID is not stable if local server has a dynamic port number
> ----------------------------------------------------------------------
>
> Key: COUCHDB-1259
> URL: https://issues.apache.org/jira/browse/COUCHDB-1259
> Project: CouchDB
> Issue Type: Bug
> Components: Replication
> Affects Versions: 1.1
> Reporter: Jens Alfke
> Assignee: Robert Newson
> Priority: Blocker
> Fix For: 1.3
>
> Attachments: couchdb-1259.patch, couchdb-1259.patch
>
>
> I noticed that when Couchbase Mobile running on iOS replicates to/from a remote server (on iriscouch in this case), the replication has to fetch the full _changes feed every time it starts. Filipe helped me track down the problem -- the replication ID is coming out different every time. The reason for this is that the local port number, which is one of the inputs to the hash that generates the replication ID, is randomly assigned by the OS. (I.e. it uses a port number of 0 when opening its listener socket.) This is because there could be multiple apps using Couchbase Mobile running on the same device and we can't have their ports colliding.
> The underlying problem is that CouchDB is attempting to generate a unique ID for a particular pair of {source, destination} databases, but it's basing it on attributes that aren't fundamental to the database and can change, like the hostname or port number.
> One solution, proposed by Filipe and me, is to assign each database (or each server?) a random UUID when it's created, and use that to generate replication IDs.
> Another solution, proposed by Damien, is to have CouchDB let the client work out the replication ID on its own, and set it as a property in the replication document (or the JSON body of a _replicate request.) This is even more flexible and will handle tricky scenarios like full P2P replication where there may be no low-level way to uniquely identify the remote database being synced with.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (COUCHDB-1259) Replication ID is not stable if
local server has a dynamic port number
Posted by "Benoit Chesneau (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/COUCHDB-1259?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13490424#comment-13490424 ]
Benoit Chesneau commented on COUCHDB-1259:
------------------------------------------
I don't. The replication is fundamentally a peer to peer protocol. or master to master. whatever.
It is and should be expected that a node can disappear for many reasons. Relying on a server id is one of the possibilities to restart automatically a replication, other would use other parameters based on the ip and the location, etc... It is the responsibility of the application to know that. As a protocol the replication shouldn't force this way imo. As a client the replicator shouldn't too. It is already doing the best effort imo: ie restarting for the same ip, port and properties of the replication.
As a side note, this is one of the reason the 0 port could be used here instead of letting your *application* fix a port. 0 won't change. And you could rely with the *application* on a unique property in the replication properties.
> Replication ID is not stable if local server has a dynamic port number
> ----------------------------------------------------------------------
>
> Key: COUCHDB-1259
> URL: https://issues.apache.org/jira/browse/COUCHDB-1259
> Project: CouchDB
> Issue Type: Bug
> Components: Replication
> Affects Versions: 1.1
> Reporter: Jens Alfke
> Assignee: Robert Newson
> Priority: Blocker
> Fix For: 1.3
>
> Attachments: couchdb-1259.patch, couchdb-1259.patch
>
>
> I noticed that when Couchbase Mobile running on iOS replicates to/from a remote server (on iriscouch in this case), the replication has to fetch the full _changes feed every time it starts. Filipe helped me track down the problem -- the replication ID is coming out different every time. The reason for this is that the local port number, which is one of the inputs to the hash that generates the replication ID, is randomly assigned by the OS. (I.e. it uses a port number of 0 when opening its listener socket.) This is because there could be multiple apps using Couchbase Mobile running on the same device and we can't have their ports colliding.
> The underlying problem is that CouchDB is attempting to generate a unique ID for a particular pair of {source, destination} databases, but it's basing it on attributes that aren't fundamental to the database and can change, like the hostname or port number.
> One solution, proposed by Filipe and me, is to assign each database (or each server?) a random UUID when it's created, and use that to generate replication IDs.
> Another solution, proposed by Damien, is to have CouchDB let the client work out the replication ID on its own, and set it as a property in the replication document (or the JSON body of a _replicate request.) This is even more flexible and will handle tricky scenarios like full P2P replication where there may be no low-level way to uniquely identify the remote database being synced with.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (COUCHDB-1259) Replication ID is not stable if
local server has a dynamic port number
Posted by "Robert Newson (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/COUCHDB-1259?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13490611#comment-13490611 ]
Robert Newson commented on COUCHDB-1259:
----------------------------------------
I think {Scheme, UserInfo, UUID, Path} is necessary, actually, so ignore my second question. Scheme is justified as we should allow a http and https replication that is otherwise identical to run concurrently (though it's a bit silly). UserInfo is mixed in because different users might be able to write only subsets of the data, and Path ensures that checkpoints vary by database name, in the case that multiple sources replicate into the same target (confusing their checkpoints would be very wrong).
> Replication ID is not stable if local server has a dynamic port number
> ----------------------------------------------------------------------
>
> Key: COUCHDB-1259
> URL: https://issues.apache.org/jira/browse/COUCHDB-1259
> Project: CouchDB
> Issue Type: Bug
> Components: Replication
> Affects Versions: 1.1
> Reporter: Jens Alfke
> Assignee: Robert Newson
> Priority: Blocker
> Fix For: 1.3
>
> Attachments: couchdb-1259.patch, couchdb-1259.patch
>
>
> I noticed that when Couchbase Mobile running on iOS replicates to/from a remote server (on iriscouch in this case), the replication has to fetch the full _changes feed every time it starts. Filipe helped me track down the problem -- the replication ID is coming out different every time. The reason for this is that the local port number, which is one of the inputs to the hash that generates the replication ID, is randomly assigned by the OS. (I.e. it uses a port number of 0 when opening its listener socket.) This is because there could be multiple apps using Couchbase Mobile running on the same device and we can't have their ports colliding.
> The underlying problem is that CouchDB is attempting to generate a unique ID for a particular pair of {source, destination} databases, but it's basing it on attributes that aren't fundamental to the database and can change, like the hostname or port number.
> One solution, proposed by Filipe and me, is to assign each database (or each server?) a random UUID when it's created, and use that to generate replication IDs.
> Another solution, proposed by Damien, is to have CouchDB let the client work out the replication ID on its own, and set it as a property in the replication document (or the JSON body of a _replicate request.) This is even more flexible and will handle tricky scenarios like full P2P replication where there may be no low-level way to uniquely identify the remote database being synced with.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (COUCHDB-1259) Replication ID is not stable if
local server has a dynamic port number
Posted by "Jason Smith (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/COUCHDB-1259?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13089939#comment-13089939 ]
Jason Smith commented on COUCHDB-1259:
--------------------------------------
The small problem with Damien's suggestion is that, presently, the client (and the replicator) hasn't enough information to produce a good replication ID.
Randall, I'm not sure I understand what is bad about sysadmins copying files. Shouldn't that be *exactly* the situation where the replicator notices that it can skip some changes?
If a sysadmin runs (and then restarts couch!)
mv old.couch new.couch
or perhaps
rsync user@somewhere:/path/to/remote.couch ./new.couch
and runs a replication, it would be nice for it to continue where it left off. Does that already happen? I think the answer is no: the replication ID depends on the database name. A server ID doesn't help to detect database renames. A DB rename is a URL "rename," no different from changing the port.
Is it possible to address both bugs at the same time? Can the client (replicator) compute a stable replication ID, without any help from core CouchDB?
In other discussions, Adam mentioned possibly demoting _security to be merely a cache of a _local/security doc (and promoting _local docs to have revision trees).
Could the client (replicator) or perhaps Couch create e.g. _local/metadata with a UUID? To calculate the replication ID, check for _local/metadata, and if not available then fall back to the URL, database name, etc. I think that would require no changes to core CouchDB, just the replicator application. And clients (the one creating /_replicator docs) needn't change.
> Replication ID is not stable if local server has a dynamic port number
> ----------------------------------------------------------------------
>
> Key: COUCHDB-1259
> URL: https://issues.apache.org/jira/browse/COUCHDB-1259
> Project: CouchDB
> Issue Type: Bug
> Components: Replication
> Affects Versions: 1.1
> Reporter: Jens Alfke
>
> I noticed that when Couchbase Mobile running on iOS replicates to/from a remote server (on iriscouch in this case), the replication has to fetch the full _changes feed every time it starts. Filipe helped me track down the problem -- the replication ID is coming out different every time. The reason for this is that the local port number, which is one of the inputs to the hash that generates the replication ID, is randomly assigned by the OS. (I.e. it uses a port number of 0 when opening its listener socket.) This is because there could be multiple apps using Couchbase Mobile running on the same device and we can't have their ports colliding.
> The underlying problem is that CouchDB is attempting to generate a unique ID for a particular pair of {source, destination} databases, but it's basing it on attributes that aren't fundamental to the database and can change, like the hostname or port number.
> One solution, proposed by Filipe and me, is to assign each database (or each server?) a random UUID when it's created, and use that to generate replication IDs.
> Another solution, proposed by Damien, is to have CouchDB let the client work out the replication ID on its own, and set it as a property in the replication document (or the JSON body of a _replicate request.) This is even more flexible and will handle tricky scenarios like full P2P replication where there may be no low-level way to uniquely identify the remote database being synced with.
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (COUCHDB-1259) Replication ID is not stable if
local server has a dynamic port number
Posted by "Robert Newson (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/COUCHDB-1259?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13490568#comment-13490568 ]
Robert Newson commented on COUCHDB-1259:
----------------------------------------
Sorry, Benoit, I simply can't see the security problem you are trying to describe at all. Walk me through a process where a server changes ports and security is violated. As far as I can tell, the only difference this patch makes is that we can resume replication from a checkpoint where we previously couldn't. That a server changes port doesn't invalidate the checkpoint's integrity, nor do I trust the server more or less based on its numeric port value. If I want to trust the machine, I need TLS, which is completely orthogonal to this ticket.
> Replication ID is not stable if local server has a dynamic port number
> ----------------------------------------------------------------------
>
> Key: COUCHDB-1259
> URL: https://issues.apache.org/jira/browse/COUCHDB-1259
> Project: CouchDB
> Issue Type: Bug
> Components: Replication
> Affects Versions: 1.1
> Reporter: Jens Alfke
> Assignee: Robert Newson
> Priority: Blocker
> Fix For: 1.3
>
> Attachments: couchdb-1259.patch, couchdb-1259.patch
>
>
> I noticed that when Couchbase Mobile running on iOS replicates to/from a remote server (on iriscouch in this case), the replication has to fetch the full _changes feed every time it starts. Filipe helped me track down the problem -- the replication ID is coming out different every time. The reason for this is that the local port number, which is one of the inputs to the hash that generates the replication ID, is randomly assigned by the OS. (I.e. it uses a port number of 0 when opening its listener socket.) This is because there could be multiple apps using Couchbase Mobile running on the same device and we can't have their ports colliding.
> The underlying problem is that CouchDB is attempting to generate a unique ID for a particular pair of {source, destination} databases, but it's basing it on attributes that aren't fundamental to the database and can change, like the hostname or port number.
> One solution, proposed by Filipe and me, is to assign each database (or each server?) a random UUID when it's created, and use that to generate replication IDs.
> Another solution, proposed by Damien, is to have CouchDB let the client work out the replication ID on its own, and set it as a property in the replication document (or the JSON body of a _replicate request.) This is even more flexible and will handle tricky scenarios like full P2P replication where there may be no low-level way to uniquely identify the remote database being synced with.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (COUCHDB-1259) Replication ID is not stable if
local server has a dynamic port number
Posted by "Dave Cottlehuber (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/COUCHDB-1259?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13490612#comment-13490612 ]
Dave Cottlehuber commented on COUCHDB-1259:
-------------------------------------------
Jens, will the patch address your issue?
Overall I'm +1 on this approach for enabling faster restarts of replication -- I think it's a huge win.
I don't see that the behaviour of the new patch changes the security constraints vs today, but I think I see Benoit's point. Today if a replication endpoint changes its ephemeral port # (e.g. expired DHCP lease), the replication will fail and cannot restart until it is deleted & recreated.
With the patch, the replication could restart in some situations, without requiring active intervention - that's the whole point.
So if Dr.Evil has captured the UUID, it might be possible to acquire the replication without the source endpoint being aware. I think this should be addressed post 1.3. The proposed functionality could note that securing replication requires using TLS and appropriate SSL cert checking in both directions. Which seems common sense anyway! The Dr Evil scenario however is no different under today's activity - if an IP address is hijacked and SSL is not in use, Dr Evil has your documents.
> Replication ID is not stable if local server has a dynamic port number
> ----------------------------------------------------------------------
>
> Key: COUCHDB-1259
> URL: https://issues.apache.org/jira/browse/COUCHDB-1259
> Project: CouchDB
> Issue Type: Bug
> Components: Replication
> Affects Versions: 1.1
> Reporter: Jens Alfke
> Assignee: Robert Newson
> Priority: Blocker
> Fix For: 1.3
>
> Attachments: couchdb-1259.patch, couchdb-1259.patch
>
>
> I noticed that when Couchbase Mobile running on iOS replicates to/from a remote server (on iriscouch in this case), the replication has to fetch the full _changes feed every time it starts. Filipe helped me track down the problem -- the replication ID is coming out different every time. The reason for this is that the local port number, which is one of the inputs to the hash that generates the replication ID, is randomly assigned by the OS. (I.e. it uses a port number of 0 when opening its listener socket.) This is because there could be multiple apps using Couchbase Mobile running on the same device and we can't have their ports colliding.
> The underlying problem is that CouchDB is attempting to generate a unique ID for a particular pair of {source, destination} databases, but it's basing it on attributes that aren't fundamental to the database and can change, like the hostname or port number.
> One solution, proposed by Filipe and me, is to assign each database (or each server?) a random UUID when it's created, and use that to generate replication IDs.
> Another solution, proposed by Damien, is to have CouchDB let the client work out the replication ID on its own, and set it as a property in the replication document (or the JSON body of a _replicate request.) This is even more flexible and will handle tricky scenarios like full P2P replication where there may be no low-level way to uniquely identify the remote database being synced with.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (COUCHDB-1259) Replication ID is not stable if
local server has a dynamic port number
Posted by "Jens Alfke (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/COUCHDB-1259?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13490886#comment-13490886 ]
Jens Alfke commented on COUCHDB-1259:
-------------------------------------
I have looked at the patch but I don't really understand what it's doing, both because my Erlang is really weak and because I don't know the internals of CouchDB. So I can't really comment on the code.
It does sound like what's being suggested goes beyond what I asked for. This bug is about the *local* server (the one running the replication) having a different IP address or port than the last time. The suggested patches seem to also cover changes to the *remote* server's URL. That's an interesting issue but IMHO not the same thing.
The point of this bug is that the URL of the *local* server running the replication is irrelevant to the replication. If I'm opening connections to another server to replicate with it, it doesn't matter what port or IP address I am listening on, because there aren't any incoming connections happening. They don't affect the replication at all.
As for Benoit's security issues: Replication has no security. Security applies at a more fundamental level of identifying who is connecting and authenticating that principal. You absolutely cannot make security tests based on IP addresses or port numbers.
> Replication ID is not stable if local server has a dynamic port number
> ----------------------------------------------------------------------
>
> Key: COUCHDB-1259
> URL: https://issues.apache.org/jira/browse/COUCHDB-1259
> Project: CouchDB
> Issue Type: Bug
> Components: Replication
> Affects Versions: 1.1
> Reporter: Jens Alfke
> Assignee: Robert Newson
> Priority: Blocker
> Fix For: 1.3
>
> Attachments: couchdb-1259.patch, couchdb-1259.patch
>
>
> I noticed that when Couchbase Mobile running on iOS replicates to/from a remote server (on iriscouch in this case), the replication has to fetch the full _changes feed every time it starts. Filipe helped me track down the problem -- the replication ID is coming out different every time. The reason for this is that the local port number, which is one of the inputs to the hash that generates the replication ID, is randomly assigned by the OS. (I.e. it uses a port number of 0 when opening its listener socket.) This is because there could be multiple apps using Couchbase Mobile running on the same device and we can't have their ports colliding.
> The underlying problem is that CouchDB is attempting to generate a unique ID for a particular pair of {source, destination} databases, but it's basing it on attributes that aren't fundamental to the database and can change, like the hostname or port number.
> One solution, proposed by Filipe and me, is to assign each database (or each server?) a random UUID when it's created, and use that to generate replication IDs.
> Another solution, proposed by Damien, is to have CouchDB let the client work out the replication ID on its own, and set it as a property in the replication document (or the JSON body of a _replicate request.) This is even more flexible and will handle tricky scenarios like full P2P replication where there may be no low-level way to uniquely identify the remote database being synced with.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (COUCHDB-1259) Replication ID is not stable if
local server has a dynamic port number
Posted by "Benoit Chesneau (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/COUCHDB-1259?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13490659#comment-13490659 ]
Benoit Chesneau commented on COUCHDB-1259:
------------------------------------------
as an alternive solution I think that we could let the user fix the replication id by reusing the current _replicator id or the one used for the _replicate API.
The only problem I see with that is when the the user will post 2 tasks doing the same thing.
> Replication ID is not stable if local server has a dynamic port number
> ----------------------------------------------------------------------
>
> Key: COUCHDB-1259
> URL: https://issues.apache.org/jira/browse/COUCHDB-1259
> Project: CouchDB
> Issue Type: Bug
> Components: Replication
> Affects Versions: 1.1
> Reporter: Jens Alfke
> Assignee: Robert Newson
> Priority: Blocker
> Fix For: 1.3
>
> Attachments: couchdb-1259.patch, couchdb-1259.patch
>
>
> I noticed that when Couchbase Mobile running on iOS replicates to/from a remote server (on iriscouch in this case), the replication has to fetch the full _changes feed every time it starts. Filipe helped me track down the problem -- the replication ID is coming out different every time. The reason for this is that the local port number, which is one of the inputs to the hash that generates the replication ID, is randomly assigned by the OS. (I.e. it uses a port number of 0 when opening its listener socket.) This is because there could be multiple apps using Couchbase Mobile running on the same device and we can't have their ports colliding.
> The underlying problem is that CouchDB is attempting to generate a unique ID for a particular pair of {source, destination} databases, but it's basing it on attributes that aren't fundamental to the database and can change, like the hostname or port number.
> One solution, proposed by Filipe and me, is to assign each database (or each server?) a random UUID when it's created, and use that to generate replication IDs.
> Another solution, proposed by Damien, is to have CouchDB let the client work out the replication ID on its own, and set it as a property in the replication document (or the JSON body of a _replicate request.) This is even more flexible and will handle tricky scenarios like full P2P replication where there may be no low-level way to uniquely identify the remote database being synced with.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (COUCHDB-1259) Replication ID is not stable if
local server has a dynamic port number
Posted by "Robert Newson (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/COUCHDB-1259?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13490633#comment-13490633 ]
Robert Newson commented on COUCHDB-1259:
----------------------------------------
Dave, if the port of source or target changes, then, no, the replication cannot restart (because the replication task will be trying to contact a server on a port it is not listening on). If a new task is started pointing at the new port, it will simply pick up a valid checkpoint that it otherwise wouldn't.
> Replication ID is not stable if local server has a dynamic port number
> ----------------------------------------------------------------------
>
> Key: COUCHDB-1259
> URL: https://issues.apache.org/jira/browse/COUCHDB-1259
> Project: CouchDB
> Issue Type: Bug
> Components: Replication
> Affects Versions: 1.1
> Reporter: Jens Alfke
> Assignee: Robert Newson
> Priority: Blocker
> Fix For: 1.3
>
> Attachments: couchdb-1259.patch, couchdb-1259.patch
>
>
> I noticed that when Couchbase Mobile running on iOS replicates to/from a remote server (on iriscouch in this case), the replication has to fetch the full _changes feed every time it starts. Filipe helped me track down the problem -- the replication ID is coming out different every time. The reason for this is that the local port number, which is one of the inputs to the hash that generates the replication ID, is randomly assigned by the OS. (I.e. it uses a port number of 0 when opening its listener socket.) This is because there could be multiple apps using Couchbase Mobile running on the same device and we can't have their ports colliding.
> The underlying problem is that CouchDB is attempting to generate a unique ID for a particular pair of {source, destination} databases, but it's basing it on attributes that aren't fundamental to the database and can change, like the hostname or port number.
> One solution, proposed by Filipe and me, is to assign each database (or each server?) a random UUID when it's created, and use that to generate replication IDs.
> Another solution, proposed by Damien, is to have CouchDB let the client work out the replication ID on its own, and set it as a property in the replication document (or the JSON body of a _replicate request.) This is even more flexible and will handle tricky scenarios like full P2P replication where there may be no low-level way to uniquely identify the remote database being synced with.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (COUCHDB-1259) Replication ID is not stable if
local server has a dynamic port number
Posted by "Benoit Chesneau (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/COUCHDB-1259?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13490279#comment-13490279 ]
Benoit Chesneau commented on COUCHDB-1259:
------------------------------------------
I was reading the comment, and not sure it's a probem. Irt's expected in a p2p world and master-master replication that the node at the end could change. What doesn't changes are the data inside the dbs. Imo tthis is the role of the application to handle port,ips, dns changes. Not couchdb. In short I would close this issue as a wontfix.
> Replication ID is not stable if local server has a dynamic port number
> ----------------------------------------------------------------------
>
> Key: COUCHDB-1259
> URL: https://issues.apache.org/jira/browse/COUCHDB-1259
> Project: CouchDB
> Issue Type: Bug
> Components: Replication
> Affects Versions: 1.1
> Reporter: Jens Alfke
> Assignee: Robert Newson
> Priority: Blocker
> Fix For: 1.3
>
> Attachments: couchdb-1259.patch, couchdb-1259.patch
>
>
> I noticed that when Couchbase Mobile running on iOS replicates to/from a remote server (on iriscouch in this case), the replication has to fetch the full _changes feed every time it starts. Filipe helped me track down the problem -- the replication ID is coming out different every time. The reason for this is that the local port number, which is one of the inputs to the hash that generates the replication ID, is randomly assigned by the OS. (I.e. it uses a port number of 0 when opening its listener socket.) This is because there could be multiple apps using Couchbase Mobile running on the same device and we can't have their ports colliding.
> The underlying problem is that CouchDB is attempting to generate a unique ID for a particular pair of {source, destination} databases, but it's basing it on attributes that aren't fundamental to the database and can change, like the hostname or port number.
> One solution, proposed by Filipe and me, is to assign each database (or each server?) a random UUID when it's created, and use that to generate replication IDs.
> Another solution, proposed by Damien, is to have CouchDB let the client work out the replication ID on its own, and set it as a property in the replication document (or the JSON body of a _replicate request.) This is even more flexible and will handle tricky scenarios like full P2P replication where there may be no low-level way to uniquely identify the remote database being synced with.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (COUCHDB-1259) Replication ID is not stable if
local server has a dynamic port number
Posted by "Jens Alfke (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/COUCHDB-1259?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13090396#comment-13090396 ]
Jens Alfke commented on COUCHDB-1259:
-------------------------------------
@Jason — I see where you're coming from with "bad web citizen" but it refers only to a specific usage of CouchDB as a traditional web server. We have equally valid uses of it that do not act as traditional servers nor have stable URLs, for which we absolutely need this fix. I don't think arguments about whether URLs change or not are productive here in a specific bug report.
> Replication ID is not stable if local server has a dynamic port number
> ----------------------------------------------------------------------
>
> Key: COUCHDB-1259
> URL: https://issues.apache.org/jira/browse/COUCHDB-1259
> Project: CouchDB
> Issue Type: Bug
> Components: Replication
> Affects Versions: 1.1
> Reporter: Jens Alfke
>
> I noticed that when Couchbase Mobile running on iOS replicates to/from a remote server (on iriscouch in this case), the replication has to fetch the full _changes feed every time it starts. Filipe helped me track down the problem -- the replication ID is coming out different every time. The reason for this is that the local port number, which is one of the inputs to the hash that generates the replication ID, is randomly assigned by the OS. (I.e. it uses a port number of 0 when opening its listener socket.) This is because there could be multiple apps using Couchbase Mobile running on the same device and we can't have their ports colliding.
> The underlying problem is that CouchDB is attempting to generate a unique ID for a particular pair of {source, destination} databases, but it's basing it on attributes that aren't fundamental to the database and can change, like the hostname or port number.
> One solution, proposed by Filipe and me, is to assign each database (or each server?) a random UUID when it's created, and use that to generate replication IDs.
> Another solution, proposed by Damien, is to have CouchDB let the client work out the replication ID on its own, and set it as a property in the replication document (or the JSON body of a _replicate request.) This is even more flexible and will handle tricky scenarios like full P2P replication where there may be no low-level way to uniquely identify the remote database being synced with.
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (COUCHDB-1259) Replication ID is not stable if
local server has a dynamic port number
Posted by "Jens Alfke (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/COUCHDB-1259?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13089976#comment-13089976 ]
Jens Alfke commented on COUCHDB-1259:
-------------------------------------
@Jason: The reason I filed this bug report is that the URL of a database in Couchbase Mobile *isn't* unique. It's barely meaningful at all; it's of the form "http://127.0.0.1:nnnnn" where "nnnnn" is an upredictable port number assigned by the TCP stack at launch time. That URL isn't even exposed to the outside world because the CouchDB server is only listening on the loopback interface.
The state that's being represented by a replication ID is the contents of the database (at least as it was when it last synced.) So it seems the ID should be something that sticks to the database itself, not to any ephemeral manifestation like a URL.
> Replication ID is not stable if local server has a dynamic port number
> ----------------------------------------------------------------------
>
> Key: COUCHDB-1259
> URL: https://issues.apache.org/jira/browse/COUCHDB-1259
> Project: CouchDB
> Issue Type: Bug
> Components: Replication
> Affects Versions: 1.1
> Reporter: Jens Alfke
>
> I noticed that when Couchbase Mobile running on iOS replicates to/from a remote server (on iriscouch in this case), the replication has to fetch the full _changes feed every time it starts. Filipe helped me track down the problem -- the replication ID is coming out different every time. The reason for this is that the local port number, which is one of the inputs to the hash that generates the replication ID, is randomly assigned by the OS. (I.e. it uses a port number of 0 when opening its listener socket.) This is because there could be multiple apps using Couchbase Mobile running on the same device and we can't have their ports colliding.
> The underlying problem is that CouchDB is attempting to generate a unique ID for a particular pair of {source, destination} databases, but it's basing it on attributes that aren't fundamental to the database and can change, like the hostname or port number.
> One solution, proposed by Filipe and me, is to assign each database (or each server?) a random UUID when it's created, and use that to generate replication IDs.
> Another solution, proposed by Damien, is to have CouchDB let the client work out the replication ID on its own, and set it as a property in the replication document (or the JSON body of a _replicate request.) This is even more flexible and will handle tricky scenarios like full P2P replication where there may be no low-level way to uniquely identify the remote database being synced with.
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (COUCHDB-1259) Replication ID is not stable if
local server has a dynamic port number
Posted by "Jens Alfke (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/COUCHDB-1259?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13490427#comment-13490427 ]
Jens Alfke commented on COUCHDB-1259:
-------------------------------------
> It is the responsibility of the application to know that. As a protocol the replication shouldn't force this way imo.
Then how does the application do this? I haven't seen any API for it.
Also, I don't see how this has anything to do with the case of a leaf node running a server that happens to have a dynamic port assignment. The port this node is running on has absolutely nothing to do with the replication. In the (now obsolete) case of Couchbase Mobile, the server doesn't even accept external requests, so its port number is purely an internal affair.
I still have a feeling that we're talking about completely different things. But I can't really figure out what your point is...
> Replication ID is not stable if local server has a dynamic port number
> ----------------------------------------------------------------------
>
> Key: COUCHDB-1259
> URL: https://issues.apache.org/jira/browse/COUCHDB-1259
> Project: CouchDB
> Issue Type: Bug
> Components: Replication
> Affects Versions: 1.1
> Reporter: Jens Alfke
> Assignee: Robert Newson
> Priority: Blocker
> Fix For: 1.3
>
> Attachments: couchdb-1259.patch, couchdb-1259.patch
>
>
> I noticed that when Couchbase Mobile running on iOS replicates to/from a remote server (on iriscouch in this case), the replication has to fetch the full _changes feed every time it starts. Filipe helped me track down the problem -- the replication ID is coming out different every time. The reason for this is that the local port number, which is one of the inputs to the hash that generates the replication ID, is randomly assigned by the OS. (I.e. it uses a port number of 0 when opening its listener socket.) This is because there could be multiple apps using Couchbase Mobile running on the same device and we can't have their ports colliding.
> The underlying problem is that CouchDB is attempting to generate a unique ID for a particular pair of {source, destination} databases, but it's basing it on attributes that aren't fundamental to the database and can change, like the hostname or port number.
> One solution, proposed by Filipe and me, is to assign each database (or each server?) a random UUID when it's created, and use that to generate replication IDs.
> Another solution, proposed by Damien, is to have CouchDB let the client work out the replication ID on its own, and set it as a property in the replication document (or the JSON body of a _replicate request.) This is even more flexible and will handle tricky scenarios like full P2P replication where there may be no low-level way to uniquely identify the remote database being synced with.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (COUCHDB-1259) Replication ID is not stable if
local server has a dynamic port number
Posted by "Jason Smith (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/COUCHDB-1259?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13089982#comment-13089982 ]
Jason Smith commented on COUCHDB-1259:
--------------------------------------
@Paul, I overlooked or misunderstood Randal's point about duplicating the UUID. Makes sense.
@Paul and Jens, totally: URLs are unstable. And, in general, on the web, if a URL changes, that is a huge piece of information. That is a huge hint that you need to re-evaluate your assumptions. Exhibit A: the replicator starts from scratch if you give it a new URL. That is the correct general solution.
Your requirement to change the couch URL and everything is just fine and the application doesn't have to worry--I think that requirement is asking CouchDB to be a bad web citizen. In other words, IMO you have an application-level problem, not a couch problem, *except* that even if you could determine everything is alright, you can't specify the replication ID.
I think Damien just time-traveled again.
BTW, @Jens, you can already give Apache CouchDB a UUID for your own needs. If you have admin access, just put it anywhere, /_config/jens/uuid. If an unprivileged client must know this UUID, then change the "Welcome" mesage in _config/httpd_global_handlers/%2f. Any unprivileged client can find it there. (You could also place the UUID in the authentication realm in _config/httpd/WWW-Authenticate which actually sounds sort of appropriate.) Finally, if you are willing to run a fork (which mobile Couchbase is) then you could add any feature you need which doesn't make sense for Apache CouchDB.
> Replication ID is not stable if local server has a dynamic port number
> ----------------------------------------------------------------------
>
> Key: COUCHDB-1259
> URL: https://issues.apache.org/jira/browse/COUCHDB-1259
> Project: CouchDB
> Issue Type: Bug
> Components: Replication
> Affects Versions: 1.1
> Reporter: Jens Alfke
>
> I noticed that when Couchbase Mobile running on iOS replicates to/from a remote server (on iriscouch in this case), the replication has to fetch the full _changes feed every time it starts. Filipe helped me track down the problem -- the replication ID is coming out different every time. The reason for this is that the local port number, which is one of the inputs to the hash that generates the replication ID, is randomly assigned by the OS. (I.e. it uses a port number of 0 when opening its listener socket.) This is because there could be multiple apps using Couchbase Mobile running on the same device and we can't have their ports colliding.
> The underlying problem is that CouchDB is attempting to generate a unique ID for a particular pair of {source, destination} databases, but it's basing it on attributes that aren't fundamental to the database and can change, like the hostname or port number.
> One solution, proposed by Filipe and me, is to assign each database (or each server?) a random UUID when it's created, and use that to generate replication IDs.
> Another solution, proposed by Damien, is to have CouchDB let the client work out the replication ID on its own, and set it as a property in the replication document (or the JSON body of a _replicate request.) This is even more flexible and will handle tricky scenarios like full P2P replication where there may be no low-level way to uniquely identify the remote database being synced with.
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (COUCHDB-1259) Replication ID is not stable if
local server has a dynamic port number
Posted by "Jens Alfke (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/COUCHDB-1259?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13490448#comment-13490448 ]
Jens Alfke commented on COUCHDB-1259:
-------------------------------------
It seems like overkill to get the IANA to assign a fixed port number to an app that doesn't even listen on any external interfaces! The only use of that port is (was) over the loopback interface to let the application communicate with CouchDB.
Passing zero for the port in the config file didn't make the problem go away. Apparently the replicator bases the ID on the actual random port number in use, not on the fixed 0 from the config.
> What will prevents an hostile node to connect back to your node with the same id?
Hello, are you listening at all to what I'm writing? I've already said several times that the app does not accept incoming connections at all. It only makes outgoing connections to replicate.
And in general: obviously in any real P2P app there would be actual security measures in place to authenticate connections, most likely by using both server and client SSL certs and verifying their public keys. Once the connection is made, _then_ database IDs can be used to restore the state of a replication.
> Replication ID is not stable if local server has a dynamic port number
> ----------------------------------------------------------------------
>
> Key: COUCHDB-1259
> URL: https://issues.apache.org/jira/browse/COUCHDB-1259
> Project: CouchDB
> Issue Type: Bug
> Components: Replication
> Affects Versions: 1.1
> Reporter: Jens Alfke
> Assignee: Robert Newson
> Priority: Blocker
> Fix For: 1.3
>
> Attachments: couchdb-1259.patch, couchdb-1259.patch
>
>
> I noticed that when Couchbase Mobile running on iOS replicates to/from a remote server (on iriscouch in this case), the replication has to fetch the full _changes feed every time it starts. Filipe helped me track down the problem -- the replication ID is coming out different every time. The reason for this is that the local port number, which is one of the inputs to the hash that generates the replication ID, is randomly assigned by the OS. (I.e. it uses a port number of 0 when opening its listener socket.) This is because there could be multiple apps using Couchbase Mobile running on the same device and we can't have their ports colliding.
> The underlying problem is that CouchDB is attempting to generate a unique ID for a particular pair of {source, destination} databases, but it's basing it on attributes that aren't fundamental to the database and can change, like the hostname or port number.
> One solution, proposed by Filipe and me, is to assign each database (or each server?) a random UUID when it's created, and use that to generate replication IDs.
> Another solution, proposed by Damien, is to have CouchDB let the client work out the replication ID on its own, and set it as a property in the replication document (or the JSON body of a _replicate request.) This is even more flexible and will handle tricky scenarios like full P2P replication where there may be no low-level way to uniquely identify the remote database being synced with.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
Re: [jira] [Commented] (COUCHDB-1259) Replication ID is not stable if local server has a dynamic port number
Posted by Jan Lehnardt <ja...@apache.org>.
Benoit & Jens,
can I ask you both to keep a civil tone?
I understand that it can be frustrating when the other party
seemlingly doesn’t understand your point of view, but I believe
that the resulting energy is better put towards trying harder to
understand the other side and making myself more clear. (which
you did later on, so thanks :)
I know you’ve both been around the block enough to understand :)
With relaxing regards
Jan
--
On Nov 5, 2012, at 05:43 , Benoit Chesneau (JIRA) <ji...@apache.org> wrote:
>
> [ https://issues.apache.org/jira/browse/COUCHDB-1259?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13490449#comment-13490449 ]
>
> Benoit Chesneau commented on COUCHDB-1259:
> ------------------------------------------
>
> Hello.... are you understanding that this isn't only about your application? Some may have different uses. And different routing policy. And this is not the role of couchdb to fix them.
>
>> Replication ID is not stable if local server has a dynamic port number
>> ----------------------------------------------------------------------
>>
>> Key: COUCHDB-1259
>> URL: https://issues.apache.org/jira/browse/COUCHDB-1259
>> Project: CouchDB
>> Issue Type: Bug
>> Components: Replication
>> Affects Versions: 1.1
>> Reporter: Jens Alfke
>> Assignee: Robert Newson
>> Priority: Blocker
>> Fix For: 1.3
>>
>> Attachments: couchdb-1259.patch, couchdb-1259.patch
>>
>>
>> I noticed that when Couchbase Mobile running on iOS replicates to/from a remote server (on iriscouch in this case), the replication has to fetch the full _changes feed every time it starts. Filipe helped me track down the problem -- the replication ID is coming out different every time. The reason for this is that the local port number, which is one of the inputs to the hash that generates the replication ID, is randomly assigned by the OS. (I.e. it uses a port number of 0 when opening its listener socket.) This is because there could be multiple apps using Couchbase Mobile running on the same device and we can't have their ports colliding.
>> The underlying problem is that CouchDB is attempting to generate a unique ID for a particular pair of {source, destination} databases, but it's basing it on attributes that aren't fundamental to the database and can change, like the hostname or port number.
>> One solution, proposed by Filipe and me, is to assign each database (or each server?) a random UUID when it's created, and use that to generate replication IDs.
>> Another solution, proposed by Damien, is to have CouchDB let the client work out the replication ID on its own, and set it as a property in the replication document (or the JSON body of a _replicate request.) This is even more flexible and will handle tricky scenarios like full P2P replication where there may be no low-level way to uniquely identify the remote database being synced with.
>
> --
> This message is automatically generated by JIRA.
> If you think it was sent incorrectly, please contact your JIRA administrators
> For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (COUCHDB-1259) Replication ID is not stable if
local server has a dynamic port number
Posted by "Benoit Chesneau (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/COUCHDB-1259?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13490449#comment-13490449 ]
Benoit Chesneau commented on COUCHDB-1259:
------------------------------------------
Hello.... are you understanding that this isn't only about your application? Some may have different uses. And different routing policy. And this is not the role of couchdb to fix them.
> Replication ID is not stable if local server has a dynamic port number
> ----------------------------------------------------------------------
>
> Key: COUCHDB-1259
> URL: https://issues.apache.org/jira/browse/COUCHDB-1259
> Project: CouchDB
> Issue Type: Bug
> Components: Replication
> Affects Versions: 1.1
> Reporter: Jens Alfke
> Assignee: Robert Newson
> Priority: Blocker
> Fix For: 1.3
>
> Attachments: couchdb-1259.patch, couchdb-1259.patch
>
>
> I noticed that when Couchbase Mobile running on iOS replicates to/from a remote server (on iriscouch in this case), the replication has to fetch the full _changes feed every time it starts. Filipe helped me track down the problem -- the replication ID is coming out different every time. The reason for this is that the local port number, which is one of the inputs to the hash that generates the replication ID, is randomly assigned by the OS. (I.e. it uses a port number of 0 when opening its listener socket.) This is because there could be multiple apps using Couchbase Mobile running on the same device and we can't have their ports colliding.
> The underlying problem is that CouchDB is attempting to generate a unique ID for a particular pair of {source, destination} databases, but it's basing it on attributes that aren't fundamental to the database and can change, like the hostname or port number.
> One solution, proposed by Filipe and me, is to assign each database (or each server?) a random UUID when it's created, and use that to generate replication IDs.
> Another solution, proposed by Damien, is to have CouchDB let the client work out the replication ID on its own, and set it as a property in the replication document (or the JSON body of a _replicate request.) This is even more flexible and will handle tricky scenarios like full P2P replication where there may be no low-level way to uniquely identify the remote database being synced with.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (COUCHDB-1259) Replication ID is not stable if
local server has a dynamic port number
Posted by "Robert Newson (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/COUCHDB-1259?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13490552#comment-13490552 ]
Robert Newson commented on COUCHDB-1259:
----------------------------------------
Benoit, the only intention of the patch is to improve the hit rate for replication checkpoint documents. If the port of a participant changes, the current replicator will replicate from update_seq 0 because it won't find the checkpoint from the previous port. With this change, the replicator can negotiate a stable value (the UUID) to use in place of the unstable value (port), and thus find a valid checkpoint document. For large databases, this can be hugely valuable. If you are saying that this breaks replication or eventual consistency, please say so and explain how. The only thing this patch should do is prevent needless and time-consuming replication when a shortcut is available. If you feel it doesn't do that, please help me to see why.
This ticket is over a year old, I do not want to bump it to 1.4 without a good reason.
> Replication ID is not stable if local server has a dynamic port number
> ----------------------------------------------------------------------
>
> Key: COUCHDB-1259
> URL: https://issues.apache.org/jira/browse/COUCHDB-1259
> Project: CouchDB
> Issue Type: Bug
> Components: Replication
> Affects Versions: 1.1
> Reporter: Jens Alfke
> Assignee: Robert Newson
> Priority: Blocker
> Fix For: 1.3
>
> Attachments: couchdb-1259.patch, couchdb-1259.patch
>
>
> I noticed that when Couchbase Mobile running on iOS replicates to/from a remote server (on iriscouch in this case), the replication has to fetch the full _changes feed every time it starts. Filipe helped me track down the problem -- the replication ID is coming out different every time. The reason for this is that the local port number, which is one of the inputs to the hash that generates the replication ID, is randomly assigned by the OS. (I.e. it uses a port number of 0 when opening its listener socket.) This is because there could be multiple apps using Couchbase Mobile running on the same device and we can't have their ports colliding.
> The underlying problem is that CouchDB is attempting to generate a unique ID for a particular pair of {source, destination} databases, but it's basing it on attributes that aren't fundamental to the database and can change, like the hostname or port number.
> One solution, proposed by Filipe and me, is to assign each database (or each server?) a random UUID when it's created, and use that to generate replication IDs.
> Another solution, proposed by Damien, is to have CouchDB let the client work out the replication ID on its own, and set it as a property in the replication document (or the JSON body of a _replicate request.) This is even more flexible and will handle tricky scenarios like full P2P replication where there may be no low-level way to uniquely identify the remote database being synced with.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (COUCHDB-1259) Replication ID is not stable if
local server has a dynamic port number
Posted by "Benoit Chesneau (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/COUCHDB-1259?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13490433#comment-13490433 ]
Benoit Chesneau commented on COUCHDB-1259:
------------------------------------------
We don't speak about different things. We are expecting different behaviours however.
If you have a dynamic port assignment then how knows the other node the new port ? There are no other way than a ping-pong here. Ping-Pong that can be done in different manner. To know this new port you will have to update the replicator doc. Or the replication client could check on an adress table etc... In any case there will be a dialog that can be different across applications. And this is the point, this part is generally the logic of the application or the routing policy. A server id can be use as an adress point but some could decide to use other parameters to associate this replication id to a node.
Maybe instead of relying on a fixed node id, we could however introduce an arbitrary remote id. This remote ID would be associated by default to an host , port. The layer assigning this address id to the host/port could be switchable, so the application or user could introduce easily its own routing policy. Which could be relying on a server id ? Eventually if there is an interrest like we do for the auth handlers or uuid generators, we could have different implementations shipped with couchdb. One for example relying on a server id.
btw your example with couchbase mobile is generally solved by using the replication in pull mode only. So here it is relying on a fixed address to replicate. A central node is then used as a meeting point for all the data coming from other nodes and the replication is filtered per nodes.
> Replication ID is not stable if local server has a dynamic port number
> ----------------------------------------------------------------------
>
> Key: COUCHDB-1259
> URL: https://issues.apache.org/jira/browse/COUCHDB-1259
> Project: CouchDB
> Issue Type: Bug
> Components: Replication
> Affects Versions: 1.1
> Reporter: Jens Alfke
> Assignee: Robert Newson
> Priority: Blocker
> Fix For: 1.3
>
> Attachments: couchdb-1259.patch, couchdb-1259.patch
>
>
> I noticed that when Couchbase Mobile running on iOS replicates to/from a remote server (on iriscouch in this case), the replication has to fetch the full _changes feed every time it starts. Filipe helped me track down the problem -- the replication ID is coming out different every time. The reason for this is that the local port number, which is one of the inputs to the hash that generates the replication ID, is randomly assigned by the OS. (I.e. it uses a port number of 0 when opening its listener socket.) This is because there could be multiple apps using Couchbase Mobile running on the same device and we can't have their ports colliding.
> The underlying problem is that CouchDB is attempting to generate a unique ID for a particular pair of {source, destination} databases, but it's basing it on attributes that aren't fundamental to the database and can change, like the hostname or port number.
> One solution, proposed by Filipe and me, is to assign each database (or each server?) a random UUID when it's created, and use that to generate replication IDs.
> Another solution, proposed by Damien, is to have CouchDB let the client work out the replication ID on its own, and set it as a property in the replication document (or the JSON body of a _replicate request.) This is even more flexible and will handle tricky scenarios like full P2P replication where there may be no low-level way to uniquely identify the remote database being synced with.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (COUCHDB-1259) Replication ID is not stable if
local server has a dynamic port number
Posted by "Jens Alfke (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/COUCHDB-1259?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13490441#comment-13490441 ]
Jens Alfke commented on COUCHDB-1259:
-------------------------------------
> btw your example with couchbase mobile is generally solved by using the replication in pull mode only. So here it is relying on a fixed address to replicate.
*sigh* No, that is exactly the situation I was describing. The mobile client is the only one initiating replication; it pulls from the central (fixed-address) server, and pushes changes to it. So the mobile device's IP address and port are irrelevant, right? Except that the replication state document stored in _local has an ID based on several things _including_ the local server's address and port number. So the effect is that, every time the app launches, all the replication state gets lost/invalidated, and it has to start over again the next time it replicates.
TouchDB doesn't have this problem because I didn't write it with this design flaw :) Instead every local database has a UUID as suggested here, and that's used as part of the key.
> Replication ID is not stable if local server has a dynamic port number
> ----------------------------------------------------------------------
>
> Key: COUCHDB-1259
> URL: https://issues.apache.org/jira/browse/COUCHDB-1259
> Project: CouchDB
> Issue Type: Bug
> Components: Replication
> Affects Versions: 1.1
> Reporter: Jens Alfke
> Assignee: Robert Newson
> Priority: Blocker
> Fix For: 1.3
>
> Attachments: couchdb-1259.patch, couchdb-1259.patch
>
>
> I noticed that when Couchbase Mobile running on iOS replicates to/from a remote server (on iriscouch in this case), the replication has to fetch the full _changes feed every time it starts. Filipe helped me track down the problem -- the replication ID is coming out different every time. The reason for this is that the local port number, which is one of the inputs to the hash that generates the replication ID, is randomly assigned by the OS. (I.e. it uses a port number of 0 when opening its listener socket.) This is because there could be multiple apps using Couchbase Mobile running on the same device and we can't have their ports colliding.
> The underlying problem is that CouchDB is attempting to generate a unique ID for a particular pair of {source, destination} databases, but it's basing it on attributes that aren't fundamental to the database and can change, like the hostname or port number.
> One solution, proposed by Filipe and me, is to assign each database (or each server?) a random UUID when it's created, and use that to generate replication IDs.
> Another solution, proposed by Damien, is to have CouchDB let the client work out the replication ID on its own, and set it as a property in the replication document (or the JSON body of a _replicate request.) This is even more flexible and will handle tricky scenarios like full P2P replication where there may be no low-level way to uniquely identify the remote database being synced with.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (COUCHDB-1259) Replication ID is not stable if
local server has a dynamic port number
Posted by "Benoit Chesneau (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/COUCHDB-1259?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13490547#comment-13490547 ]
Benoit Chesneau commented on COUCHDB-1259:
------------------------------------------
@rnewson I'm confused. How does it improve the hit rate fro replications checkpoints ????
I am -1 on this patch for above reason. Which are likely the first the one i gave when saying won't fix. Changing a port or an IP isn't an innocent event. It has many implications.
And such things like using a fixed replication id remove any of its implication and will make some app work difficult. What if the node id is for ex anonymized on each restart ? I think such behaviour should be configurable.
Anyway I don't think this ticket should be a blocker. Let discuss it quitely for the 1.4 .
> Replication ID is not stable if local server has a dynamic port number
> ----------------------------------------------------------------------
>
> Key: COUCHDB-1259
> URL: https://issues.apache.org/jira/browse/COUCHDB-1259
> Project: CouchDB
> Issue Type: Bug
> Components: Replication
> Affects Versions: 1.1
> Reporter: Jens Alfke
> Assignee: Robert Newson
> Priority: Blocker
> Fix For: 1.3
>
> Attachments: couchdb-1259.patch, couchdb-1259.patch
>
>
> I noticed that when Couchbase Mobile running on iOS replicates to/from a remote server (on iriscouch in this case), the replication has to fetch the full _changes feed every time it starts. Filipe helped me track down the problem -- the replication ID is coming out different every time. The reason for this is that the local port number, which is one of the inputs to the hash that generates the replication ID, is randomly assigned by the OS. (I.e. it uses a port number of 0 when opening its listener socket.) This is because there could be multiple apps using Couchbase Mobile running on the same device and we can't have their ports colliding.
> The underlying problem is that CouchDB is attempting to generate a unique ID for a particular pair of {source, destination} databases, but it's basing it on attributes that aren't fundamental to the database and can change, like the hostname or port number.
> One solution, proposed by Filipe and me, is to assign each database (or each server?) a random UUID when it's created, and use that to generate replication IDs.
> Another solution, proposed by Damien, is to have CouchDB let the client work out the replication ID on its own, and set it as a property in the replication document (or the JSON body of a _replicate request.) This is even more flexible and will handle tricky scenarios like full P2P replication where there may be no low-level way to uniquely identify the remote database being synced with.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (COUCHDB-1259) Replication ID is not stable if
local server has a dynamic port number
Posted by "Benoit Chesneau (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/COUCHDB-1259?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13490562#comment-13490562 ]
Benoit Chesneau commented on COUCHDB-1259:
------------------------------------------
So i will repeat myself here:
- changing a port is not an innocent event. With this patch the replication is just ignoring it. And i currently asking myself who take the responsibility to make sure that this replication can still happen with this environment change. Changing a port changes the condition in which your node is acting.
This patch can only work in a trusted environment. Which can be ok but **must** be optional imo.
> Replication ID is not stable if local server has a dynamic port number
> ----------------------------------------------------------------------
>
> Key: COUCHDB-1259
> URL: https://issues.apache.org/jira/browse/COUCHDB-1259
> Project: CouchDB
> Issue Type: Bug
> Components: Replication
> Affects Versions: 1.1
> Reporter: Jens Alfke
> Assignee: Robert Newson
> Priority: Blocker
> Fix For: 1.3
>
> Attachments: couchdb-1259.patch, couchdb-1259.patch
>
>
> I noticed that when Couchbase Mobile running on iOS replicates to/from a remote server (on iriscouch in this case), the replication has to fetch the full _changes feed every time it starts. Filipe helped me track down the problem -- the replication ID is coming out different every time. The reason for this is that the local port number, which is one of the inputs to the hash that generates the replication ID, is randomly assigned by the OS. (I.e. it uses a port number of 0 when opening its listener socket.) This is because there could be multiple apps using Couchbase Mobile running on the same device and we can't have their ports colliding.
> The underlying problem is that CouchDB is attempting to generate a unique ID for a particular pair of {source, destination} databases, but it's basing it on attributes that aren't fundamental to the database and can change, like the hostname or port number.
> One solution, proposed by Filipe and me, is to assign each database (or each server?) a random UUID when it's created, and use that to generate replication IDs.
> Another solution, proposed by Damien, is to have CouchDB let the client work out the replication ID on its own, and set it as a property in the replication document (or the JSON body of a _replicate request.) This is even more flexible and will handle tricky scenarios like full P2P replication where there may be no low-level way to uniquely identify the remote database being synced with.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira