View Issue Details

IDProjectCategoryView StatusLast Update
0000109Pgpool-IIBugpublic2014-08-24 10:18
ReportertkazmierczakAssigned Tot-ishii 
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionopen 
PlatformLinuxOSCentOSOS Version6.4
Product Version 
Target VersionFixed in Version 
Summary0000109: Query prefixed with any comment (/* ... */) triggers NO LOAD BALANCE mode
DescriptionWhile trying to make use of the /*NO LOAD BALANCE*/ sql hint I realized that query prefixed by any sql hint is always sent to the master node.

I'm working with pgpool in master/slave mode with postgresql 9.3 nodes.
Steps To ReproduceIn pgpool, set weight for standby to 1, and 0 to master.

psql -tA -U postgres -c 'select inet_server_addr()' -> shows standby ip
psql -tA -U postgres -c '/*NO LOAD BALANCE*/ select inet_server_addr()' -> shows master ip
psql -tA -U postgres -c '/*DUMMY COMMENT*/ select inet_server_addr()' -> shows master ip

the latter one should show the standby IP, as the hint is not a proper NO LOAD BALANCE hint
TagsNo tags attached.

Activities

tkazmierczak

2014-07-31 20:07

reporter   ~0000458

BTW it would be totally great if white spaces between "/*", "*/" and the hint name could also be permitted. Unfortunately the hibernate query setComment method always inserts space after "/*" and then the hint body.

t-ishii

2014-08-01 07:56

developer   ~0000459

Because the query does not start with "SELECT", it's not load balanced.
It's explicitly stated in the doc. See "condition for load balancing" section for more details.

tkazmierczak

2014-08-01 16:49

reporter   ~0000460

Yes, I can see know. I was misleaded by the statement "SELECT can be forced to be executed on the master as well, but for this you need to put a /*NO LOAD BALANCE*/ comment before the SELECT statement." in Master/Slave Mode section of the documentation.

Any plans on changing the behavior?

t-ishii

2014-08-21 10:58

developer   ~0000466

Sorry for delay. What do you exactly want?
Do you want to put a SQL comment without disturbing load balancing? (i.e. pure SQL comment)

tkazmierczak

2014-08-21 15:50

reporter   ~0000467

Yes exactly, I'd like the C style comments not to disturb load balancing. For my local purposes I modified the function is_select_query(Node *node, char *sql) in pool_process_query.c by allowing the select to start with "/*" chars and it seems to work as expected.

t-ishii

2014-08-24 08:42

developer   ~0000470

I have implemented new parameter called "allow_sql_comments" for upcoming 3.4, which allows to use SQL comments without disturbing load balancing.

Issue History

Date Modified Username Field Change
2014-07-31 19:52 tkazmierczak New Issue
2014-07-31 20:07 tkazmierczak Note Added: 0000458
2014-08-01 07:56 t-ishii Note Added: 0000459
2014-08-01 07:56 t-ishii Assigned To => t-ishii
2014-08-01 07:56 t-ishii Status new => assigned
2014-08-01 16:49 tkazmierczak Note Added: 0000460
2014-08-21 10:58 t-ishii Note Added: 0000466
2014-08-21 10:58 t-ishii Status assigned => feedback
2014-08-21 15:50 tkazmierczak Note Added: 0000467
2014-08-21 15:50 tkazmierczak Status feedback => assigned
2014-08-24 08:42 t-ishii Note Added: 0000470
2014-08-24 10:18 t-ishii Status assigned => resolved