Prepared Statement connection is active and wait for ClientRead.
まだ誰も着手していません。
評価
- 難易度
- 5/5
- 見積もり時間
- 1週間以上
- 初心者へのやさしさ
- 30/100
調査の方向性
issue で説明されている asyncpg の prepared-statement フローと、PostgreSQL の extended-query プロトコルのドキュメントから始めます。複数の Bind/Execute ステップがある場合に、Flush/Sync のシーケンスを変更しても正しさを維持できるか判断します。完了の条件は、prepared statements を壊すことなく、pg_stat_activity が接続状態を一貫して報告することです。
索引モデルが issue の本文から書いたものです。
説明
Hi team,
Right now, asyncpg does prepared statements in two steps.
- Parse, Describe, Flush.
- Bind, Execute, Sync.
Two coroutines represent these two steps. In a highly concurrent setup, the wall-clock gap between these two steps can be large. Why is it causing a problem for me? Command Flush does not change the connection state, i.e., active. So I observe a lot of queries show up as
wait_event_type | wait_event | state
-----------------+------------+--------
Client | ClientRead | active
in pg_stat_activity. This causes a lot of unnecessary confusion for our database monitors/observability tools. The connection is essentially idle between these two steps, so I think it is better to report it as wait_event=ClientRead but state=idle? Meanwhile, the command Sync will change the connection state to idle, so after step 2, the connection becomes idle.
My ask is: could we use Sync instead of Flush in step 1?
Moreover, there could be more than one bind step, so the sequence could be
1. Parse, Describe, Flush.
2. Bind, Execute, Sync.
3. Bind, Execute, Sync.
...
In this case, the connection is active only between step 1 and step 2, but idle for all other step gaps. I kind of feel this behavior is inconsistent.
I might have neglected some basic design about PostgreSQL extended query. Hope to hear from you soon!
- 主要言語
- Python
- スター
- 8.1k
- フォーク
- 469
- 平均マージ
- 18分
- マージ済み PR(30日)
- 4
コントリビューションガイド
このリポジトリのコントリビューションガイドは索引されていません
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
MagicStack/asyncpg のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
MagicStack/asyncpg#1357 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
MagicStack/asyncpg#1328 ·
-
tests fail in 2032 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
MagicStack/asyncpg#997 ·
-
Connection.close(timeout=) waits forever on a pending cancel when the server never acknowledges it オープン
難易度 4/5 3〜5日 初心者へのやさしさ 68/100
MagicStack/asyncpg#1356 ·
-
難易度 5/5 1週間以上 初心者へのやさしさ 25/100
MagicStack/asyncpg#1355 · リアクション 3 件 ·
MagicStack/asyncpg の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
qgis/QGIS-Documentation#11275 ·
-
bug priority:normal ready-for-dev
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
OpenHands/extensions#626 · コメント 1 件 ·
-
難易度 1/5 1時間未満 初心者へのやさしさ 90/100
CSCfi/sd-search-api#39 ·
-
難易度 1/5 1時間未満 初心者へのやさしさ 90/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
StevenBlack/hosts#3255 ·