Skip to content

fix: codebase review — bugs, quality, and naming consistency#875

Merged
JohannesLichtenberger merged 3 commits intomainfrom
fix/codebase-review-fixes
Feb 20, 2026
Merged

fix: codebase review — bugs, quality, and naming consistency#875
JohannesLichtenberger merged 3 commits intomainfrom
fix/codebase-review-fixes

Conversation

@JohannesLichtenberger
Copy link
Member

Summary

Comprehensive codebase review with fixes across security, bugs, code quality, and naming consistency.

Bug fixes (40b4efce6)

  • Resource ID off-by-one in LocalDatabase.createResource — used post-increment ID for map entry instead of actual resource ID
  • FMSE namespace self-compare — compared wtx prefix against itself instead of rtx, causing incorrect namespace matching
  • FMSE assert rejected COMMENT nodes in emitUpdate
  • Path traversal in beginResourceSession — no validation against ../ in resource names
  • Async fsync silent error lossCompletableFuture had no error handler; close() didn't catch CompletionException
  • Volatile race on pendingFsync — read/use was non-atomic
  • deleteOnExit() memory leak in commit path — accumulated shutdown hook entries on every commit
  • Stale bytes cache in KeyValueLeafPage.setRecord() — didn't invalidate cached serialized form
  • NPE on unboxing in getResourceID() for unknown names
  • Failed createResource cleanup didn't remove stale map entry

Code quality (7b8da5fec)

  • Replace star imports with explicit imports across 19 files
  • Deduplicate three insertSubtree() overloads in JsonNodeTrxImpl into shared insertSubtreeInternal() with functional parameters
  • Eliminate RecordFetchResult wrapper — unnecessary allocation on read hot path
  • Null guard in IndirectPage.getOrCreateReference() — fail-fast with descriptive error instead of silent null
  • Integer overflow checks in LZ4 compress for longint casts
  • Narrow catch(Exception) in parallel serialization to preserve RuntimeException stack traces

Naming consistency (293d2be11)

  • Rename ~260 stale pageTrx/pageRtx/pageWriteTrx/pageReadTrx variable names, field names, parameter names, and method names to storageEngineReader/Writer across ~70 files
  • Rename ~30 stale "resource manager" references in Javadoc/comments to "resource session" across ~30 files
  • Fix "ressource" typos

Test plan

  • ./gradlew :sirix-core:test — all tests pass
  • ./gradlew :sirix-query:test — all tests pass
  • Compilation verified after each commit

Johannes Lichtenberger added 3 commits February 20, 2026 21:00
- Fix resource ID off-by-one in LocalDatabase.createResource (used
  post-increment ID instead of actual resource ID for map entry)
- Fix FMSE namespace self-compare bug (compared wtx prefix against
  itself instead of rtx)
- Fix FMSE assert that rejected COMMENT nodes in emitUpdate
- Add path traversal validation in beginResourceSession
- Fix async fsync silent error loss with logging and close() handling
- Fix volatile race on pendingFsync by assigning to local var
- Remove deleteOnExit() memory leak in commit path
- Invalidate cached bytes in KeyValueLeafPage.setRecord()
- Fix NPE on unboxing in getResourceID for unknown names
- Clean up stale map entry on failed createResource
- Replace star imports with explicit imports across 19 files
- Deduplicate three insertSubtree() overloads in JsonNodeTrxImpl into
  shared insertSubtreeInternal() with functional parameters
- Eliminate RecordFetchResult wrapper allocation on read hot path
- Add null guard with descriptive error in IndirectPage.getOrCreateReference
- Add integer overflow checks in LZ4 compress for long-to-int casts
- Narrow catch(Exception) in parallel serialization to preserve
  RuntimeException stack traces
Rename remaining pageTrx/pageRtx/pageWtx variable names, field names,
parameter names, method names, and Javadoc to use the new
storageEngineReader/Writer naming convention (~260 occurrences across
~70 files).

Rename remaining "resource manager" references in Javadoc, comments,
and identifiers to "resource session" (~30 files). Also fix "ressource"
typos.

Key identifier renames:
- pageTrxMap → storageEngineReaderMap
- nodePageTrxMap → storageEngineWriterMap
- pageTrxIDCounter → storageEngineIDCounter
- createPageTrxPool() → createStorageEnginePool()
- createPageTrx() → createStorageEngineWriter()
- setPageTrx() → setStorageEngineWriter()
- getPageRtx() → getStorageEngineReader()
- resourceManagerFactory() → resourceSessionFactory()
- resourceManagers → resourceSessions
- PAGE_READ_TRX → STORAGE_ENGINE_READER
@JohannesLichtenberger JohannesLichtenberger merged commit fe77682 into main Feb 20, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant