Small fix on query_id_enabled - Mailing list pgsql-hackers

From Yugo NAGATA
Subject Small fix on query_id_enabled
Date
Msg-id 20240209153823.e29a68cadb14225f1362a2cf@sraoss.co.jp
Whole thread Raw
Responses Re: Small fix on query_id_enabled
List pgsql-hackers
Hi,

I found the comment on query_id_enabled looks inaccurate because this is
never set to true when compute_query_id is ON.

 /* True when compute_query_id is ON, or AUTO and a module requests them */
 bool       query_id_enabled = false;

Should we fix this as following (just fixing the place of a comma) ?

/* True when compute_query_id is ON or AUTO, and a module requests them */

Also, I think the name is a bit confusing for the same reason, that is,
query_id_enabled may be false even when query id is computed in fact.

Actually, this does not matter because we use IsQueryIdEnabled to check
if query id is enabled,  instead of referring to a global variable
(query_id_enabled or compute_query_id). But, just for making a code a bit
more readable, how about renaming this to query_id_required which seems to
stand for the meaning more correctly?

I attached a patch for above fixes. 

Although renaming might  not be acceptable since changing global variables
may affect third party tools, I think the comment should be fixed at least.

IMHO, it seems better to make this variable static not to be accessed directly.
However, I left it as is because this is used in a static inline function.

Regards,
Yugo Nagata

-- 
Yugo NAGATA <nagata@sraoss.co.jp>

Attachment

pgsql-hackers by date:

Previous
From: vignesh C
Date:
Subject: Re: speed up a logical replica setup
Next
From: Masahiko Sawada
Date:
Subject: Re: Synchronizing slots from primary to standby