From patchwork Thu Sep 2 05:30:21 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Carlo_Marcelo_Arenas_Bel=C3=B3n?= X-Patchwork-Id: 12470787 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 29C32C4320E for ; Thu, 2 Sep 2021 05:30:43 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 047D36069E for ; Thu, 2 Sep 2021 05:30:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231441AbhIBFbj (ORCPT ); Thu, 2 Sep 2021 01:31:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37926 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231340AbhIBFbi (ORCPT ); Thu, 2 Sep 2021 01:31:38 -0400 Received: from mail-qk1-x732.google.com (mail-qk1-x732.google.com [IPv6:2607:f8b0:4864:20::732]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F0664C061575 for ; Wed, 1 Sep 2021 22:30:40 -0700 (PDT) Received: by mail-qk1-x732.google.com with SMTP id t4so837474qkb.9 for ; Wed, 01 Sep 2021 22:30:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=3FitgPdtsGLxJA6zNl+jJSF9Hb/EJ1IUObFf5u+/e8E=; b=AlGkkBBAJfw5BW2I3IHC7vPkXAvJDfGhw+NBSEs3H6w7+OPEL6MIYUu/p6uyaa/6xm cRJzv7wpDiBsRrg9RLY9ljF8IuR9L1m0d/bZ0Qo/v+qsolW0s5wx3H/Q719+epk8YtEJ 01yop5AjXjVkjDqll5CniNLdN+z435flpLL7Ce23O0JfwCfXD5nr/PRIQCxnUu+spZuZ eQbFtZh/fFz5C4a9INSolIABlRejTtkfcx3MyLzUuR/UvbtRtmK94JrlS0tbgxZdKE+H tVhMW46GV/pc2D/wqwMmpGRKbXTsV/QaEgfSfhLedp7wFbXr2bVN/gfc6oR3ejzffU6X KFtw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=3FitgPdtsGLxJA6zNl+jJSF9Hb/EJ1IUObFf5u+/e8E=; b=iNwW9Vw79rwQEWo6QlrP1BjZrq0M11xjBZ2P6T4PVJ5pk7nUiLrh6WN1rYWDEL90mj 4YYkP3R8dlKFqO3H79HJQXCGYHvCxQCN0k6jepDQSklFsI39ht9SiKpKQA/0iivdKi2K sJevhDeFhCu1NIMW1GSh9zK1Bj07NhFv/f7AlFIzIRq/G7xz2BOAByduUQaWGR9ABZC2 OAfYOmMcL8b68a2Kyyr3fOrpsoAuoYQtFSH89nhjKPbhVEVsvCRX9Nq2QUnYX5FGtdKt MVM51EZLw2qpoRF+PrA3Hj/9CGmgHwnaBUulOza+oQbvF4cy04+SqGkoydfoky+7I0c9 kqlg== X-Gm-Message-State: AOAM531V2ZXnKi84OE5+MM/cTuqY1JjAjDyeqUXFs+wFi2+1NdQ30cYe 7PAAu97hNC0VbsdMc98M7P2a5sYwvpw= X-Google-Smtp-Source: ABdhPJzBwCrXoVjcZmPD96YmVrwacof72hPwpefSOfnFrDGN57843/Tzg9q+vKYOcFxWk8InIQCoxQ== X-Received: by 2002:a37:9947:: with SMTP id b68mr1614329qke.56.1630560639979; Wed, 01 Sep 2021 22:30:39 -0700 (PDT) Received: from carlos-mbp.lan (104-1-92-200.lightspeed.sntcca.sbcglobal.net. [104.1.92.200]) by smtp.gmail.com with ESMTPSA id w19sm669346qki.21.2021.09.01.22.30.39 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 01 Sep 2021 22:30:39 -0700 (PDT) From: =?utf-8?q?Carlo_Marcelo_Arenas_Bel=C3=B3n?= To: git@vger.kernel.org Cc: hanwen@google.com, =?utf-8?q?Carlo_Marcelo_Arenas_Bel=C3=B3n?= Subject: [PATCH 1/3] fixup! refs: RFC: Reftable support for git-core Date: Wed, 1 Sep 2021 22:30:21 -0700 Message-Id: <20210902053023.44006-2-carenas@gmail.com> X-Mailer: git-send-email 2.33.0.481.g26d3bed244 In-Reply-To: <20210902053023.44006-1-carenas@gmail.com> References: <20210902053023.44006-1-carenas@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org need to reorder the variables to hopefully make it easier to see why they might not be used since assert will compile out itself with -DNDEBUG. Signed-off-by: Carlo Marcelo Arenas Belón --- refs/reftable-backend.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/refs/reftable-backend.c b/refs/reftable-backend.c index 61ee144e19..5d733b0496 100644 --- a/refs/reftable-backend.c +++ b/refs/reftable-backend.c @@ -127,10 +127,11 @@ static void clear_reftable_log_record(struct reftable_log_record *log) static void fill_reftable_log_record(struct reftable_log_record *log) { - const char *info = git_committer_info(0); struct ident_split split = { NULL }; - int result = split_ident_line(&split, info, strlen(info)); int sign = 1; + MAYBE_UNUSED const char *info = git_committer_info(0); + MAYBE_UNUSED int result = split_ident_line(&split, info, strlen(info)); + assert(0 == result); reftable_log_record_release(log); From patchwork Thu Sep 2 05:30:22 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Carlo_Marcelo_Arenas_Bel=C3=B3n?= X-Patchwork-Id: 12470789 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B6259C432BE for ; Thu, 2 Sep 2021 05:30:43 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 962C8610C8 for ; Thu, 2 Sep 2021 05:30:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231580AbhIBFbk (ORCPT ); Thu, 2 Sep 2021 01:31:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37932 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231447AbhIBFbj (ORCPT ); Thu, 2 Sep 2021 01:31:39 -0400 Received: from mail-qk1-x731.google.com (mail-qk1-x731.google.com [IPv6:2607:f8b0:4864:20::731]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D66D7C061575 for ; Wed, 1 Sep 2021 22:30:41 -0700 (PDT) Received: by mail-qk1-x731.google.com with SMTP id m21so823247qkm.13 for ; Wed, 01 Sep 2021 22:30:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=VqMpyzp1e8ketJJzk4P/hQYOlr6YEoAQb8i8D3U+faM=; b=jwg3o9kysdTHjL9ACHqJnCGS8DZ/HYdLhwbMGtncYh6OdJ5SLhXFJcGcTrXWeVy1sc PjnjP/LQOXYrP+RQ41u52KO9LeTxx8Qil2GVXKImMIVi+OWszt3DRgy4cBUqneCnCyns SMhIX0IKLHV7k3T25zq8GcW6625dSJ05MhEst4npvC9UEumg73qgW5OQw/RzmmSRknxG K4M6kpSWI2Jv2wbcoN+7LlpjqyUI6IiAEzE+qtzGNFo3Pr1Wg57ihcgufT3VVBFdFNRj oMH5hOT6ebkygcjRjX65lFjD1KTrYYkdd/Nhb4d0EpdlTj52cw8q0brcL1Akx6fdl2PR YQSQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=VqMpyzp1e8ketJJzk4P/hQYOlr6YEoAQb8i8D3U+faM=; b=HHd6z2GQ1PhSSmQES8GJs488dDR1UtOMB1PEpmZdvfeVngKgAPNznneV84riAOS5iq Qo7wI+o4cYOCIjrSP1imEB0iQPQv0NcXPOpkACMLEqBBIxwWYNKBzAjC/4LIhiclkSmR 6/P7hYj7n5oIhpv8cODykp0WDhLr28cGM7/X773ecyT8lS+1eYvX45mTWTOk4Pc+g9Pe 1bEy1EgakUGkfNdQDbHkmbVopLwLTjxBJKUpPIeOV3ou5CMAIfTnU0Wn2fktv7QEEYzD ogK7GQOFkoc4R3u2nv4hXG2QMmb9LIw1NEwiIzNuZ1EUcolsVviPh0ShtmdZITGaNd/J niCA== X-Gm-Message-State: AOAM5311vyritEDkPXjaRz5WTO6go26yGGVtvN6eMaaSn63mUZbrzgSg IBeND4iJx4BD747QDHl9CJNBBznuiWg= X-Google-Smtp-Source: ABdhPJx74cyQs5hg/+Cca9RFKZMyRyVpbQMYGvoZ7lxKg4WwNds79vRuvj2rqcCy+TRH7Zn7c1F+qA== X-Received: by 2002:a05:620a:a93:: with SMTP id v19mr1573140qkg.185.1630560640885; Wed, 01 Sep 2021 22:30:40 -0700 (PDT) Received: from carlos-mbp.lan (104-1-92-200.lightspeed.sntcca.sbcglobal.net. [104.1.92.200]) by smtp.gmail.com with ESMTPSA id w19sm669346qki.21.2021.09.01.22.30.40 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 01 Sep 2021 22:30:40 -0700 (PDT) From: =?utf-8?q?Carlo_Marcelo_Arenas_Bel=C3=B3n?= To: git@vger.kernel.org Cc: hanwen@google.com, =?utf-8?q?Carlo_Marcelo_Arenas_Bel=C3=B3n?= Subject: [PATCH 2/3] fixup! reftable: add merged table view Date: Wed, 1 Sep 2021 22:30:22 -0700 Message-Id: <20210902053023.44006-3-carenas@gmail.com> X-Mailer: git-send-email 2.33.0.481.g26d3bed244 In-Reply-To: <20210902053023.44006-1-carenas@gmail.com> References: <20210902053023.44006-1-carenas@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Signed-off-by: Carlo Marcelo Arenas Belón --- Just like in the next patch, having relevant code in the assert might be a problem, but this is mostly test code and still passes. reftable/merged_test.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/reftable/merged_test.c b/reftable/merged_test.c index f58e44003e..b7be4dcf9f 100644 --- a/reftable/merged_test.c +++ b/reftable/merged_test.c @@ -47,8 +47,8 @@ static void write_test_table(struct strbuf *buf, reftable_writer_set_limits(w, min, max); for (i = 0; i < n; i++) { - uint64_t before = refs[i].update_index; - int n = reftable_writer_add_ref(w, &refs[i]); + MAYBE_UNUSED uint64_t before = refs[i].update_index; + MAYBE_UNUSED int n = reftable_writer_add_ref(w, &refs[i]); assert(n == 0); assert(before == refs[i].update_index); } @@ -181,7 +181,7 @@ static void test_merged(const char *fn_name) }, }; - struct reftable_ref_record want[] = { + MAYBE_UNUSED struct reftable_ref_record want[] = { r2[0], r1[1], r3[0], @@ -251,7 +251,7 @@ static void test_default_write_opts(const char *fn_name) int err; struct reftable_block_source source = { NULL }; struct reftable_table *tab = reftable_calloc(sizeof(*tab) * 1); - uint32_t hash_id; + MAYBE_UNUSED uint32_t hash_id; struct reftable_reader *rd = NULL; struct reftable_merged_table *merged = NULL; From patchwork Thu Sep 2 05:30:23 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Carlo_Marcelo_Arenas_Bel=C3=B3n?= X-Patchwork-Id: 12470791 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id DF3D3C432BE for ; Thu, 2 Sep 2021 05:30:45 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C88A6610CD for ; Thu, 2 Sep 2021 05:30:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231690AbhIBFbl (ORCPT ); Thu, 2 Sep 2021 01:31:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37936 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231543AbhIBFbk (ORCPT ); Thu, 2 Sep 2021 01:31:40 -0400 Received: from mail-qk1-x72d.google.com (mail-qk1-x72d.google.com [IPv6:2607:f8b0:4864:20::72d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B63CEC061575 for ; Wed, 1 Sep 2021 22:30:42 -0700 (PDT) Received: by mail-qk1-x72d.google.com with SMTP id y144so850157qkb.6 for ; Wed, 01 Sep 2021 22:30:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=V268iyFrYtUB0QwIqalAv/f2HLrPnddP0T80Vlbtx/g=; b=gzXJxgOqM3U3T5JzmT0hTjeGA55EAejeDR4qH4AbvgtibiaiMTcIRztLf7QFUThwNJ 1vvCT7IMwUDllcvcablVNOdbfU1+JlLzM5bmVWQacMfU7gqAYTqPArBW4ywpAWEGtgUC 6dCrjff1jKGtjY3cgjV7PX/65AH5SZ70WZM1KZrOs2Yl+4JMQwyiVjjkV/B6ibz7Wp5j mmMWf356hSIhuZ+seDyrudEYPDXo8DQ9tXVkIsoyWM1pktVtLCcNeNO4xYKVhVPKWV1o 1RkOd5RxSOSJF23PVpvHEzSs/GQTZbDZQ/pX8eMgrABzUfZ4i/puAdl5FxP/3K/a225l zeJA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=V268iyFrYtUB0QwIqalAv/f2HLrPnddP0T80Vlbtx/g=; b=p5ehFQETaBIWLqjZRSKnF7fOJ9fvalzl6DQpeNuf96tDZvDiYfaN48/Cky/xzQaz2e A+dJYKYPFzAr5mjzQ2HhHEuDTsD6WZgftg18B3QqB2qg92ANKDQPa/b6Pyn3fYFhyNrY WbnrRd5xtsttdBSdVBK7PwHK3hlysrZshS25EkNVeTcTt9ZIU9yhnvdZmgMXrVfMHdj8 dvqfiEJ/xCKDY86RU8gPLqZ61oU5i5bEwHQwL1gPxCwF8tc4UgBAjdJT03CuKZiB8NDc Zm8j0aRStedGR2WMNunMbpx/tLjXkcQYthPH/yDRaRvXMO+Lb56K5rhcd0icrAI6W4r2 UWwg== X-Gm-Message-State: AOAM53050E4uI2MlfIDxDRsTA1te9WhW2hOe2OZrIggp8k3gvSzgWDfo s3I/FZE7UCFhQ/MOfFTcCsJh6vg2iMo= X-Google-Smtp-Source: ABdhPJyYYvLPc4i0WIeDb0iIMv64ppPO8vnAjHHOqCSf+6S2jjUL4rpTZgwzdlaYmvBdw3ifXzG7TA== X-Received: by 2002:a05:620a:13cb:: with SMTP id g11mr1559731qkl.332.1630560641793; Wed, 01 Sep 2021 22:30:41 -0700 (PDT) Received: from carlos-mbp.lan (104-1-92-200.lightspeed.sntcca.sbcglobal.net. [104.1.92.200]) by smtp.gmail.com with ESMTPSA id w19sm669346qki.21.2021.09.01.22.30.41 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 01 Sep 2021 22:30:41 -0700 (PDT) From: =?utf-8?q?Carlo_Marcelo_Arenas_Bel=C3=B3n?= To: git@vger.kernel.org Cc: hanwen@google.com, =?utf-8?q?Carlo_Marcelo_Arenas_Bel=C3=B3n?= Subject: [PATCH 3/3] fixup! reftable: add a heap-based priority queue for reftable records Date: Wed, 1 Sep 2021 22:30:23 -0700 Message-Id: <20210902053023.44006-4-carenas@gmail.com> X-Mailer: git-send-email 2.33.0.481.g26d3bed244 In-Reply-To: <20210902053023.44006-1-carenas@gmail.com> References: <20210902053023.44006-1-carenas@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org not a very useful option, but the fact the main logic is done inside and assert that then gets compiled out when -DNDEBUG might be worth reconsidering. Signed-off-by: Carlo Marcelo Arenas Belón --- reftable/pq.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/reftable/pq.c b/reftable/pq.c index 8918d158e2..a6acca006b 100644 --- a/reftable/pq.c +++ b/reftable/pq.c @@ -43,12 +43,14 @@ int merged_iter_pqueue_is_empty(struct merged_iter_pqueue pq) void merged_iter_pqueue_check(struct merged_iter_pqueue pq) { +#ifndef NDEBUG int i = 0; for (i = 1; i < pq.len; i++) { int parent = (i - 1) / 2; assert(pq_less(pq.heap[parent], pq.heap[i])); } +#endif } struct pq_entry merged_iter_pqueue_remove(struct merged_iter_pqueue *pq)