koyr-exem opened a new pull request, #909:
URL: https://github.com/apache/hugegraph-toolchain/pull/909
## Purpose of the PR
- close #908
`JDBCFetcher` sets the fetch size on the `ResultSet` after `executeQuery`
and leaves auto-commit on. The PostgreSQL
driver (and MySQL by default) therefore buffers the whole table in memory,
and large JDBC sources fail with
`OutOfMemoryError: Java heap space` regardless of `batch_size`.
## Main Changes
- Set `fetchSize` (= `batch_size`) on the `Statement` **before**
`executeQuery`.
- Turn off auto-commit before creating the statement, which PostgreSQL needs
to use a cursor. The fetcher is read-only;
if a driver does not support it, log a warning and keep the driver default.
## Verifying these changes
- [x] Need tests and can be verified as follows:
- PostgreSQL 16, 1,000,000-row table (~301 MB), loader run with `-Xmx256m`:
- before: `OutOfMemoryError: Java heap space`
- after: all 1,000,000 vertices inserted (input read / parse / insert
success 1,000,000, failure 0)
- before, with `-Xmx1g`: OK (process peak ~910 MB), so memory grows with
the table size
## Does this PR potentially affect the following parts?
- [ ] Dependencies
- [ ] Modify configurations
- [ ] The public API
- [ ] Other affects
- [x] Nope
## Documentation Status
- [x] `Doc - No Need`
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]