View Issue Details
| ID | Project | Category | View Status | Date Submitted | Last Update |
|---|---|---|---|---|---|
| 0000798 | Pgpool-II | Bug | public | 2023-04-28 16:26 | 2023-05-22 11:47 |
| Reporter | chamway | Assigned To | t-ishii | ||
| Priority | normal | Severity | minor | Reproducibility | have not tried |
| Status | closed | Resolution | open | ||
| Product Version | 4.4.2 | ||||
| Target Version | 4.4.3 | Fixed in Version | 4.4.3 | ||
| Summary | 0000798: when the load_balancing_node is delay too much, a writing function call will send to standby? | ||||
| Description | /* * As streaming replication delay is too much, if * prefer_lower_delay_standby is true then elect new * load balance node which is lowest delayed, * false then send to the primary. */ if (STREAM && pool_config->delay_threshold && bkinfo->standby_delay > pool_config->delay_threshold) { ereport(DEBUG1, (errmsg("could not load balance because of too much replication delay"), errdetail("destination = %d for query= \"%s\"", dest, query))); if (pool_config->prefer_lower_delay_standby) { int new_load_balancing_node = select_load_balancing_node(); session_context->load_balance_node_id = new_load_balancing_node; session_context->query_context->load_balance_node_id = session_context->load_balance_node_id; pool_set_node_to_be_sent(query_context, session_context->query_context->load_balance_node_id); } else { pool_set_node_to_be_sent(query_context, PRIMARY_NODE_ID); } } the above judgments are parallel to those of writing functions, temporary tables, and so on, so when the load_balancing_node is delay too much and the prefer_lower_delay_standby is true, will select a lowest delay standby node, even if it is a query that contains a writing function | ||||
| Tags | No tags attached. | ||||
|
|
Before entering the code fragment you showed, send_to_where() is called: dest = send_to_where(node, query); and "dest" will be set to POOL_PRIMARY and never reaches to the code fragment. If you actually tested and find the case pgpool sends SELECT having writing functions to standby, please let us know. |
|
|
I do not seem to see the code about writing function checking in the send_to_where(). I haven't actually tested it yet. Okay, I'll simulate a test to see if it works |
|
|
Sorry, I was wrong. send_to_where() does not check whether the SELECT has writing functions or not. So the code path you mentioned was correct. However, int new_load_balancing_node = select_load_balancing_node(); select_load_balancing_node() will check standby delay and set the new load balance node id to primary if the delay is too much. So the SELECT will be sent to the primary node. |
|
|
If there is also a standby node and the delay does not exceed the threshold, it will be choiced. And the original intention here is to choose a standby with the lowest delay and not the primary, unless there is no other choice. so, maybe the judgment of replication delay in figure 2 should be moved to the position shown in figure 3 |
|
|
> If there is also a standby node and the delay does not exceed the threshold, it will be choiced. Good point. In this case pgpool may send write query to the standby node. Thank you for the suggestion to fix the code. I will take care of this. |
|
|
I would like to credit your name in the commit log if you like. What would you like to appear your name? |
|
|
that’s ok |
|
|
Ok, I have not included your name in the commit log. I just mentioned that the bug was reported and fix were suggested. https://git.postgresql.org/gitweb/?p=pgpool2.git;a=commit;h=c7f9be67e28cee86064df807f2a98920e3c47c6e Thank you so much! |
| Date Modified | Username | Field | Change |
|---|---|---|---|
| 2023-04-28 16:26 | chamway | New Issue | |
| 2023-04-28 17:23 | t-ishii | Note Added: 0004362 | |
| 2023-04-28 17:59 | chamway | Note Added: 0004363 | |
| 2023-04-28 17:59 | chamway | File Added: image.png | |
| 2023-04-28 20:21 | t-ishii | Note Added: 0004364 | |
| 2023-04-29 07:14 | t-ishii | Assigned To | => t-ishii |
| 2023-04-29 07:14 | t-ishii | Status | new => assigned |
| 2023-04-29 11:30 | chamway | Note Added: 0004365 | |
| 2023-04-29 11:30 | chamway | File Added: image-2.png | |
| 2023-04-29 11:30 | chamway | File Added: image-3.png | |
| 2023-04-29 11:30 | chamway | File Added: image-4.png | |
| 2023-04-29 17:16 | t-ishii | Note Added: 0004366 | |
| 2023-04-29 19:19 | t-ishii | Note Added: 0004367 | |
| 2023-04-30 12:01 | chamway | Note Added: 0004368 | |
| 2023-04-30 16:13 | t-ishii | Note Added: 0004369 | |
| 2023-05-16 16:18 | pengbo | Status | assigned => resolved |
| 2023-05-16 16:18 | pengbo | Target Version | => 4.4.3 |
| 2023-05-22 11:47 | administrator | Status | resolved => closed |
| 2023-05-22 11:47 | administrator | Fixed in Version | => 4.4.3 |