Re: [imapext] CONDSTORE interaction with SORT/THREAD

Jan Kundrát <jkt@flaska.net> Mon, 12 August 2013 13:39 UTC

Return-Path: <jkt@flaska.net>
X-Original-To: imapext@ietfa.amsl.com
Delivered-To: imapext@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 2156821F9AD6 for <imapext@ietfa.amsl.com>; Mon, 12 Aug 2013 06:39:28 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -0.904
X-Spam-Level:
X-Spam-Status: No, score=-0.904 tagged_above=-999 required=5 tests=[BAYES_00=-2.599, MIME_8BIT_HEADER=0.3, MIME_QP_LONG_LINE=1.396, NO_RELAYS=-0.001]
Received: from mail.ietf.org ([12.22.58.30]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id PZ2eFBQ0v+cr for <imapext@ietfa.amsl.com>; Mon, 12 Aug 2013 06:39:27 -0700 (PDT)
Received: from latimerie.flaska.net (latimerie.flaska.net [IPv6:2a02:2b88:2:1::4a7:333]) by ietfa.amsl.com (Postfix) with ESMTP id ACFD511E8105 for <imapext@ietf.org>; Mon, 12 Aug 2013 06:32:24 -0700 (PDT)
Received: by latimerie.flaska.net (Postfix, from userid 1000) id 492F2607B1; Mon, 12 Aug 2013 15:32:22 +0200 (CEST)
From: Jan Kundrát <jkt@flaska.net>
To: imapext@ietf.org
Date: Mon, 12 Aug 2013 15:32:17 +0200
User-Agent: trojita/v0.3.93-263-g97e42ff; Qt/4.8.4; X11; Linux;
MIME-Version: 1.0
Message-ID: <7bad458f-e05d-4df1-bbed-47190b8dbd16@flaska.net>
In-Reply-To: <5208CD61.3070100@isode.com>
References: <5208CD61.3070100@isode.com>
Content-Type: text/plain; charset="utf-8"; format="flowed"
Content-Transfer-Encoding: quoted-printable
Subject: Re: [imapext] CONDSTORE interaction with SORT/THREAD
X-BeenThere: imapext@ietf.org
X-Mailman-Version: 2.1.12
Precedence: list
List-Id: Discussion of IMAP extensions <imapext.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/imapext>, <mailto:imapext-request@ietf.org?subject=unsubscribe>
List-Archive: <http://www.ietf.org/mail-archive/web/imapext>
List-Post: <mailto:imapext@ietf.org>
List-Help: <mailto:imapext-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/imapext>, <mailto:imapext-request@ietf.org?subject=subscribe>
X-List-Received-Date: Mon, 12 Aug 2013 13:39:28 -0000

On Monday, 12 August 2013 13:56:17 CEST, Alexey Melnikov wrote:
> 1). Use ESEARCH response (RFC 4731) to return MODSEQ for all 
> matching messages and also extend it to return sorted results. 
> (This can be potentially be used for SEARCH with MODSEQ search 
> criterion as well). For example:
>
>   * ESEARCH (TAG "A001") SORTED 3,4,1,2 MODSEQ 175

I've just re-read the relevant bits of RFC 4551 again. I have to admit I do 
not understand the point of including the highest MODSEQ of the matching 
messages under the MODSEQ key -- what is the use case for that? Sure, it's 
in the RFC so we cannot change it now, but I'd like to understand the 
motivation behind this.

> Here SORTED is similar to ALL, but it preserves the SORT order 
> of matching messages.
> RFC 4731 already defines MODSEQ return item.

Unless I'm missing something, the example response invents a non-existant 
"SORTED" ESEARCH return value. RFC 5267 (CONTEXT=...) already defines the 
ESORT extension and the ESORT command and how it uses the ESEARCH response 
(some servers were broken and used to return an ESORT response, btw). The 
result is passed as if it was triggered via the ESEARCH command, only in a 
sorted form, so the correct return data are, IMHO:

* ESEARCH (TAG "A001") ALL 3,4,1,2 MODSEQ 175

I'm also confused because the command asked for MODSEQ >= 500, but the 
response claims that the highest MODSEQ of any matching messages is 175.

> 2). Extend SORT response in the same way CONDSTORE extended SEARCH 
response:
>
>   * SORT 5 3 4 1 2 (MODSEQ 175)

That would require a modification of the ABNF and as such it cannot be 
introduced retroacitvely, right?

> 3). Return 2 response: an ESEARCH with MODSEQ and a SORT:
>
>   * SORT 5 3 4 1 2
>   * ESEARCH (TAG "A001") MODSEQ 175

I realize this is about SORT, not SEARCH, but RFC 4466, section 2.6.1 
contains a SHOULD saying that there should only be a SEARCH *or* an ESEARCH 
response, not both.

> I personally have a slight preference for choices #3/#1, as I 
> don't want to prolifirate new variants of responses which are 
> not ESEARCH based.

Indeed, and for the reasons stated above, I prefer 1) after it's fixed to 
use ALL instead of SORTED.

> 1). Use ESEARCH response (RFC 4731) to return MODSEQ for all 
> matching messages and also extend it to return threaded results. 
> For example:
>
>   * ESEARCH (TAG "A002") THREAD ((2)(3 6 (4 23)(44 7 96))) MODSEQ 
909240921

I would love to have the THREAD return option for ESEARCH; in fact, I've 
tried to introduce it in draft-kundrat-incthread [1]. It will help Trojita 
understand the matching between commands and responses and therefore enable 
better pipelining.

With kind regards,
Jan

[1] http://tools.ietf.org/html/draft-kundrat-incthread-01#section-2.3.1