Skip to content

query temp table is routed to standby node. #154

@liujinyang-highgo

Description

@liujinyang-highgo

Hi,
I met an issue as below:

  • environment

    pgpool 4.6.2 with three backend nodes, one primary and two standby(weight: 0:1:1).

  • reproduce steps

    1. start pgpool
    2. create table t1(id1 int,id2 int);
    3. select * from t1; //this query will be routed to standby node
    4. drop table t1;
    5. create temp table t1(id1 int,id2 int);
    6. select * from t1; //this query will be routed to standby node and execute failed.
  • analyze

    1. in step 3. this query is routed to standby, that's OK. During the process, pgpool will check if 't1' is an temp table, since this is the first time do this query, there is no result in local cache and shared cache, so pgpool will first do query from backend and save the result to shared cached and local cache, 't1' is marked as a non-temporary table.
    2. when drop t1 and re-create t1 as a temp table, pgpool will call discard_temp_table_relcache() to clear local cache, but not clear shared cache.
    3. in step 6, do query "select * from t1;" , pgpgool will check if 't1' is temp table, can not get result from local cache, but can get the result from shared cache, result is 't1' is not an temp table , so routed to standby and execute failed.
  • concern
    so do we have any mechanism to avoid this? I know we can set expire time, but it won't take effect in a timely manner.
    in addition, unlog table,function maybe have same issue.

thanks~

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions