Oracle: a compiled Cypher statement kept in the driver's statement cache holds megabytes of PGA, and a few dozen run the instance out (ORA-04036)
Maintainer thường phản hồi trong vòng 1 ngày
Một pull request liên quan đã được merge.
- #221 của @jasperblues — đã merge
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 57/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- postgresql, python
- Lĩnh vực
- database, performance
Hướng nghiên cứu
Start with drivine/connection/oracle/oracle_connection.py and drivine/sync/connection/oracle/oracle_connection.py, then check how OracleConnection.query and open_cursor prepare and execute Cypher statements. Port the described long-text memory test, measuring session PGA through v$sesstat as system; done means Cypher statements avoid the driver's statement cache and the test stays below 200 MB.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Port of liberation-data/drivine4j#313.
What happens here now. On Oracle, Oracle keeps a cursor's memory for as long as the driver keeps its statement in its statement cache. In drivine4j a compiled Cypher statement held about 4 MB of PGA while cached, 7 MB at 5,000 characters, and 10 to 24 MB when it read a text past 32 KB. A few dozen distinct statements took the instance from 300 MB to over 1.3 GB on one session. With more sessions that runs past Oracle Free's 2 GB PGA_AGGREGATE_LIMIT (ORA-04036). The memory is held on the server, not in the client, so any driver that caches the statement does the same.
OracleConnection.query and open_cursor (drivine/connection/oracle/oracle_connection.py:61 and :88, and drivine/sync/connection/oracle/oracle_connection.py:63 and :90) run a compiled Cypher statement with python-oracledb's default statement cache (stmtcachesize 20 per connection). The pool is set up in oracle_connection_provider.py with max=pool_max. So up to 20 compiled statements per session stay cached, each holding megabytes. This isn't measured here yet, but the cause is on the server side.
The fix in drivine4j (liberation-data/drivine4j#352): a statement compiled from Cypher isn't kept in the driver's cache on Oracle (statement.isPoolable = false), so it is closed when it ends. Drivine's own statements stay cached. The python-oracledb equivalent is cursor.prepare(statement, cache_statement=False) before execute, done only when the statement came from Cypher.
Tests to port.
OracleLongTextMemoryTest: 90 distinct long-text statements (givenWITH $t AS t, storedMATCH (n) WITH n.t AS t, madeWITH $a + $b AS t, each withleft(t, size(t) - i)) on one session. It reads that session'ssession pga memoryfromv$sesstatassystemand asserts it grew by less than 200 MB. In drivine4j it grew by 1,134 MB before the fix and by 37 MB after.- The long-text test now runs stored and made texts at 40,000 characters too, not only given ones.
- Ngôn ngữ chính
- Python
- Star
- 1
- Fork
- 0
- Merge trung bình
- 1 giờ 19 phút
- Pull request đã merge (30 ngày)
- 122
Chuẩn bị môi trường
Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của liberation-data/drivine-python
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
liberation-data/drivine-python#252 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
liberation-data/drivine-python#250 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 88/100
liberation-data/drivine-python#209 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
CI: three Oracle-only tests in test_cypher_compiled.py never run, as -k oracle doesn't select themĐang mở
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 88/100
liberation-data/drivine-python#178 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 58/100
liberation-data/drivine-python#243 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của liberation-data/drivine-python
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
btclib-org/btclib-ecc#404 ·
-
changelog investigate
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 78/100
ramnes/notion-sdk-py#430 ·
-
bug good first issue
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 91/100
hyeonjoong/debussy#56 ·
-
README устарел: статус проекта, версия 0.1.0 при описании тега v0.1.1, семантика фолбэка поискаĐang mởdocumentation
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
Lagrunge82/yandex-mail-mcp#43 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
noontide-co/mainbranch#1256 · 1 bình luận ·