Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pKadw-0006wW-9F for pgsql-hackers@arkaria.postgresql.org; Wed, 25 Jan 2023 07:56:28 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1pKadv-0005wB-62 for pgsql-hackers@arkaria.postgresql.org; Wed, 25 Jan 2023 07:56:27 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pKadu-0005w1-R6 for pgsql-hackers@lists.postgresql.org; Wed, 25 Jan 2023 07:56:26 +0000 Received: from mail-pj1-x1035.google.com ([2607:f8b0:4864:20::1035]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1pKadr-0007b2-MB for pgsql-hackers@postgresql.org; Wed, 25 Jan 2023 07:56:25 +0000 Received: by mail-pj1-x1035.google.com with SMTP id z9-20020a17090a468900b00226b6e7aeeaso1211002pjf.1 for ; Tue, 24 Jan 2023 23:56:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:user-agent:references :in-reply-to:from:subject:cc:to:message-id:date:from:to:cc:subject :date:message-id:reply-to; bh=mpR9zVELNy/VG0kJrfLaxZ15r8ae8y5MuQh4qRZF9pk=; b=crXxBtY18meSJVl7Z8Fc2OkiscyM3gD84bvdFYa8gjNvKEJMAOa565qESeD7APxpBR Su/FS/x3QM04o58yTp3RHEOMbP84+xLLDk2mvAXglxB4/5H0742NwG4A2LIL60lHvWOo Es6ruxjzWUmiSJIAMZTCfpRbwDa14LOnX3WTNjqtKEAW/FiiYIzI5ZptZHPWg+/0kW/v 3HQXj5p3tX81TzLe9bVBpy3mEA5FdRQTYUjUbw+AmQfJJsXyBOQJNesP6xgTJmjgAmVp dsoHMXLvJl6Y568vsfCo65BHa4Z/Rwh0RBOFECFFP3fdbFuCY33dMI1OM/XIe4t2LHSP JMfg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:user-agent:references :in-reply-to:from:subject:cc:to:message-id:date:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=mpR9zVELNy/VG0kJrfLaxZ15r8ae8y5MuQh4qRZF9pk=; b=pVviPjquzZAvPnmyAAFKbdjx4pRfO21T+mggeUkaqKgB1zJ+BkMJ2Se/LB5YnEg7oX Ijka6wyuI8Q0ys1zwQ3aIOa5yOmoNi4ce9jmfGqDqnuQV0fA/lmyoYhTnRqjOmI/UB35 fjhFlBbEQ4kPLEjmJebJiq6Smiu2Vsp0lbREzmp/8NNkOMYAHvG3LsX+iwnEdpmqA0YO Xm0IBkiqi4PJ+yIEtghrbI9Xg2e6/pd/nI8MuqDC7IC2c/n5BkcFALkhFebEUsk3ca6c SEN2Pxqlv+b7yHSDihYnDOJ4HiAIcuu7uiWreRVJouded+9D6N/qfm1+bWq6UUKObMy1 NMMA== X-Gm-Message-State: AFqh2kpbvDxsyycfsV/rVlz69j+Rx3tMj+PINCvsnNaVZFcq1xqfw1Jp /7nA7v6bQdblgqXyfV72eZ8= X-Google-Smtp-Source: AMrXdXtr4D8FLujeKXn6qTjzclrj6ijXfm4UYiHEGWYPg2SLpNTZGILl8BssxCWdLcGVMt5xJB19/Q== X-Received: by 2002:a05:6a20:42a0:b0:ad:e914:5523 with SMTP id o32-20020a056a2042a000b000ade9145523mr41034542pzj.53.1674633382415; Tue, 24 Jan 2023 23:56:22 -0800 (PST) Received: from localhost (KD036014041111.ppp-bb.dion.ne.jp. [36.14.41.111]) by smtp.gmail.com with ESMTPSA id f6-20020a637546000000b004d4547cc0f7sm2557619pgn.18.2023.01.24.23.56.19 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 24 Jan 2023 23:56:21 -0800 (PST) Date: Wed, 25 Jan 2023 16:56:17 +0900 (JST) Message-Id: <20230125.165617.724951472557617342.horikyota.ntt@gmail.com> To: andres@anarazel.de Cc: melanieplageman@gmail.com, vignesh21@gmail.com, pryzby@telsasoft.com, lukas@fittl.com, alvherre@alvh.no-ip.org, magnus@hagander.net, pgsql-hackers@postgresql.org, thomas.munro@gmail.com, m.sakrejda@gmail.com Subject: Re: pg_stat_bgwriter.buffers_backend is pretty meaningless (and more?) From: Kyotaro Horiguchi In-Reply-To: <20230124223512.xqp7tjgqvzqokaxq@awork3.anarazel.de> References: <20230124.172203.448918351330829200.horikyota.ntt@gmail.com> <20230124223512.xqp7tjgqvzqokaxq@awork3.anarazel.de> User-Agent: Mew version 6.8 on Emacs 26.1 Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk At Tue, 24 Jan 2023 14:35:12 -0800, Andres Freund wrote in > > 0002: > > > > + Assert(pgstat_bktype_io_stats_valid(bktype_shstats, MyBackendType)); > > > > This is relatively complex checking. We already asserts-out increments > > of invalid counters. Thus this is checking if some unrelated codes > > clobbered them, which we do only when consistency is critical. Is > > there any needs to do that here? I saw another occurance of the same > > assertion. > > I found it useful to find problems. Okay. > > + no_temp_rel = bktype == B_AUTOVAC_LAUNCHER || bktype == B_BG_WRITER || > > + bktype == B_CHECKPOINTER || bktype == B_AUTOVAC_WORKER || > > + bktype == B_STANDALONE_BACKEND || bktype == B_STARTUP; > > > > I'm not sure I like to omit parentheses for such a long Boolean > > expression on the right side. > > What parens would help? I thought about the following. no_temp_rel = (bktype == B_AUTOVAC_LAUNCHER || bktype == B_BG_WRITER || bktype == B_CHECKPOINTER || bktype == B_AUTOVAC_WORKER || bktype == B_STANDALONE_BACKEND || bktype == B_STARTUP); > > + write_chunk_s(fpout, &pgStatLocal.snapshot.io); > > + if (!read_chunk_s(fpin, &shmem->io.stats)) > > > > The names of the functions hardly make sense alone to me. How about > > write_struct()/read_struct()? (I personally prefer to use > > write_chunk() directly..) > > That's not related to this patch - there's several existing callers for > it. And write_struct wouldn't be better imo, because it's not just for > structs. Hmm. Then what the "_s" stands for? > > + PgStat_BktypeIO > > > > This patch abbreviates "backend" as "bk" but "be" is used in many > > places. I think that naming should follow the predecessors. > > The precedence aren't consistent unfortunately :) Uuuummmmm. Okay, just I like "be" there! Anyway, I don't strongly push that. > > > + Number of read operations in units of op_bytes. > > > > I may be the only one who see the name as umbiguous between "total > > number of handled bytes" and "bytes hadled at an operation". Can't it > > be op_blocksize or just block_size? > > > > + b.io_object, > > + b.io_context, > > No, block wouldn't be helpful - we'd like to use this for something that isn't > uniform blocks. What does the field show in that case? The mean of operation size? Or one row per opration size? If the former, the name looks somewhat wrong. If the latter, block_size seems making sense. regards. -- Kyotaro Horiguchi NTT Open Source Software Center