[pgpool-hackers: 2349] Re: [pgpool-committers: 4036] pgpool: Use volatile pointer for Req_info variable.

Tatsuo Ishii ishii at sraoss.co.jp
Fri May 19 07:17:54 JST 2017


Oh, ok. I'm going to revert the commit. I need more invetigation and
will come back later if I find a solution.

Best regards,
--
Tatsuo Ishii
SRA OSS, Inc. Japan
English: http://www.sraoss.co.jp/index_en.php
Japanese:http://www.sraoss.co.jp

> On the related node I think this patch introduces some compilation
> warnings.
> 
> See below the warnings when I compile the code on CentOS 7
> 
> main/pgpool_main.c: In function ‘register_node_operation_request’:
> main/pgpool_main.c:496:3: warning: passing argument 1 of ‘memcpy’ discards
> ‘volatile’ qualifier from pointer target type [enabled by default]
>    memcpy(Req_info->request[index].node_id, node_id_set, (sizeof(int) *
> count));
>    ^
> In file included from /usr/include/sys/un.h:37:0,
>                  from main/pgpool_main.c:26:
> /usr/include/string.h:42:14: note: expected ‘void * __restrict__’ but
> argument is of type ‘volatile int *’
>  extern void *memcpy (void *__restrict __dest, const void *__restrict __src,
>               ^
> main/pgpool_main.c: In function ‘failover’:
> main/pgpool_main.c:1536:3: warning: passing argument 2 of ‘memcpy’ discards
> ‘volatile’ qualifier from pointer target type [enabled by default]
>    memcpy(node_id_set, Req_info->request[queue_index].node_id ,
> (sizeof(int) * Req_info->request[queue_index].count));
>    ^
> In file included from /usr/include/sys/un.h:37:0,
>                  from main/pgpool_main.c:26:
> /usr/include/string.h:42:14: note: expected ‘const void * __restrict__’ but
> argument is of type ‘volatile int *’
>  extern void *memcpy (void *__restrict __dest, const void *__restrict __src,
> 
> Thanks
> Best Regards
> Muhammad Usama
> 
> 
> On Thu, May 18, 2017 at 5:49 PM, Muhammad Usama <m.usama at gmail.com> wrote:
> 
>>
>>
>> On Tue, May 16, 2017 at 4:55 PM, Tatsuo Ishii <ishii at sraoss.co.jp> wrote:
>>
>>> Usama,
>>>
>>> Watchdog uses shared memory and I wonder if some of pointer variables
>>> to the shared memory are may need "volatile" to make sure that they
>>> fetch the fresh value. What do you think?
>>>
>>
>> *ipc_shared_key* and *watchdog_ipc_address* are only set once at the
>> startup time and never changed So I don't think we need to make it volatile.
>> But I think we may need watchdog_require_cleanup and
>> watchdog_node_escalated to be declared as volatile.
>>
>> Regards
>> Muhammad Usama
>>
>>>
>>> /* shared memory variables */
>>> char *watchdog_ipc_address = NULL;
>>> bool *watchdog_require_cleanup = NULL;  /* shared memory variable set to
>>> true
>>>
>>>        * when watchdog process terminates abnormally
>>>
>>>        */
>>> bool *watchdog_node_escalated = NULL;   /* shared memory variable set to
>>> true
>>>
>>>        * when watchdog process has performed escalation
>>>
>>>        */
>>> unsigned int *ipc_shared_key = NULL;   /* key lives in shared memory
>>>
>>>       * used to identify the ipc internal
>>>
>>>       * clients
>>>
>>>       */
>>
>> > Use volatile pointer for Req_info variable.
>>> >
>>> > Since Req_info points to shared memory area, using volatile pointer
>>> > will allow to fetch the fresh value.
>>> >
>>> > Branch
>>> > ------
>>> > master
>>> >
>>> > Details
>>> > -------
>>> > https://git.postgresql.org/gitweb?p=pgpool2.git;a=commitdiff
>>> ;h=a4de4bfc1421d787b53789eb62eb7e9cb26e91c1
>>> >
>>> > Modified Files
>>> > --------------
>>> > src/include/pool.h                                               | 2 +-
>>> > src/main/pgpool_main.c                                           | 2 +-
>>> > src/test/regression/tests/010.rewrite_timestamp/timestamp/main.c | 2 +-
>>> > 3 files changed, 3 insertions(+), 3 deletions(-)
>>> >
>>> _______________________________________________
>>> pgpool-hackers mailing list
>>> pgpool-hackers at pgpool.net
>>> http://www.pgpool.net/mailman/listinfo/pgpool-hackers
>>>
>>
>>


More information about the pgpool-hackers mailing list