From: Franz Fellner Date: Sun, 28 Feb 2016 14:26:05 +0000 (+0000) Subject: Re: need to call notmuch_threads_get (..) to actually move iterator X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=06ac184301e87c4572231c15eced37e605872037;p=notmuch-archives.git Re: need to call notmuch_threads_get (..) to actually move iterator --- diff --git a/28/659ae537481ae685f9e7f5bf5684b843dfcdb1 b/28/659ae537481ae685f9e7f5bf5684b843dfcdb1 new file mode 100644 index 000000000..14477d634 --- /dev/null +++ b/28/659ae537481ae685f9e7f5bf5684b843dfcdb1 @@ -0,0 +1,150 @@ +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 596C26DE1830 + for ; Sun, 28 Feb 2016 06:24:09 -0800 (PST) +X-Virus-Scanned: Debian amavisd-new at cworth.org +X-Spam-Flag: NO +X-Spam-Score: 0.875 +X-Spam-Level: +X-Spam-Status: No, score=0.875 tagged_above=-999 required=5 tests=[AWL=1.695, + 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 H8U0NVBAdwZS for ; + Sun, 28 Feb 2016 06:24:07 -0800 (PST) +Received: from mail-wm0-f42.google.com (mail-wm0-f42.google.com + [74.125.82.42]) by arlo.cworth.org (Postfix) with ESMTPS id A22A46DE17AE for + ; Sun, 28 Feb 2016 06:24:06 -0800 (PST) +Received: by mail-wm0-f42.google.com with SMTP id p65so15103737wmp.0 + for ; Sun, 28 Feb 2016 06:24:06 -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=/yX5NGSlt/WEibkuPr4nvun7SraXBSWzDpyRbKiugE8=; + b=zJO64/Y2+mS/I13cIV0HRuURgBXL/Fb97nfSBmy6jc+/BzBJda5vzp1M2JDI8dp/5z + ZIxiqAozWM1A4/jQ5mpoFcdLhcmMHhlEx7CIxKaDkz4M3yRTJ/615ch3gq7E6of227B/ + 3fhiD9RgV5429CHYtABvLt8IOYpKh/NHJQyvWKzCT5tFiQy2Zrdo6kM1u5YNuMhywpda + MbdD0xOHiVnjj6HmXKJtDZTKtb18hViH3bJOrtehTFAOt60SQsFQD0fHKb04+z5pbMvR + uH75a/PZHLZ4C4Wc2Um8F0ROhJI50L3SXY6nbmlcEyispQWORB2AXUS7iPPX85Ewku2v + dBLg== +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=/yX5NGSlt/WEibkuPr4nvun7SraXBSWzDpyRbKiugE8=; + b=CzTGewVA4Zuo5uf1lnK3a5WxzSoPK2ZadYEpWxNCHbfA1fuzTxqxZyUrloZ/zeyPYW + wd1ZKodg74yOSBrvwc9c3i6Ndrr49FIfqcOYebJQguVTG9RIXDkZ2S1pUeeG2w1HIulU + xynyFWFd8MMBlvSDx1K8jwG8PiLkMh7asq0jEfSJ7U5LWcC+6E/iJC3bZ/6m23tO5wOf + zl3HyClBJTp08lAPcLJgAMSif3usO+28sRy0rpC8XeG5X3W/QLbPeGmPBKfQLdxsU4zY + QZHjDhe4yA3wgddaaoh2se5wlcXhUHVvq1jIn7qbr877ZiaY1yhCQ/9nptN+ng6aBzuF + ujug== +X-Gm-Message-State: + AD7BkJIV9btjbTP1pAm0RAB1s21yu6udAflvwBxD5oRi6U+4EkM+zbeMWmGDToqiQp0QzQ== +X-Received: by 10.194.103.198 with SMTP id fy6mr12474621wjb.48.1456669444610; + Sun, 28 Feb 2016 06:24:04 -0800 (PST) +Received: from localhost (p579BA378.dip0.t-ipconnect.de. [87.155.163.120]) + by smtp.gmail.com with ESMTPSA id ka7sm21325925wjb.8.2016.02.28.06.24.03 + (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); + Sun, 28 Feb 2016 06:24:03 -0800 (PST) +Date: Sun, 28 Feb 2016 14:26:05 +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> +In-Reply-To: <1456315381-astroid-1-8aih8mdal8-11676@strange> +User-Agent: astroid/v0.5-61-gab5b649c (https://github.com/gauteh/astroid) +Message-Id: <1456669181-astroid-0-hsim583msj-27330@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:24:09 -0000 + +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. + +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 +=