fix: codebase review — bugs, quality, and naming consistency#875
Merged
JohannesLichtenberger merged 3 commits intomainfrom Feb 20, 2026
Merged
fix: codebase review — bugs, quality, and naming consistency#875JohannesLichtenberger merged 3 commits intomainfrom
JohannesLichtenberger merged 3 commits intomainfrom
Conversation
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
293d2be to
ac9f999
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Comprehensive codebase review with fixes across security, bugs, code quality, and naming consistency.
Bug fixes (
40b4efce6)LocalDatabase.createResource— used post-increment ID for map entry instead of actual resource IDwtxprefix against itself instead ofrtx, causing incorrect namespace matchingemitUpdatebeginResourceSession— no validation against../in resource namesCompletableFuturehad no error handler;close()didn't catchCompletionExceptionpendingFsync— read/use was non-atomicdeleteOnExit()memory leak in commit path — accumulated shutdown hook entries on every commitbytescache inKeyValueLeafPage.setRecord()— didn't invalidate cached serialized formgetResourceID()for unknown namescreateResourcecleanup didn't remove stale map entryCode quality (
7b8da5fec)insertSubtree()overloads inJsonNodeTrxImplinto sharedinsertSubtreeInternal()with functional parametersRecordFetchResultwrapper — unnecessary allocation on read hot pathIndirectPage.getOrCreateReference()— fail-fast with descriptive error instead of silent nulllong→intcastscatch(Exception)in parallel serialization to preserveRuntimeExceptionstack tracesNaming consistency (
293d2be11)pageTrx/pageRtx/pageWriteTrx/pageReadTrxvariable names, field names, parameter names, and method names tostorageEngineReader/Writeracross ~70 filesTest plan
./gradlew :sirix-core:test— all tests pass./gradlew :sirix-query:test— all tests pass