Minor adjustment to pg_aios output naming

Started by torikoshia8 months ago6 messages
#1torikoshia
torikoshia@oss.nttdata.com
1 attachment(s)

Hi,

I've noticed a minor inconsistency in the output of pg_aios.

According to the documentation, the values for 'operation' are described
as:

<literal>readv</literal>, a vectored read
...
<literal>writev</literal>, a vectored write

However, in actual output, they appear as read and write -- without the
trailing v:

=# select operation from pg_aios;
..
operation | read

While this discrepancy is unlikely to cause any real issues, it would be
better to keep the naming consistent.

I was a bit unsure which form to align to.
There are currently no other types of read/write operations in pg_aios,
so the shorter form might have been sufficient.
However, using the 'v'-suffixed names makes the vectored nature of these
operations explicit and future-proofs
the naming in case other variants are introduced later.

What do you think?

Best regards,

--
Regards,

--
Atsushi Torikoshi
Seconded from NTT DATA GROUP CORPORATION to SRA OSS K.K.

Attachments:

v1-0001-Adjust-pg_aios-operation-names-to-match-documenta.patchtext/x-diff; name=v1-0001-Adjust-pg_aios-operation-names-to-match-documenta.patchDownload
From 71c5d0b8f1a67026e8db2e7ee27ce18f6e0689e0 Mon Sep 17 00:00:00 2001
From: Atsushi Torikoshi <torikoshi@sraoss.co.jp>
Date: Wed, 21 May 2025 10:50:53 +0900
Subject: [PATCH v1] Adjust pg_aios operation names to match documentation

pg_aios output currently shows 'read' and 'write' for
vectored I/O operations, while the documentation
refers to them as 'readv' and 'writev'.
This patch updates the output to use the 'v'-suffixed
forms for consistency.
---
 src/backend/storage/aio/aio_io.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/backend/storage/aio/aio_io.c b/src/backend/storage/aio/aio_io.c
index 00e176135a..520b5077df 100644
--- a/src/backend/storage/aio/aio_io.c
+++ b/src/backend/storage/aio/aio_io.c
@@ -181,9 +181,9 @@ pgaio_io_get_op_name(PgAioHandle *ioh)
 		case PGAIO_OP_INVALID:
 			return "invalid";
 		case PGAIO_OP_READV:
-			return "read";
+			return "readv";
 		case PGAIO_OP_WRITEV:
-			return "write";
+			return "writev";
 	}
 
 	return NULL;				/* silence compiler */

base-commit: a6060f1cbec39575634043baeeaeb11e86042fa6
-- 
2.43.0

#2Michael Paquier
michael@paquier.xyz
In reply to: torikoshia (#1)
Re: Minor adjustment to pg_aios output naming

On Wed, May 21, 2025 at 11:14:11AM +0900, torikoshia wrote:

Hi,

I've noticed a minor inconsistency in the output of pg_aios.

According to the documentation, the values for 'operation' are described as:

<literal>readv</literal>, a vectored read
...
<literal>writev</literal>, a vectored write

However, in actual output, they appear as read and write -- without the
trailing v:

=# select operation from pg_aios;
..
operation | read

While this discrepancy is unlikely to cause any real issues, it would be
better to keep the naming consistent.

I was a bit unsure which form to align to.
There are currently no other types of read/write operations in pg_aios, so
the shorter form might have been sufficient.
However, using the 'v'-suffixed names makes the vectored nature of these
operations explicit and future-proofs
the naming in case other variants are introduced later.

What do you think?

--- a/src/backend/storage/aio/aio_io.c
+++ b/src/backend/storage/aio/aio_io.c
@@ -181,9 +181,9 @@ pgaio_io_get_op_name(PgAioHandle *ioh)
         case PGAIO_OP_INVALID:
             return "invalid";
         case PGAIO_OP_READV:
-            return "read";
+            return "readv";
         case PGAIO_OP_WRITEV:
-            return "write";
+            return "writev";
     }

I think that your suggestion of fix is right. The properties are
marked as "WRITEV" and "READV" for vectored operations. So the
documentation is right, not the name used in the code. Will fix,
thanks for the report.
--
Michael

#3Robert Haas
robertmhaas@gmail.com
In reply to: Michael Paquier (#2)
Re: Minor adjustment to pg_aios output naming

On Tue, May 20, 2025 at 10:45 PM Michael Paquier <michael@paquier.xyz> wrote:

I think that your suggestion of fix is right. The properties are
marked as "WRITEV" and "READV" for vectored operations. So the
documentation is right, not the name used in the code. Will fix,
thanks for the report.

Since this was Andres's commit, I think it would have been a good idea
to give at least 24 hours, or better yet a couple of days, for him to
comment before committing something.

--
Robert Haas
EDB: http://www.enterprisedb.com

#4Michael Paquier
michael@paquier.xyz
In reply to: Robert Haas (#3)
Re: Minor adjustment to pg_aios output naming

On Wed, May 21, 2025 at 03:43:01PM -0400, Robert Haas wrote:

Since this was Andres's commit, I think it would have been a good idea
to give at least 24 hours, or better yet a couple of days, for him to
comment before committing something.

Thanks for the poke, sorry about that. I'll be more careful with my
timings.
--
Michael

#5Andres Freund
andres@anarazel.de
In reply to: Robert Haas (#3)
Re: Minor adjustment to pg_aios output naming

Hi,

On 2025-05-21 15:43:01 -0400, Robert Haas wrote:

On Tue, May 20, 2025 at 10:45 PM Michael Paquier <michael@paquier.xyz> wrote:

I think that your suggestion of fix is right. The properties are
marked as "WRITEV" and "READV" for vectored operations. So the
documentation is right, not the name used in the code. Will fix,
thanks for the report.

Since this was Andres's commit, I think it would have been a good idea
to give at least 24 hours, or better yet a couple of days, for him to
comment before committing something.

I think the change is fine, but I was also a bit surprised about the speed the
change went in...

Greetings,

Andres Freund

#6Atsushi Torikoshi
torikoshia.tech@gmail.com
In reply to: Andres Freund (#5)
Re: Minor adjustment to pg_aios output naming

Anyway, thanks for the review!

--
Atsushi Torikoshi