View Issue Details

IDProjectCategoryView StatusLast Update
0000707Pgpool-IIBugpublic2021-05-20 12:12
ReporterJockeTF Assigned Topengbo  
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionopen 
PlatformLinuxOSDebianOS Version10
Product Version4.1.6 
Target Version4.1.7Fixed in Version4.1.7 
Summary0000707: Statment level load-balancing breaks redirect preferences
DescriptionThe database_redirect_preference_list and database_redirect_preference_list settings have no effect when statement_level_load_balance is on.
Steps To ReproduceConfigure PGPool 4.1.6 with the following settings:

database_redirect_preference_list = 'postgres:primary'
statement_level_load_balance = on

Run a bunch of queries:

for x in {1..128}; do
    echo 'SELECT 1' | psql 'dbname=postgres ...'
done

Check how PGPool load-balanced the queries:

# SHOW POOL_NODES;
node_id: 0, select_cnt: 63
node_id: 1, select_cnt: 65

Turn off statement level load-balancing and restart PGPool:

database_redirect_preference_list = 'postgres:primary'
statement_level_load_balance = off

Run a few more queries:

for x in {1..128}; do
    echo 'SELECT 1' | psql 'dbname=postgres ...'
done

Check PGPool's load-balancing once more:

# SHOW POOL_NODES;
node_id: 0, select_cnt: 128
node_id: 1, select_cnt: 0
Additional InformationI'm not entirely sure if this is an actual bug, or just something to mention in the documentation.

I'm using PostgreSQL 11.11 from the Debian 10 repositories, with a manually built PGPool 4.1.6.

PGPool is running in master/slave mode with PostgreSQL's streaming replication.
TagsNo tags attached.

Activities

JockeTF

2021-04-26 22:18

reporter  

pgpool.conf (6,255 bytes)   
# Connection - Listen Settings

port = 5432
listen_addresses = '*'
socket_dir = '/var/run/postgresql'
reserved_connections = 0


# Connection - Communication Manager

pcp_port = 9898
pcp_listen_addresses = 'localhost'
pcp_socket_dir = '/var/run/postgresql'
listen_backlog_multiplier = 2
serialize_accept = off


# Connection - Backend Servers

backend_weight0 = 1
backend_port0 = '5434'
backend_hostname0 = '172.24.76.32'
backend_data_directory0 = '/var/lib/postgresql/11/main'
backend_flag0 = 'ALLOW_TO_FAILOVER'
backend_weight1 = 1
backend_port1 = '5434'
backend_hostname1 = '172.24.76.40'
backend_data_directory1 = '/var/lib/postgresql/11/main'
backend_flag1 = 'ALLOW_TO_FAILOVER'


# Connection - Authentication

enable_pool_hba = on
pool_passwd = 'passwd.conf'
authentication_timeout = 60
allow_clear_text_frontend_auth = off


# Connection - SSL

ssl = on
ssl_key = 'ssl.key'
ssl_cert = 'ssl.crt'
ssl_ca_cert = 'ca.crt'
ssl_ca_cert_dir = ''
#ssl_ciphers = 'HIGH:MEDIUM:+3DES:!aNULL'
#ssl_prefer_server_ciphers = off
#ssl_ecdh_curve = 'prime256v1'
#ssl_dh_params_file = ''


# Pool - Session

num_init_children = 128
max_pool = 4


# Pool - Life Time
#
# These values help mitigate memory safety issues by disallowing process
# reuse after client disconnects. PGPool has had some issues with memory
# safety in the past, and we don't want to risk any data leaking between
# connections. So, think carefully before allowing process reuse.

child_life_time = 300
child_max_connections = 1
connection_life_time = 0
client_idle_limit = 0


# Log - Configuration

log_destination = 'stderr'
log_line_prefix = '%t: pid %p: '
log_connections = on
log_hostname = off
log_statement = off
log_per_node_statement = off
log_client_messages = off
log_standby_delay = 'if_over_threshold'
syslog_facility = 'LOCAL0'
syslog_ident = 'pgpool'


# Log - Debug

log_error_verbosity = default
client_min_messages = notice
log_min_messages = warning


# File - Location

pid_file_name = '/var/run/postgresql/pgpool.pid'
logdir = '/var/lib/postgresql'


# Connection Pooling - Settings

connection_cache = off
reset_query_list = 'ABORT; DISCARD ALL'


# Replication - Mode

replication_mode = off
replicate_select = off
insert_lock = off
lobj_lock_table = ''


# Replication - Degenerate handling

replication_stop_on_mismatch = off
failover_if_affected_tuples_mismatch = off


# Balance - Settings

load_balance_mode = on
ignore_leading_white_space = on
white_function_list = ''
black_function_list = 'currval,lastval,nextval,setval'
black_query_pattern_list = ''
database_redirect_preference_list = 'postgres:primary'
app_name_redirect_preference_list = ''
allow_sql_comments = off
disable_load_balance_on_write = 'transaction'
statement_level_load_balance = on


# Replication - Type

master_slave_mode = on
master_slave_sub_mode = 'stream'


# Replication - Streaming

sr_check_period = 10
sr_check_user = 'pool'
sr_check_password = ''
sr_check_database = 'pool'
delay_threshold = 10000000


