Re: custom function for converting human readable sizes to bytes
От | Vitaly Burovoy |
---|---|
Тема | Re: custom function for converting human readable sizes to bytes |
Дата | |
Msg-id | CAKOSWN=w37cahg93D1vmoftn0+_QzvgQQ1VBFOD=Fh6op3qmMA@mail.gmail.com обсуждение исходный текст |
Ответ на | Re: custom function for converting human readable sizes to bytes (Vitaly Burovoy <vitaly.burovoy@gmail.com>) |
Ответы |
Re: custom function for converting human readable sizes to bytes
|
Список | pgsql-hackers |
On 2/16/16, Vitaly Burovoy <vitaly.burovoy@gmail.com> wrote: > On 2/16/16, Dean Rasheed <dean.a.rasheed@gmail.com> wrote: >> Fixing that in parse_memory_unit() would be messy because it assumes a >> base unit of kB, so it would require a negative multiplier, and >> pg_size_bytes() would have to be taught to divide by the magnitude of >> negative multipliers in the same way that guc.c does. Now parse_memory_unit returns -1024 for bytes as divider, constant "bytes" has moved there. Add new memory_units_bytes_hint which differs from an original memory_units_int by "bytes" size unit. Allow hintmsg be NULL and if so, skip setting dereferenced variable to memory_units_bytes_hint. >> ISTM that it would be far less code, and much simpler and more >> readable to just parse the supported units directly in >> pg_size_bytes(), rather than trying to share code with guc.c, when the >> supported units are actually different and may well diverge further in >> the future. > > Initially it was not shared with guc.c and now it is by the letter[1] > of Oleksandr Shulgin and Robert Haas. > >> I'll try to hack something up, and see what it looks like. >> >> Regards, >> Dean Current version contains correct hint message, it passes tests. Besides mentioned above there are some comment rewordings, and variable renaming. [1]http://www.postgresql.org/message-id/CA+TgmoaNoT7uGjsbiBFUQgacHk2LZrypMKJVVUgp5r197YUvTg@mail.gmail.com -- Best regards, Vitaly Burovoy
Вложения
В списке pgsql-hackers по дате отправления: