Re: need to call notmuch_threads_get (..) to actually move iterator
authorFranz Fellner <alpine.art.de@gmail.com>
Sun, 28 Feb 2016 14:26:05 +0000 (14:26 +0000)
committerW. Trevor King <wking@tremily.us>
Sat, 20 Aug 2016 23:21:12 +0000 (16:21 -0700)
28/659ae537481ae685f9e7f5bf5684b843dfcdb1 [new file with mode: 0644]

diff --git a/28/659ae537481ae685f9e7f5bf5684b843dfcdb1 b/28/659ae537481ae685f9e7f5bf5684b843dfcdb1
new file mode 100644 (file)
index 0000000..14477d6
--- /dev/null
@@ -0,0 +1,150 @@
+Return-Path: <alpine.art.de@gmail.com>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+ by arlo.cworth.org (Postfix) with ESMTP id 596C26DE1830\r
+ for <notmuch@notmuchmail.org>; Sun, 28 Feb 2016 06:24:09 -0800 (PST)\r
+X-Virus-Scanned: Debian amavisd-new at cworth.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: 0.875\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=0.875 tagged_above=-999 required=5 tests=[AWL=1.695, \r
+ DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,\r
+ FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=-0.01,\r
+ RCVD_IN_MSPIKE_WL=-0.01, SPF_PASS=-0.001] autolearn=disabled\r
+Received: from arlo.cworth.org ([127.0.0.1])\r
+ by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024)\r
+ with ESMTP id H8U0NVBAdwZS for <notmuch@notmuchmail.org>;\r
+ Sun, 28 Feb 2016 06:24:07 -0800 (PST)\r
+Received: from mail-wm0-f42.google.com (mail-wm0-f42.google.com\r
+ [74.125.82.42]) by arlo.cworth.org (Postfix) with ESMTPS id A22A46DE17AE for\r
+ <notmuch@notmuchmail.org>; Sun, 28 Feb 2016 06:24:06 -0800 (PST)\r
+Received: by mail-wm0-f42.google.com with SMTP id p65so15103737wmp.0\r
+ for <notmuch@notmuchmail.org>; Sun, 28 Feb 2016 06:24:06 -0800 (PST)\r
+DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;\r
+ h=date:from:subject:to:references:in-reply-to:user-agent:message-id\r
+ :mime-version:content-transfer-encoding;\r
+ bh=/yX5NGSlt/WEibkuPr4nvun7SraXBSWzDpyRbKiugE8=;\r
+ b=zJO64/Y2+mS/I13cIV0HRuURgBXL/Fb97nfSBmy6jc+/BzBJda5vzp1M2JDI8dp/5z\r
+ ZIxiqAozWM1A4/jQ5mpoFcdLhcmMHhlEx7CIxKaDkz4M3yRTJ/615ch3gq7E6of227B/\r
+ 3fhiD9RgV5429CHYtABvLt8IOYpKh/NHJQyvWKzCT5tFiQy2Zrdo6kM1u5YNuMhywpda\r
+ MbdD0xOHiVnjj6HmXKJtDZTKtb18hViH3bJOrtehTFAOt60SQsFQD0fHKb04+z5pbMvR\r
+ uH75a/PZHLZ4C4Wc2Um8F0ROhJI50L3SXY6nbmlcEyispQWORB2AXUS7iPPX85Ewku2v\r
+ dBLg==\r
+X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;\r
+ d=1e100.net; s=20130820;\r
+ h=x-gm-message-state:date:from:subject:to:references:in-reply-to\r
+ :user-agent:message-id:mime-version:content-transfer-encoding;\r
+ bh=/yX5NGSlt/WEibkuPr4nvun7SraXBSWzDpyRbKiugE8=;\r
+ b=CzTGewVA4Zuo5uf1lnK3a5WxzSoPK2ZadYEpWxNCHbfA1fuzTxqxZyUrloZ/zeyPYW\r
+ wd1ZKodg74yOSBrvwc9c3i6Ndrr49FIfqcOYebJQguVTG9RIXDkZ2S1pUeeG2w1HIulU\r
+ xynyFWFd8MMBlvSDx1K8jwG8PiLkMh7asq0jEfSJ7U5LWcC+6E/iJC3bZ/6m23tO5wOf\r
+ zl3HyClBJTp08lAPcLJgAMSif3usO+28sRy0rpC8XeG5X3W/QLbPeGmPBKfQLdxsU4zY\r
+ QZHjDhe4yA3wgddaaoh2se5wlcXhUHVvq1jIn7qbr877ZiaY1yhCQ/9nptN+ng6aBzuF\r
+ ujug==\r
+X-Gm-Message-State:\r
+ AD7BkJIV9btjbTP1pAm0RAB1s21yu6udAflvwBxD5oRi6U+4EkM+zbeMWmGDToqiQp0QzQ==\r
+X-Received: by 10.194.103.198 with SMTP id fy6mr12474621wjb.48.1456669444610; \r
+ Sun, 28 Feb 2016 06:24:04 -0800 (PST)\r
+Received: from localhost (p579BA378.dip0.t-ipconnect.de. [87.155.163.120])\r
+ by smtp.gmail.com with ESMTPSA id ka7sm21325925wjb.8.2016.02.28.06.24.03\r
+ (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);\r
+ Sun, 28 Feb 2016 06:24:03 -0800 (PST)\r
+Date: Sun, 28 Feb 2016 14:26:05 +0000\r
+From: Franz Fellner <alpine.art.de@gmail.com>\r
+Subject: Re: need to call notmuch_threads_get (..) to actually move iterator\r
+To: Gaute Hope <eg@gaute.vetsj.com>, notmuch@notmuchmail.org\r
+References: <1456315381-astroid-1-8aih8mdal8-11676@strange>\r
+In-Reply-To: <1456315381-astroid-1-8aih8mdal8-11676@strange>\r
+User-Agent: astroid/v0.5-61-gab5b649c (https://github.com/gauteh/astroid)\r
+Message-Id: <1456669181-astroid-0-hsim583msj-27330@TP_L520>\r
+MIME-Version: 1.0\r
+Content-Type: text/plain; charset=utf-8; format=flowed\r
+Content-Transfer-Encoding: quoted-printable\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.20\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+ <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <https://notmuchmail.org/mailman/options/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch/>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <https://notmuchmail.org/mailman/listinfo/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Sun, 28 Feb 2016 14:24:09 -0000\r
+\r
+It might be I found the issue:\r
+One big thing notmuch_threads_get does is remove the thread_id from the\r
+match_set. Playing with astroid (branch ti-skip-and-load) i see that it\r
+is not entirely true that the iterator doesn't move. It just seems to\r
+duplicate some messages. There definitely are coming new messages.\r
+So my explanation is that match_set contains duplicate thread_ids. If\r
+that is true a solution to Gautes problem might be to deduplicate the\r
+match_set.\r
+\r
+Excerpts from Gaute Hope's message of Februar 24, 2016 1:08 :\r
+> Hi,\r
+>=20\r
+> it seems to be necessary to actually call notmuch_threads_get (threads)\r
+> to move the thread iterator from a query object, just calling\r
+> notmuch_threads_move_to_next (..) is not enough:\r
+>=20\r
+> ```\r
+>=20\r
+> notmuch_query_t *query;\r
+> notmuch_threads_t *threads;\r
+> notmuch_thread_t *thread;\r
+>=20\r
+> query =3D notmuch_query_create (database, query_string);\r
+> threads =3D notmuch_query_search_threads (query);\r
+>=20\r
+> int i =3D 0;\r
+>=20\r
+> for (;\r
+>      notmuch_threads_valid (threads);\r
+>      notmuch_threads_move_to_next (threads))\r
+> {\r
+>     /*\r
+>      * with this line commented out the iterator seems to remain in\r
+>      * place, and if I below do another loop it will start from the\r
+>      * beginning.\r
+>=20\r
+>     thread =3D notmuch_threads_get (threads);\r
+>     ....\r
+>     notmuch_thread_destroy (thread);\r
+>     */\r
+>=20\r
+>     i++;\r
+>     if (i > 100) break;\r
+> }\r
+>=20\r
+> for (;\r
+>      notmuch_threads_valid (threads);\r
+>      notmuch_threads_move_to_next (threads))\r
+> {\r
+>     /* the thread acquired here will be the first thread in the query.\r
+>      * it should be the 101th. */\r
+>=20\r
+>     thread =3D notmuch_threads_get (threads);\r
+>     ....\r
+>     notmuch_thread_destroy (thread);\r
+>=20\r
+> }\r
+>=20\r
+>=20\r
+> notmuch_query_destroy (query);\r
+> ```\r
+>=20\r
+> It is quite slow to skip the threads in this way, might it be faster if\r
+> move_to_next works correctly?\r
+>=20\r
+> Regards, Gaute\r
+>=20\r
+> _______________________________________________\r
+> notmuch mailing list\r
+> notmuch@notmuchmail.org\r
+> https://notmuchmail.org/mailman/listinfo/notmuch\r
+>=20\r
+=\r