[PATCH] Implement condition variable-based WAL waiting for logical decoding

Поиск
Список
Период
Сортировка
От Arkady Skvorcov
Тема [PATCH] Implement condition variable-based WAL waiting for logical decoding
Дата
Msg-id CAChax7wDNrWOFLbDBwta=ZS8WY43ybE4mTEbY3mQbk9d_K6X-A@mail.gmail.com
обсуждение исходный текст
Список pgsql-hackers
Hello contributors

This patch implements a condition variable-based approach for WAL waiting
in logical decoding, replacing the previous polling mechanism. The new
system provides significant efficiency improvements by eliminating
unnecessary CPU cycles during WAL waiting periods.

Key changes:

1. Implemented LogicalWaitForWal() function to handle both immediate   return (non-waiting) and conditional waiting paths
2. Maintained backward compatibility with existing APIs
3. Added comprehensive regression tests

Performance benefits:
- Eliminates busy-waiting during logical replication slot advancement
- Reduces CPU usage during periods of low WAL activity
- Maintains same latency characteristics for high-activity scenarios

Testing:
- Added two new regression tests (logical_cv_waiting, logical_cv_edge_case)
- Verified both non-waiting (common case) and waiting (edge case) paths
- Tests cover basic functionality, multiple transactions, and slot advancement
- All existing regression tests pass

The implementation follows the existing pattern for condition variables
in PostgreSQL and integrates seamlessly with the current logical decoding
infrastructure.

Looking forward to your feedback.

Regards,
Arkady Skvorcov
Вложения

В списке pgsql-hackers по дате отправления: