Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 162F2200D69 for ; Wed, 27 Dec 2017 19:58:36 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id 14766160C23; Wed, 27 Dec 2017 18:58:36 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 59AB7160C10 for ; Wed, 27 Dec 2017 19:58:35 +0100 (CET) Received: (qmail 31391 invoked by uid 500); 27 Dec 2017 18:58:29 -0000 Mailing-List: contact user-help@couchdb.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@couchdb.apache.org Delivered-To: mailing list user@couchdb.apache.org Received: (qmail 31379 invoked by uid 99); 27 Dec 2017 18:58:29 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd1-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 27 Dec 2017 18:58:29 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd1-us-west.apache.org (ASF Mail Server at spamd1-us-west.apache.org) with ESMTP id AA2D1C54C6 for ; Wed, 27 Dec 2017 18:58:28 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd1-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 1.879 X-Spam-Level: * X-Spam-Status: No, score=1.879 tagged_above=-999 required=6.31 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HTML_MESSAGE=2, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_PASS=-0.001] autolearn=disabled Authentication-Results: spamd1-us-west.apache.org (amavisd-new); dkim=pass (2048-bit key) header.d=googlemail.com Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd1-us-west.apache.org [10.40.0.7]) (amavisd-new, port 10024) with ESMTP id eu5yOphyh0MH for ; Wed, 27 Dec 2017 18:58:26 +0000 (UTC) Received: from mail-ot0-f175.google.com (mail-ot0-f175.google.com [74.125.82.175]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with ESMTPS id F10595F3BC for ; Wed, 27 Dec 2017 18:58:25 +0000 (UTC) Received: by mail-ot0-f175.google.com with SMTP id h9so33887372oti.0 for ; Wed, 27 Dec 2017 10:58:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to; bh=ywzy1igxpqIrKg8UEX0tT64gYN0+Xm0T7/qNEhJXdXI=; b=JE5+08oWKlLkMkjzBLBNCCfTXho2Ez0jcPL7pnMuGu8eUDHF2LcCppqsqAkvRo65Ty wY42suMFG/y4zwFKmP8fubNJvaAS0YSJt1J9lUys4HQ58xGSuLwHlGtS+j1avu44zxGk KLVqo0f0BTgWqLWya35w5KohXB/+NPA2BXrlDql7oirEzbv0A3CT6Y+QbKEdnjso2e4P xt+HCuoeQeJPlN0XaUD/yAnL2ue3tcOaS8Bzvd7AmJy++gMW8Mgtt74g9bEoijusdaqk 90YZa2ZWIs/PVfsdy5GCpFSZVNp4QEaZLAsl7R/0buoiiKr9Zp51/YrPe/NgiLliUkxV qaUw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to; bh=ywzy1igxpqIrKg8UEX0tT64gYN0+Xm0T7/qNEhJXdXI=; b=Jef6xNAYE6AGISQATuNbmEjCslRlIlXJgy+SCTVUZdrCM/r19zjEXPfwG5ftIFpYIy rB4LPCoK5FgOI43gLps17zfL6mcq2JE26t5Zvj6jRkNuONjMWEmvza/TY0UGhtncD4ns YkO5c2ZQn0NDPKOFp22nF8LncvVlX0JWm/vaW/VUqbGGA7bYy290tDm/uV1kSDpaZfLw 1ttdenAhwPkw+233D+rg8ne+OShz75yCJs2T/6/LemCbL8vxU+dk2mvSYUHqgkCfrvLN e04uWatXf92VNL38BROplC80cKsvWjFetVPpGUZIg7ToqQn9JRRIALlvMrKk/Zz/IeUg CRIw== X-Gm-Message-State: AKGB3mJyP4t/wBZeM6r4tMzPbgi3b6+eYe+3IWjJMK0zi4hX2TMJsCOq zhdXeD7mHiIXVrmsM7Sp4syLRSybVRvc9FoxFuqvXg== X-Google-Smtp-Source: ACJfBosPit9oN0mjs15HEZD0gOkAHIWbP7LgVYY9DL3Cn0HNuAd7ge+hUqzc/V869VfRfJQslpMsLBu9DCVOShnBrxM= X-Received: by 10.157.47.219 with SMTP id b27mr23871785otd.214.1514401099186; Wed, 27 Dec 2017 10:58:19 -0800 (PST) MIME-Version: 1.0 Received: by 10.74.175.77 with HTTP; Wed, 27 Dec 2017 10:58:18 -0800 (PST) In-Reply-To: References: From: Sebastian Rothbucher Date: Wed, 27 Dec 2017 19:58:18 +0100 Message-ID: Subject: Re: strange issue with _changes result ordering To: user@couchdb.apache.org Content-Type: multipart/alternative; boundary="001a113ce1a8908944056156fbdd" archived-at: Wed, 27 Dec 2017 18:58:36 -0000 --001a113ce1a8908944056156fbdd Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hi Damjan, thanks for reaching out - and yes, there is an explanation for this thing - e.g. here https://blog.couchdb.org/2016/08/01/couchdb-2-0-architecture/ and here https://blog.couchdb.org/2016/08/17/migrating-to-couchdb-2-0/ (search for 'changes'). Long story short: as CouchDB is clustered by default, it does its best to consolidate from several shards which might cause the shuffle you experience. Esp. for documents with close timestamps. Ad-hoc, I'm not sure about the docs right now. But as you stumbled: can you open an issue or PR for the doc page in question, that would really help a lot... Hope I help a little as well - all the best. Otherwise feel free to reach out again Sebastian On Wed, Dec 27, 2017 at 1:46 PM, Damjan Georgievski wrote: > Running a single node CouchDB 2.1.1 > > Reading: http://docs.couchdb.org/en/2.1.1/api/database/changes.html it > says > > =C2=BB > Returns a sorted list of changes made to documents in the database, in ti= me > order of application, can be obtained from the database=E2=80=99s _change= s > resource. > =C2=AB > > I have an irc bot that adds a couchdb document with a timestamp for each > message it sees (and also there are no updates to any documents). > > I also have a web page that longpolls the _changes url. things work out > well enough in a normal situation when the changes feed only returns a > single document (irc is not that heavy traffic), but if I get more than o= ne > result in the changes feed they don't come ordered by insertion time > > Actually that can be seen with this query too: > > curl ' > https://irc.softver.org.mk/api/_changes?feed=3Dlongpoll& > heartbeat=3D30000&include_docs=3Dtrue&filter=3Dlog%2Fchannel& > channel=3Dlugola&since=3D719335-g1AAAAFreJzLYWBg4MhgTmEQTM4vTc > 5ISXIwNDLXMwBCwxygFFMeC5BkWACk_v__vz8riYExvpmg8gcQ5f9ByhO2EFR- > AKL8Pkh53Ao8ypMSgGRSPdTk-I34lDqAlMZDlcYWEnREA8QR88FuVsG > jPJEhSR5qbFwGPhcogFxgD3NsVBYAEpxlew' > | jq '.results[].doc.timestamp' > > Timestamps vary widely: > > 1514374352.9027328 > 1514356816.2731326 > 1514373751.1156774 > 1514373763.0645776 > 1514373727.7714481 > 1514375011.2094588 > 1514375223.591063 > 1514370254.6656752 > 1514375022.4995384 > 1514370272.3448327 > > > Is this intentional behaviour and the docs are wrong? > > -- > damjan > --001a113ce1a8908944056156fbdd--