MagicStack / MagicStack/asyncpg
Cockroachdb unimplemented feature multiple active portals not supported
まだ誰も着手していません。
- 主要言語
- Python
- スター
- 8.1k
- フォーク
- 468
- PR マージ指標
- 30日以内にマージされた PR はありません
説明
* **asyncpg version**: 0.20.1
* **Cockroachdb version**: v20.1.0 (connected to a 5-node on premise cluster)
* **Python version**: 3.8.0
* **Platform**: Linux
* **Do you use pgbouncer?**: No
* **Did you install asyncpg with pip?**: Yes
Example code:
```python
async with pool.acquire() as conn:
async with conn.transaction():
if not await conn.table_exists("sys_app_config"):
await conn.execute("""
CREATE TABLE sys_app_config(
key text NOT NULL PRIMARY KEY,
value jsonb
);
""")
```
The table_exists method looks like this:
```python
class MyConnection(Connection):
async def table_exists(self, table_name: str) -> bool:
"""Tell if a table exists."""
return await self.fetchval(
"select table_name from information_schema.tables where table_name=$1", table_name) is not None
```
This code is actually called from tornado.ioloop.IOLoop.current().run_sync so it is guaranteed that nothing else is running queries concurrently.
Here is the traceback that I'm getting:
```
File "/home/user/my_project/db/initialize.py", line 19, in init_database
if not await conn.table_exists("sys_app_config"):
File "/home/user/.local/share/virtualenvs/backend-YgzYW8Ky/lib/python3.8/site-packages/asyncpg/transaction.py", line 91, in __aexit__
await self.__commit()
File "/home/user/.local/share/virtualenvs/backend-YgzYW8Ky/lib/python3.8/site-packages/asyncpg/transaction.py", line 179, in __commit
await self._connection.execute(query)
File "/home/user/.local/share/virtualenvs/backend-YgzYW8Ky/lib/python3.8/site-packages/asyncpg/connection.py", line 272, in execute
return await self._protocol.query(query, timeout)
File "asyncpg/protocol/protocol.pyx", line 316, in query
asyncpg.exceptions.FeatureNotSupportedError: unimplemented: multiple active portals not supported
HINT: You have attempted to use a feature that is not yet implemented.
See: https://github.com/cockroachdb/cockroach/issues/40195
```
The referenced issue tells that it is not possible to keep multiple queries open and fetch from them interleaved.
However, I'm not doing anything that should result in opening multiple queries and fetching from them that way. As far as I see, my code should not open a new query before closing the previous one.
I suspect that asyncpg itself forgot to close something in the background.
コントリビューションガイド
このリポジトリのコントリビューションガイドは索引されていません
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
asyncpg/transaction.py のトランザクションコミットパスから開始し、続いて execute と query の周辺にある asyncpg/connection.py および asyncpg/protocol/protocol.pyx を調査してください。指定された CockroachDB のセットアップに対して table_exists の例を再現し、コミット前にドライバーがアクティブなポータルを残すかどうかを追跡してください。完了とは、ドライバーの動作を特定するか、データベースの非互換性を確認し、その証拠を文書化することです。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- postgresql, python
- 領域
- backend, databases
- issue の種類
- バグ
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 活発さ
- 停滞
- 明瞭さ
- 説明が足りない
- 初心者へのやさしさ
- 28/100