> On Oct 10, 2025, at 17:04, Aya Iwata (Fujitsu) <[email protected]> wrote:
> 
>> 3 - bgworker.h
>> ```
>> +extern void TerminateBackgroundWorkersByOid(Oid databaseId);
>> ```
>> 
>> An OID can represent a lot of things. So, instead of suggesting the OID type 
>> by parameter name, I wonder if it is better do that with the function name, 
>> like TerminateBgWorkersByDbOid(Oid oid)
> 
> After receiving your comment, I checked other functions and there is no other 
> examples like XXOid function in the code.
> If this function use only here, original code is using databaseId in argument 
> and it clear what Oid is.
> I think original name is fine because it's not a function that's called much 
> elsewhere.


By searching for “ByOid”, we can get some existing examples:

ObjectAddress
RefreshMatViewByOid(Oid matviewOid, bool is_create, bool skipData,
                    bool concurrent, const char *queryString,
                    QueryCompletion *qc)

The function name clearly tells refresh MatView by Oid, so the oid in parameter 
is an old of mat view.

ResultRelInfo *
ExecLookupResultRelByOid(ModifyTableState *node, Oid resultoid,
                         bool missing_ok, bool update_cache)

The function name indicates ResultRel, so the oid is a result oid.

AccessMethodInfo *
findAccessMethodByOid(Oid oid)

The function name tells to find access method, the the oid is an access 
method’s OID.

You can find more …

But in this patch, the function name only indeeds “terminate background 
workers”, while the oid is a database oid. Maybe we can rename the function to 
“TerminateDatabaseBgWorkersByOid()”.

Best regards,
--
Chao Li (Evan)
HighGo Software Co., Ltd.
https://www.highgo.com/




Reply via email to