From 699b7f74da8873d30fc21c9eedcc41c424368c49 Mon Sep 17 00:00:00 2001 From: Franz Fellner Date: Sun, 28 Feb 2016 14:46:07 +0000 Subject: [PATCH] Re: need to call notmuch_threads_get (..) to actually move iterator --- 7a/655cced8d1fd606429df2365ead60f38964a12 | 159 ++++++++++++++++++++++ 1 file changed, 159 insertions(+) create mode 100644 7a/655cced8d1fd606429df2365ead60f38964a12 diff --git a/7a/655cced8d1fd606429df2365ead60f38964a12 b/7a/655cced8d1fd606429df2365ead60f38964a12 new file mode 100644 index 000000000..c5d18b0b6 --- /dev/null +++ b/7a/655cced8d1fd606429df2365ead60f38964a12 @@ -0,0 +1,159 @@ +Return-Path: +X-Original-To: notmuch@notmuchmail.org +Delivered-To: notmuch@notmuchmail.org +Received: from localhost (localhost [127.0.0.1]) + by arlo.cworth.org (Postfix) with ESMTP id 90A6C6DE0FFA + for ; Sun, 28 Feb 2016 06:44:10 -0800 (PST) +X-Virus-Scanned: Debian amavisd-new at cworth.org +X-Spam-Flag: NO +X-Spam-Score: -0.319 +X-Spam-Level: +X-Spam-Status: No, score=-0.319 tagged_above=-999 required=5 tests=[AWL=0.501, + DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, FREEMAIL_FROM=0.001, + RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, + SPF_PASS=-0.001] autolearn=disabled +Received: from arlo.cworth.org ([127.0.0.1]) + by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024) + with ESMTP id offpM1yQcsfH for ; + Sun, 28 Feb 2016 06:44:08 -0800 (PST) +Received: from mail-wm0-f47.google.com (mail-wm0-f47.google.com + [74.125.82.47]) by arlo.cworth.org (Postfix) with ESMTPS id 354B06DE0B20 for + ; Sun, 28 Feb 2016 06:44:08 -0800 (PST) +Received: by mail-wm0-f47.google.com with SMTP id n186so16537959wmn.1 + for ; Sun, 28 Feb 2016 06:44:08 -0800 (PST) +DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; + h=date:from:subject:to:references:in-reply-to:user-agent:message-id + :mime-version:content-transfer-encoding; + bh=XwNp+IW7Vd4xC1LLCOORv4oX0BQ59BQnqVFefUiiUTo=; + b=0giU7M0XIILQftCPQR3ed6RRO155TGAmRNxBvJh8M+zG7+o184BQNpsTHCM608BSK3 + YaC+P3gOGC5K46+ObWoJMO2FT/GiNaF9/jMr8XHBC3o6n6eDBDRtmJmpElMpZiVSv1/x + YDqlvRi/8UNyUrYfPlixGol7njGjDyBiM3jRhG5TJoK0lbjTAejgt7vduYO9c2zFen9P + BxtqXqUsvWOTiMHYCYDu9nq+bhIIKxm1yT0lzqxwdRzDZdPcOsEOl9uvqVjTgPbQzrug + TVtCGCDjmcAA1VhWdu1/5ZMaYTACA1bdxaF34GS86bij6l63RqTj2/b2rPjtjUDbp9hR + cDug== +X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; + d=1e100.net; s=20130820; + h=x-gm-message-state:date:from:subject:to:references:in-reply-to + :user-agent:message-id:mime-version:content-transfer-encoding; + bh=XwNp+IW7Vd4xC1LLCOORv4oX0BQ59BQnqVFefUiiUTo=; + b=Qbz8bewjBLxWtsrDY6NHvQgZYLsv1hIE7ws+nOsnRMX+asCbNpegDfSPOtwlp41Tjm + LqRvWGB5JW3saI3W6UccGXsz8d8qMb17b6vSNnDYvS6TG8RHcgfguLffTB5A1HgFFOYx + QYuwCEJ3OfySyh7QH95h5ZguE8OnaItBRatNoPpQs6SvB4eNkcUK543LcRTB17b3ZrSL + lFz1Ng3yamlNEQ/jYEHLqIlUCVwZbw1VRMsDBG6XJzNCx7uN9nf7hV2w2QXa5p84GK5+ + rUIDqnOrwEnnLtyXemxfK4iCEjGt/QIJ1zZqCjwJ+tk9hUvyzfnUJqQBoy+UBtVZ/tDy + MThg== +X-Gm-Message-State: + AD7BkJIc5gqe2cr2tEyIVXtrm5I1IgSnmsWbItyzcjA9pHS4B7NysSq2HDBxssmzSgoSgQ== +X-Received: by 10.194.95.40 with SMTP id dh8mr11754928wjb.146.1456670646839; + Sun, 28 Feb 2016 06:44:06 -0800 (PST) +Received: from localhost (p579BA378.dip0.t-ipconnect.de. [87.155.163.120]) + by smtp.gmail.com with ESMTPSA id k8sm21448021wjr.38.2016.02.28.06.44.05 + (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); + Sun, 28 Feb 2016 06:44:05 -0800 (PST) +Date: Sun, 28 Feb 2016 14:46:07 +0000 +From: Franz Fellner +Subject: Re: need to call notmuch_threads_get (..) to actually move iterator +To: Gaute Hope , notmuch@notmuchmail.org +References: <1456315381-astroid-1-8aih8mdal8-11676@strange> + <1456669181-astroid-0-hsim583msj-27330@TP_L520> +In-Reply-To: <1456669181-astroid-0-hsim583msj-27330@TP_L520> +User-Agent: astroid/v0.5-61-gab5b649c (https://github.com/gauteh/astroid) +Message-Id: <1456670385-astroid-0-hgj454pqy2-29417@TP_L520> +MIME-Version: 1.0 +Content-Type: text/plain; charset=utf-8; format=flowed +Content-Transfer-Encoding: quoted-printable +X-BeenThere: notmuch@notmuchmail.org +X-Mailman-Version: 2.1.20 +Precedence: list +List-Id: "Use and development of the notmuch mail system." + +List-Unsubscribe: , + +List-Archive: +List-Post: +List-Help: +List-Subscribe: , + +X-List-Received-Date: Sun, 28 Feb 2016 14:44:10 -0000 + +Really might be the issue: Threads with many messages duplicate more +often than messages with few messages. Threads with only one message +never seem to come up more than twice. +Currently I don't have the time to track down what actually get's stored +in match_set, would be nice if a dev could shed some light on it. Thx! + +Excerpts from Franz Fellner's message of Februar 28, 2016 3:26 : +> It might be I found the issue: +> One big thing notmuch_threads_get does is remove the thread_id from the +> match_set. Playing with astroid (branch ti-skip-and-load) i see that it +> is not entirely true that the iterator doesn't move. It just seems to +> duplicate some messages. There definitely are coming new messages. +> So my explanation is that match_set contains duplicate thread_ids. If +> that is true a solution to Gautes problem might be to deduplicate the +> match_set. +>=20 +> Excerpts from Gaute Hope's message of Februar 24, 2016 1:08 : +>> Hi, +>>=20 +>> it seems to be necessary to actually call notmuch_threads_get (threads) +>> to move the thread iterator from a query object, just calling +>> notmuch_threads_move_to_next (..) is not enough: +>>=20 +>> ``` +>>=20 +>> notmuch_query_t *query; +>> notmuch_threads_t *threads; +>> notmuch_thread_t *thread; +>>=20 +>> query =3D notmuch_query_create (database, query_string); +>> threads =3D notmuch_query_search_threads (query); +>>=20 +>> int i =3D 0; +>>=20 +>> for (; +>> notmuch_threads_valid (threads); +>> notmuch_threads_move_to_next (threads)) +>> { +>> /* +>> * with this line commented out the iterator seems to remain in +>> * place, and if I below do another loop it will start from the +>> * beginning. +>>=20 +>> thread =3D notmuch_threads_get (threads); +>> .... +>> notmuch_thread_destroy (thread); +>> */ +>>=20 +>> i++; +>> if (i > 100) break; +>> } +>>=20 +>> for (; +>> notmuch_threads_valid (threads); +>> notmuch_threads_move_to_next (threads)) +>> { +>> /* the thread acquired here will be the first thread in the query. +>> * it should be the 101th. */ +>>=20 +>> thread =3D notmuch_threads_get (threads); +>> .... +>> notmuch_thread_destroy (thread); +>>=20 +>> } +>>=20 +>>=20 +>> notmuch_query_destroy (query); +>> ``` +>>=20 +>> It is quite slow to skip the threads in this way, might it be faster if +>> move_to_next works correctly? +>>=20 +>> Regards, Gaute +>>=20 +>> _______________________________________________ +>> notmuch mailing list +>> notmuch@notmuchmail.org +>> https://notmuchmail.org/mailman/listinfo/notmuch +>>=20 +>=20 += -- 2.26.2