# Special Commands - Settings

follow_master_command = '/usr/local/bin/pgr_control follow -d=%d -h=%h -p=%p -D=%D -M=%M -m=%m -H=%H -P=%P -r=%r -R=%R'


# Health Check - Parameters

health_check_period = 5
health_check_timeout = 10
health_check_user = 'pool'
health_check_password = ''
health_check_database = 'pool'
health_check_max_retries = 24
health_check_retry_delay = 5
connect_timeout = 10000


# Failover Settings

failover_command = '/usr/local/bin/pgr_control failover -d=%d -h=%h -p=%p -D=%D -M=%M -m=%m -H=%H -P=%P -r=%r -R=%R'
failback_command = ''
failover_on_backend_error = off
detach_false_primary = on
search_primary_node_timeout = 300


# Recovery - Online

recovery_user = 'pool'
recovery_password = ''
recovery_1st_stage_command = ''
recovery_2nd_stage_command = ''
recovery_timeout = 90
client_idle_limit_in_recovery = 0
auto_failback = off
auto_failback_interval = 60


# Watchdog - Enabling

use_watchdog = on


# Watchdog - Upstream Servers

trusted_servers = ''
ping_path = '/bin'


# Watchdog - Communication Settings #

wd_priority = 1
wd_port = 9000
wd_hostname = 'pgpool1'
wd_authkey = 'censored'
wd_ipc_socket_dir = '/tmp'


# Watchdog - Virtual IP Control Settings

if_cmd_path = '/usr/bin'
arping_path = '/usr/bin'
delegate_IP = '172.24.76.8'
if_up_cmd = 'sudo ip addr add $_IP_$/255.255.255.0 brd 172.24.76.255 dev eth1 label eth1:1'
if_down_cmd = 'sudo ip addr del $_IP_$/255.255.255.0 dev eth1'
arping_cmd = 'sudo arping -U $_IP_$ -I eth1 -c 4'


# Watchdog - Escalation Behaivor Setting

clear_memqcache_on_escalation = on
wd_escalation_command = ''
wd_de_escalation_command = ''


# Watchdog - Consensus Failover Settings

failover_when_quorum_exists = on
failover_require_consensus = on
allow_multiple_failover_requests_from_node = off
enable_consensus_with_half_votes = off


# Watchdog - Lifecheck Setting

wd_monitoring_interfaces_list = 'any'
wd_lifecheck_method = 'heartbeat'
wd_interval = 10


# Watchdog - Heartbeat Mode

wd_heartbeat_port = 9694
wd_heartbeat_keepalive = 2
wd_heartbeat_deadtime = 30


# Watchdog - Heartbeat Hosts

heartbeat_destination0 = '172.24.76.72'
heartbeat_destination_port0 = 9694
heartbeat_device0 = ''
heartbeat_destination1 = '172.25.75.80'
heartbeat_destination_port1 = 9694
heartbeat_device1 = ''


# Watchdog - Query Mode

wd_life_point = 3
wd_lifecheck_query = 'SELECT 1'
wd_lifecheck_dbname = 'pool'
wd_lifecheck_user = 'pool'
wd_lifecheck_password = ''


# Nodes - Connection Settings

other_pgpool_hostname0 = '172.24.76.72'
other_pgpool_port0 = 5432
other_wd_port0 = 9000
other_pgpool_hostname1 = '172.25.75.80'
other_pgpool_port1 = 5432
other_wd_port1 = 9000


# Miscellaneous - Settings

relcache_expire = 0
relcache_size = 256
check_temp_table = catalog
check_unlogged_table = on
enable_shared_relcache = on
relcache_query_target = master


# Cache - Settings

memory_cache_enabled = off
memqcache_method = 'shmem'
memqcache_memcached_host = 'localhost'
memqcache_memcached_port = 11211
memqcache_total_size = 67108864
memqcache_max_num_cache = 1000000
memqcache_expire = 0
memqcache_auto_cache_invalidation = on
memqcache_maxcache = 409600
memqcache_cache_block_size = 1048576
memqcache_oiddir = '/var/lib/postgresql/oiddir'
white_memqcache_table_list = ''
black_memqcache_table_list = ''
pgpool.conf (6,255 bytes)   

pengbo

2021-04-27 23:02

developer   ~0003824

Thank you.
It seems a bug. I am looking into this issue.

pengbo

2021-05-05 19:13

developer   ~0003827

Fixed by the following commit:
https://git.postgresql.org/gitweb?p=pgpool2.git;a=commitdiff;h=3030044dad604ceb311c35c10d8f2319eb7f68f9

Issue History

Date Modified Username Field Change
2021-04-26 22:18 JockeTF New Issue
2021-04-26 22:18 JockeTF File Added: pgpool.conf
2021-04-27 09:57 pengbo Assigned To => pengbo
2021-04-27 09:57 pengbo Status new => assigned
2021-04-27 23:02 pengbo Note Added: 0003824
2021-05-05 19:13 pengbo Note Added: 0003827
2021-05-05 19:13 pengbo Status assigned => resolved
2021-05-05 19:13 pengbo Target Version => 4.1.7
2021-05-20 12:12 administrator Status resolved => closed
2021-05-20 12:12 administrator Fixed in Version => 4.1.7