Repository navigation
oracledb_cdc: add default connection read timeout - #4898
Conversation
1c222fe to
5c75f0a
Compare
6f6824a to
0cf8bb9
Compare
a2a940c to
d988a16
Compare
| Large transactions and driver fetch size: left to itself, the Oracle driver sizes each fetch to roughly 128 KiB based on the declared maximum width of the selected columns. As a result, wide columns such as LogMiner's redo SQL yield only a handful of rows per network round trip. This can make large committed transactions appear minutes late while the database, network and connector all look idle. Each round trip costs a full network exchange, and a large transaction requires thousands of them. The connector therefore fetches ` + "`" + ociFieldPrefetchRows + "`" + ` rows per round trip (500 by default). Raise it for large transactions over high-latency links. A ` + "`PREFETCH_ROWS`" + ` query parameter in ` + "`" + ociFieldConnectionString + "`" + ` takes precedence over the field. | ||
| Unresponsive databases: if the database stops responding without closing the connection, a query can wait indefinitely while the input still reports as connected. The connector therefore limits each network read from and write to the database to ` + "`" + ociFieldSocketTimeout + "`" + ` seconds. When it's exceeded, the query fails, and the input reconnects and resumes from its last checkpoint. Recovery can take a few multiples of ` + "`" + ociFieldSocketTimeout + "`" + `, because shutting down the stalled session and each failed reconnect attempt also wait for it. The limit applies to every individual read and write on every connection the input opens, including snapshot queries. It is not a limit on a whole query, because it restarts with each read or write. It must exceed the longest time Oracle takes to return the first rows of any query. A ` + "`TIMEOUT`" + `, ` + "`READ TIMEOUT`" + ` or ` + "`SOCKET TIMEOUT`" + ` query parameter in ` + "`" + ociFieldConnectionString + "`" + `, matched case-insensitively, takes precedence over the field. |
There was a problem hiding this comment.
The new "Unresponsive databases" paragraph says recovery waits on "shutting down the stalled session," but this same PR adds closeDBInBackground (lines 1031-1038) specifically so the discarded pool closes without blocking reconnection — its own comment says "closes a discarded pool without blocking the reconnect." The claim contradicts the code it documents; per the writing standard, a description must state current behavior only.
Unresponsive databases: if the database stops responding without closing the connection, a query can wait indefinitely while the input still reports as connected. The connector therefore limits each network read from and write to the database to ` + "`" + ociFieldSocketTimeout + "`" + ` seconds. When it's exceeded, the query fails, and the input reconnects and resumes from its last checkpoint. Recovery can take a few multiples of ` + "`" + ociFieldSocketTimeout + "`" + `, because each reconnect attempt can itself take that long before it succeeds or fails. The limit applies to every individual read and write on every connection the input opens, including snapshot queries. It is not a limit on a whole query, because it restarts with each read or write. It must exceed the longest time Oracle takes to return the first rows of any query. A ` + "`TIMEOUT`" + `, ` + "`READ TIMEOUT`" + ` or ` + "`SOCKET TIMEOUT`" + ` query parameter in ` + "`" + ociFieldConnectionString + "`" + `, matched case-insensitively, takes precedence over the field.
doc-strings-review:fp=574b143f02f1a4f4
There was a problem hiding this comment.
This level of technical detail feels unnecessary for the documentation. I'm leaning more towards leaving it as "general connection shutdown" behaviour.
Connect docs checkThe docs build passed with this PR's generated docs. Preview: https://connect-pr-4898--redpanda-connect.netlify.app/connect/home/ This PR changes 1 published page (5 generated files: 5 changed, 0 added, 0 removed). Review the rendered pages, not only the Go strings.
Per-file diffs and the rendered-HTML findings are in the job summary. Checked at 9eb7c39. |
2fad6af to
12b7d57
Compare
- Rebuild the internal checkpoint cache on reconnect alongside the main pool. go-ora does not mark a connection bad on a read timeout, so a pooled cache connection could read a late reply to a timed-out query as its own. - Log a hint naming socket_timeout when snapshotting, streaming or connecting fails with a socket timeout, since the driver only reports "i/o timeout". - Move the socket timeout check to the replication package and test it against go-ora with a listener that never replies. - Parse connection_string with redact.ParseURL, matching main. - Mark socket_timeout as added in 4.120.0.
12b7d57 to
b67132a
Compare
This change adds a
socket_timeoutconfiguration setting (in seconds as that's what Oracle supports) to the Oracle connector that's passed to thego-oradriver via the connection string (ieoracle://c%23%23testdb:testdb123@localhost:1521/FREE?TIMEOUT=300) so a read from an Oracle database that stops responding fails and the input reconnects instead of waiting for a response.If the connection string already contains the
TIMEOUTflag then that takes precedence.The default is 300 seconds (5m) and 0 turns it off (which is the current default before this change).
Proof of Work
Using Toxiproxy to leave the TCP connection up but block read traffic to the connector shows it timeouts, eventually disconnecting. Once the toxic is removed then it reconnects and continues streaming.