Обсуждение: Re: [HACKERS] autovacuum does not start in HEAD
I wrote: > I found that autovacuum launcher does not launch any workers in HEAD. The attached autovacuum-fix.patch could fix the problem. I changed to use 'greater or equal' instead of 'greater' at the decision of next autovacuum target. The point was in the resolution of timer; There is a platform that timer has only a resolution of milliseconds. We initialize adl_next_worker with current_time in rebuild_database_list(), but we could use again the same value in do_start_worker(), because there is no measurable difference in those low-resolution-platforms. Another attached patch, autovacuum-debug.patch, is just for printf-debug. I got the following logs without fix -- autovacuum never works. # SELECT oid, datname FROM pg_database ORDER BY oid; oid | datname -------+----------- 1 | template1 11494 | template0 11495 | postgres 16384 | bench (4 rows) # pgbench bench -s1 -c1 -t100000 [with configurations of autovacuum_naptime = 10s and log_min_messages = debug1] LOG: do_start_worker skip : 230863399.250000, 230863399.250000, 230863409.250000 LOG: rebuild_database_list: db=11495, time=230863404.250000 LOG: rebuild_database_list: db=16384, time=230863409.250000 DEBUG: autovacuum: processing database "bench" LOG: do_start_worker skip : 230863404.250000, 230863404.250000, 230863414.250000 LOG: do_start_worker skip : 230863404.250000, 230863409.250000, 230863414.250000 LOG: rebuild_database_list: db=11495, time=230863409.250000 LOG: rebuild_database_list: db=16384, time=230863414.250000 LOG: do_start_worker skip : 230863409.250000, 230863409.250000, 230863419.250000 LOG: do_start_worker skip : 230863409.250000, 230863414.250000, 230863419.250000 LOG: rebuild_database_list: db=11495, time=230863414.250000 LOG: rebuild_database_list: db=16384, time=230863419.250000 ... (no autovacuum activities forever) Regards, --- ITAGAKI Takahiro NTT Open Source Software Center
Вложения
Your patch has been added to the PostgreSQL unapplied patches list at: http://momjian.postgresql.org/cgi-bin/pgpatches It will be applied as soon as one of the PostgreSQL committers reviews and approves it. --------------------------------------------------------------------------- ITAGAKI Takahiro wrote: > I wrote: > > I found that autovacuum launcher does not launch any workers in HEAD. > > The attached autovacuum-fix.patch could fix the problem. I changed > to use 'greater or equal' instead of 'greater' at the decision of > next autovacuum target. > > The point was in the resolution of timer; There is a platform that timer > has only a resolution of milliseconds. We initialize adl_next_worker with > current_time in rebuild_database_list(), but we could use again the same > value in do_start_worker(), because there is no measurable difference > in those low-resolution-platforms. > > > Another attached patch, autovacuum-debug.patch, is just for printf-debug. > I got the following logs without fix -- autovacuum never works. > > # SELECT oid, datname FROM pg_database ORDER BY oid; > oid | datname > -------+----------- > 1 | template1 > 11494 | template0 > 11495 | postgres > 16384 | bench > (4 rows) > > # pgbench bench -s1 -c1 -t100000 > [with configurations of autovacuum_naptime = 10s and log_min_messages = debug1] > > LOG: do_start_worker skip : 230863399.250000, 230863399.250000, 230863409.250000 > LOG: rebuild_database_list: db=11495, time=230863404.250000 > LOG: rebuild_database_list: db=16384, time=230863409.250000 > DEBUG: autovacuum: processing database "bench" > LOG: do_start_worker skip : 230863404.250000, 230863404.250000, 230863414.250000 > LOG: do_start_worker skip : 230863404.250000, 230863409.250000, 230863414.250000 > LOG: rebuild_database_list: db=11495, time=230863409.250000 > LOG: rebuild_database_list: db=16384, time=230863414.250000 > LOG: do_start_worker skip : 230863409.250000, 230863409.250000, 230863419.250000 > LOG: do_start_worker skip : 230863409.250000, 230863414.250000, 230863419.250000 > LOG: rebuild_database_list: db=11495, time=230863414.250000 > LOG: rebuild_database_list: db=16384, time=230863419.250000 > ... > (no autovacuum activities forever) > > Regards, > --- > ITAGAKI Takahiro > NTT Open Source Software Center > [ Attachment, skipping... ] [ Attachment, skipping... ] > > ---------------------------(end of broadcast)--------------------------- > TIP 5: don't forget to increase your free space map settings -- Bruce Momjian <bruce@momjian.us> http://momjian.us EnterpriseDB http://www.enterprisedb.com + If your life is a hard drive, Christ can be your backup. +
ITAGAKI Takahiro wrote: > I wrote: > > I found that autovacuum launcher does not launch any workers in HEAD. > > The attached autovacuum-fix.patch could fix the problem. I changed > to use 'greater or equal' instead of 'greater' at the decision of > next autovacuum target. I developed a different fix, which is possible due to the addition of TimestampDifferenceExceeds to the TimestampTz API. (Thanks Tom). It continues to work for me here, but please confirm that it fixes the bug you reported -- I don't have a low-resolution platform handy. -- Alvaro Herrera http://www.CommandPrompt.com/ PostgreSQL Replication, Consulting, Custom Development, 24x7 support
Вложения
ITAGAKI Takahiro wrote: > I wrote: > > I found that autovacuum launcher does not launch any workers in HEAD. > > The attached autovacuum-fix.patch could fix the problem. I changed > to use 'greater or equal' instead of 'greater' at the decision of > next autovacuum target. I have committed a patch which might fix this issue in autovacuum.c rev 1.44. Please retest. -- Alvaro Herrera http://www.CommandPrompt.com/ PostgreSQL Replication, Consulting, Custom Development, 24x7 support