You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@couchdb.apache.org by Robert Payne <ro...@me.com> on 2017/01/07 18:32:55 UTC

Re: Cluster aware _local_seq in a view?

Hey All,

Would anyone still by chance have an idea on this? Or a adequate alternative that is performant?

Cheers,
Robert

> On 19/12/2016, at 5:07 PM, Robert Payne <ro...@me.com> wrote:
> 
> Hey All,
> 
> In CouchDB 1.x we used a view with the "local_seq" option and then used emitted _local_seq's to determine where to kick off a change feed starting point. If there any way to emit a cluster aware local seq in CouchDB 2.0? I can't seem to find any way to get the node/shard suffixed sequence when using a view.
> 
> Cheers,
> Robert


Re: Cluster aware _local_seq in a view?

Posted by Jan Lehnardt <ja...@apache.org>.
Robert, gotcha. Your global view result should include a update_seq you can use for that purpose *except* in 2.x _changes _can_ include duplicates and may return results prior to the seq. The only guarantee is that you do get all _changes after that update_seq, so you need to keep track of things outside of CouchDB.

Hope this helps.

Best
Jan
--




> On 7 Jan 2017, at 19:49, Robert Payne <ro...@me.com> wrote:
> 
> Hi Jan,
> 
> Just to simplify it as much as possible we have a view like:
> 
> function (doc) {
>   emit(doc._local_seq, null);
> }
> 
> In CouchDB 1.x _local_seq is global for the entire database and as far as we ever noticed we'd never have a duplicate value for a single db. What we are doing is syncing all documents from that view and then starting the _changes feed from the last _local_seq we got.
> 
> In CouchDB 2.x _local_seq seems to be local to the database/shard as they are all integer values and even then we have duplicates because I'm presuming each shard has it's own _local_seq. What we'd need is the cluster aware seq that you pass back to _changes for this to work.
> 
> Cheers,
> Robert
> 
> 
>> On 8/01/2017, at 7:43 AM, Jan Lehnardt <ja...@apache.org> wrote:
>> 
>> I know we fixed this for _all_docs: https://issues.apache.org/jira/browse/COUCHDB-2849
>> 
>> Didn’t this make it into regular views as well?
>> 
>> Robert, can you show an example of what you are doing in 1.x and what that returns for 2.x?
>> 
>> Best
>> Jan
>> --
>> 
>>> On 7 Jan 2017, at 19:32, Robert Payne <ro...@me.com> wrote:
>>> 
>>> Hey All,
>>> 
>>> Would anyone still by chance have an idea on this? Or a adequate alternative that is performant?
>>> 
>>> Cheers,
>>> Robert
>>> 
>>>> On 19/12/2016, at 5:07 PM, Robert Payne <ro...@me.com> wrote:
>>>> 
>>>> Hey All,
>>>> 
>>>> In CouchDB 1.x we used a view with the "local_seq" option and then used emitted _local_seq's to determine where to kick off a change feed starting point. If there any way to emit a cluster aware local seq in CouchDB 2.0? I can't seem to find any way to get the node/shard suffixed sequence when using a view.
>>>> 
>>>> Cheers,
>>>> Robert
>>> 
>> 
>> -- 
>> Professional Support for Apache CouchDB:
>> https://neighbourhood.ie/couchdb-support/
>> 
> 

-- 
Professional Support for Apache CouchDB:
https://neighbourhood.ie/couchdb-support/


Re: Cluster aware _local_seq in a view?

Posted by Robert Payne <ro...@me.com>.
Hi Jan,

Just to simplify it as much as possible we have a view like:

function (doc) {
   emit(doc._local_seq, null);
}

In CouchDB 1.x _local_seq is global for the entire database and as far as we ever noticed we'd never have a duplicate value for a single db. What we are doing is syncing all documents from that view and then starting the _changes feed from the last _local_seq we got.

In CouchDB 2.x _local_seq seems to be local to the database/shard as they are all integer values and even then we have duplicates because I'm presuming each shard has it's own _local_seq. What we'd need is the cluster aware seq that you pass back to _changes for this to work.

Cheers,
Robert


> On 8/01/2017, at 7:43 AM, Jan Lehnardt <ja...@apache.org> wrote:
> 
> I know we fixed this for _all_docs: https://issues.apache.org/jira/browse/COUCHDB-2849
> 
> Didn’t this make it into regular views as well?
> 
> Robert, can you show an example of what you are doing in 1.x and what that returns for 2.x?
> 
> Best
> Jan
> --
> 
>> On 7 Jan 2017, at 19:32, Robert Payne <ro...@me.com> wrote:
>> 
>> Hey All,
>> 
>> Would anyone still by chance have an idea on this? Or a adequate alternative that is performant?
>> 
>> Cheers,
>> Robert
>> 
>>> On 19/12/2016, at 5:07 PM, Robert Payne <ro...@me.com> wrote:
>>> 
>>> Hey All,
>>> 
>>> In CouchDB 1.x we used a view with the "local_seq" option and then used emitted _local_seq's to determine where to kick off a change feed starting point. If there any way to emit a cluster aware local seq in CouchDB 2.0? I can't seem to find any way to get the node/shard suffixed sequence when using a view.
>>> 
>>> Cheers,
>>> Robert
>> 
> 
> -- 
> Professional Support for Apache CouchDB:
> https://neighbourhood.ie/couchdb-support/
> 


Re: Cluster aware _local_seq in a view?

Posted by Jan Lehnardt <ja...@apache.org>.
I know we fixed this for _all_docs: https://issues.apache.org/jira/browse/COUCHDB-2849

Didn’t this make it into regular views as well?

Robert, can you show an example of what you are doing in 1.x and what that returns for 2.x?

Best
Jan
--

> On 7 Jan 2017, at 19:32, Robert Payne <ro...@me.com> wrote:
> 
> Hey All,
> 
> Would anyone still by chance have an idea on this? Or a adequate alternative that is performant?
> 
> Cheers,
> Robert
> 
>> On 19/12/2016, at 5:07 PM, Robert Payne <ro...@me.com> wrote:
>> 
>> Hey All,
>> 
>> In CouchDB 1.x we used a view with the "local_seq" option and then used emitted _local_seq's to determine where to kick off a change feed starting point. If there any way to emit a cluster aware local seq in CouchDB 2.0? I can't seem to find any way to get the node/shard suffixed sequence when using a view.
>> 
>> Cheers,
>> Robert
> 

-- 
Professional Support for Apache CouchDB:
https://neighbourhood.ie/couchdb-support/