pgpool状态显示不正确时建议退出重新连接再检查

博客指出当pgpool显示不正确时,建议重新连接再进行检查,有助于解决pgpool显示异常问题。
pgbouncer/include/bouncer.h 有 struct PgSocket { struct List head; /* list header */ PgSocket *link; /* the dest of packets */ PgPool *pool; /* parent pool, if NULL not yet assigned */ PgUser *auth_user; /* presented login, for client it may differ from pool->user */ int client_auth_type; /* auth method decided by hba */ SocketState state:8; /* this also specifies socket location */ bool ready:1; /* server: accepts new query */ bool idle_tx:1; /* server: idling in tx */ bool close_needed:1; /* server: this socket must be closed ASAP */ bool setting_vars:1; /* server: setting client vars */ bool exec_on_connect:1; /* server: executing connect_query */ bool resetting:1; /* server: executing reset query from auth login; don't release on flush */ bool copy_mode:1; /* server: in copy stream, ignores any Sync packets */ bool wait_for_welcome:1;/* client: no server yet in pool, cannot send welcome msg */ bool wait_for_user_conn:1;/* client: waiting for auth_conn server connection */ bool wait_for_user:1; /* client: waiting for auth_conn query results */ bool wait_for_auth:1; /* client: waiting for external auth (PAM) to be completed */ bool suspended:1; /* client/server: if the socket is suspended */ bool admin_user:1; /* console client: has admin rights */ bool own_user:1; /* console client: client with same uid on unix socket */ bool wait_for_response:1;/* console client: waits for completion of PAUSE/SUSPEND cmd */ bool wait_sslchar:1; /* server: waiting for ssl response: S/N */ int expect_rfq_count; /* client: count of ReadyForQuery packets client should see */ usec_t connect_time; /* when connection was made */ usec_t request_time; /* last activity time */ usec_t query_start; /* query start moment */ usec_t xact_start; /* xact start moment */ usec_t wait_start; /* waiting start moment */ uint8_t cancel_key[BACKENDKEY_LEN]; /* client: generated, server: remote */ PgAddr remote_addr; /* ip:port for remote endpoint */ PgAddr local_addr; /* ip:port for local endpoint */ union { struct DNSToken *dns_token; /* ongoing request */ PgDatabase *db; /* cache db while doing auth query */ }; struct ScramState { char *client_nonce; char *client_first_message_bare; char *client_final_message_without_proof; char *server_nonce; char *server_first_message; uint8_t *SaltedPassword; char cbind_flag; int iterations; char *salt; /* base64-encoded */ uint8_t StoredKey[32]; /* SHA256_DIGEST_LENGTH */ uint8_t ServerKey[32]; } scram_state; VarCache vars; /* state of interesting server parameters */ SBuf sbuf; /* stream buffer, must be last */ }; 对于 tmp_login_salt ,pgbouncer/include/bouncer.h 有: /* where the salt is temporarily stored */ #define tmp_login_salt cancel_key 结合这些,重新审视下: static bool send_client_authreq(PgSocket *client) { int res; int auth_type = client->client_auth_type; if (auth_type == AUTH_MD5) { uint8_t saltlen = 4; get_random_bytes((void*)client->tmp_login_salt, saltlen); SEND_generic(res, client, 'R', "ib", AUTH_MD5, client->tmp_login_salt, saltlen); } else if (auth_type == AUTH_SM3) { // 生成SM3认证需要的盐值 uint8_t saltlen = 8; get_random_bytes((void*)client->tmp_login_salt, saltlen); SEND_generic(res, client, 'R', "ib", AUTH_SM3, client->tmp_login_salt, saltlen); } else if (auth_type == AUTH_PLAIN || auth_type == AUTH_PAM) { SEND_generic(res, client, 'R', "i", AUTH_PLAIN); } else if (auth_type == AUTH_SCRAM_SHA_256) { SEND_generic(res, client, 'R', "iss", AUTH_SASL, "SCRAM-SHA-256", ""); } else { return false; } if (!res) disconnect_client(client, false, "failed to send auth req"); return res; } 的添加的sm3部分
07-17
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值