Question on adl_next_worker condition in autovacuum launcher
От | Yugo Nagata |
---|---|
Тема | Question on adl_next_worker condition in autovacuum launcher |
Дата | |
Msg-id | 20250802011502.1485eedaf998b4bd24dc270b@sraoss.co.jp обсуждение исходный текст |
Список | pgsql-hackers |
Hi, With regard to my previous post [1], I have a question about the autovacuum launcher codes. In do_start_worker(), the following conditions determins whether a database should be skipped or not. /* * Skip this database if its next_worker value falls between * the current time and the current time plus naptime. */ if (!TimestampDifferenceExceeds(dbp->adl_next_worker, current_time, 0) && !TimestampDifferenceExceeds(current_time, dbp->adl_next_worker, autovacuum_naptime * 1000)) skipit = true; This means a database is skipped when current_time < adl_next_woker < current_time + autovacuum_naptime. However, I don't quite understand why ther upper bound condition is necessary. After a database has been processed, adl_next_woker is set in launch_worker() as follows: /* * add autovacuum_naptime seconds to the current time, and use * that as the new "next_worker" field for this database. */ avdb->adl_next_worker = TimestampTzPlusMilliseconds(now, autovacuum_naptime * 1000); Here "now < current_time (in do_start_worker())", so I believe "adl_next_woker < current_time + autovacuum_naptime" will always be true. Therefore, it seems redundant to explicitly check the upper bound. Am I missing something? I’d appreciate it if anyone could clarify this for me. [1] https://www.postgresql.org/message-id/20250802002027.cd35c481f6c6bae7ca2a3e26%40sraoss.co.jp Regards, Yugo Nagata -- Yugo Nagata <nagata@sraoss.co.jp>
В списке pgsql-hackers по дате отправления: