bitflicker64 opened a new pull request, #3461:
URL: https://github.com/apache/hugegraph/pull/3461
## Purpose of the PR
Found while scanning `hugegraph-server/hugegraph-rocksdb` for small,
test-backed fixes. No issue was filed.
- `RocksDBSstSessions.doClose` skips a table whose `SstFileWriter` has no
entries by comparing the `RocksDBException` message with `"Can't create sst
file with no entries"`. The rocksdbjni version in use (8.10.2) reports `Cannot
create sst file with no entries`, so the check never matched. Closing SST
sessions with any empty table threw `BackendException: Failed to close
SstFileWriter`, and the writers after it in the map were neither finished nor
closed.
- `RocksDBStdSessions.listCFs` created an `Options` for
`RocksDB.listColumnFamilies` and never closed it, leaking a native object each
time a store is opened.
## Main Changes
- `RocksDBSstSessions.doClose`: match `"create sst file with no entries"`
with `contains`, which covers both wordings, and close the skipped writer
before moving on. Its empty `0001.sst` file stays on disk as before;
`RocksDBIngester` already skips zero-length files.
- `RocksDBStdSessions.listCFs`: open the `Options` in try-with-resources.
`listColumnFamilies` copies the names out before returning.
- `RocksDBSstSessions(HugeConfig, String, String, String, List)`: the
parameters were named `(config, dataPath, database, store)` while the only
caller, `RocksDBSstStore`, passes `(config, database, store, dataPath)`, and a
second swap in the `this(...)` call cancelled it out. Name them in the order
they are passed. Types and behaviour are unchanged.
- Add `RocksDBSessionTest.testSstSessionsCloseWithEmptyTable` (one empty
table and one with data). It goes into `RocksDBSessionTest` because
`RocksDBSessionsTest` and `UnitTestSuite` are changed by open PRs.
No public or protected signature, storage format, config key or lock changes.
## Verifying these changes
- [ ] Trivial rework / code cleanup without any test coverage. (No Need)
- [ ] Already covered by existing tests, such as *(please modify tests
here)*.
- [x] Need tests and can be verified as follows:
- Ran on Linux x86_64, OpenJDK 17.0.20.1, Maven 3.8.7, 2026-11-07, at
`76663c7b4`.
- Before the fix (`RocksDBSstSessions.java` checked out from master, new
test kept):
`mvn -ntp -B test -pl hugegraph-server/hugegraph-test -am -P unit-test
-Deditorconfig.skip=true -Dmaven.javadoc.skip=true -Dtest='RocksDBSessionTest'
-Dsurefire.failIfNoSpecifiedTests=false`
`testSstSessionsCloseWithEmptyTable` fails at `close()`:
`BackendException: Failed to close SstFileWriter`.
- With the fix:
`mvn -ntp -B test -pl hugegraph-server/hugegraph-test -am -P unit-test
-Deditorconfig.skip=true -Dmaven.javadoc.skip=true`
Result: BUILD SUCCESS, `UnitTestSuite` ran 1427 tests, 0 failures, 0
errors, 8 skipped, including the new test. A branch with master's tests (#3459)
ran 1426 on the same host.
- `-Deditorconfig.skip=true` is there because master fails the
editorconfig check on `helm/hugegraph/docs/rag.md` (missing final newline), a
file this PR does not touch.
## Does this PR potentially affect the following parts?
- [ ] Dependencies ([add/update
license](https://hugegraph.apache.org/docs/contribution-guidelines/contribute/#321-check-licenses)
info &
[regenerate_known_dependencies.sh](../install-dist/scripts/dependency/regenerate_known_dependencies.sh))
- [ ] Modify configurations
- [ ] The public API
- [ ] Other affects (typed here)
- [x] Nope
## Documentation Status
- [ ] `Doc - TODO`: required documentation is pending; complete it before
merging.
- [ ] `Doc - Done`: documentation is included here or linked below.
- [x] `Doc - No Need`: no user-visible documentation is affected.
--
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]