Re: Review of Refactoring code for sync node detection
От | Michael Paquier |
---|---|
Тема | Re: Review of Refactoring code for sync node detection |
Дата | |
Msg-id | CAB7nPqRKO+ZHw_ptmG3FC6R59hmNd5db2ajBmcVYA3svdkciPw@mail.gmail.com обсуждение исходный текст |
Ответ на | Review of Refactoring code for sync node detection (Jim Nasby <jim@nasby.net>) |
Ответы |
Re: Review of Refactoring code for sync node detection
|
Список | pgsql-hackers |
Thanks for your review! (No worries for creating a new thread, I don't mind as this is not a huge patch. I think you could have downloaded the mbox from postgresql.org btw). On Thu, Oct 30, 2014 at 8:24 AM, Jim Nasby <jim@nasby.net> wrote: > SyncRepGetSynchronousNode(): > IMHO, the top comment should mention that if there are multiple standbys of > the same priority it returns the first one. OK. Corrected. > This switches from using a single if() with multiple conditions &&'d > together to a bunch of if() continue's. I don't know if those will perform > the same, and AFAIK this is pretty performance critical. Well, we could still use the old notation with a single if(). That's not much complicated to change. > <grammarZealot>In the comments, "Process" should be > "Proceed".</grammarZealot> Noted. Thanks for correcting my Frenglish. > pg_stat_get_wal_senders(): > The original version only loops through walsnds[] one time; the new code > loops twice, both times while holding SyncRepLock(shared). This will block > transaction commit if syncrep is enabled. That's not great, but presumably > this function isn't going to be called terribly often, so maybe it's OK. (On > a side note, perhaps we should add a warning to the documentation for > pg_stat_replication warning not to hammer it...) Hm. For code readability I did not really want to do so, but let's do this: let's add a new argument in SyncRepGetSynchronousNode to retrieve the priority of each WAL sender and do a single pass through the array such as there is no performance difference. Updated patch attached. Regards, -- Michael
Вложения
В списке pgsql-hackers по дате отправления: