On Thu, Apr 7, 2016 at 5:49 PM, Fujii Masao <masao.fujii@gmail.com> wrote: > > On Thu, Apr 7, 2016 at 7:29 PM, Amit Kapila <amit.kapila16@gmail.com> wrote: > > > > So if we go by this each time backend calls pg_stat_get_wal_senders, it > > needs to do parsing to form SyncRepConfig whether it's changed or not from > > previous time. I understand that this is not a performance critical path, > > but still if we can do it in some other optimal way which doesn't hurt any > > other path, then it will be better. > > So, will you write the patch? Either current implementation or > the approach you're suggesting works to me. If you really want > to change the current one, I'm happy to review that. >
Sorry, I don't have time to complete the patch, but I have written an initial patch to show you what I have in mind and something on this lines should work. I think with such an approach, you don't need to parse for s_s_names twice (once in check_* and once in syncupdate* function), you can refer check_temp_tablespaces() and assign_temp_tablespaces() to see how to use the work done by check_* function in assign_* function. Also write now, I have used TopMemoryContext for allocation in assign_synchronous_standby_names, it is better to use guc_malloc or something similar for allocation as is done in other check_* and assign_* functions.