Commit f6a04fe
Feature/sdb select item replace support (#819)
* docs: add DeweyIDs and secondary index types to architecture
- Add DeweyID Index to the Primary Indexes diagram
- Document DeweyID storage (inline in KeyValueLeafPages) and benefits
- Add comprehensive Secondary Index Types section with:
- Path Index: PCR → NodeKeys mapping, use cases
- Name Index: QNm hash → NodeKeys mapping, use cases
- CAS Index: Value+Path → NodeKeys mapping, range query support
- Include visual examples for each index type
* docs: add DeweyIDs and secondary index types to architecture
- Add DeweyID Index to the Primary Indexes diagram
- Document DeweyID storage (inline in KeyValueLeafPages) and benefits
- Add comprehensive Secondary Index Types section with:
- Path Index: PCR → NodeKeys mapping, use cases
- Name Index: QNm hash → NodeKeys mapping, use cases
- CAS Index: Value+Path → NodeKeys mapping, range query support
- Include visual examples for each index type
* Update terminology from 'document store' to 'node store'
* Revise Document Store vs. Node Store section
Updated the comparison between Document Store and Node Store to enhance clarity and detail.
* refactor: rename IndexBackendType.HOT_TRIE to HOT
HOT stands for Height-Optimized Trie, so HOT_TRIE was redundant.
Also includes architecture documentation improvements:
- Add DeweyIDs and secondary index types documentation
- Fix various accuracy issues in diagrams and examples
- Update default SLIDING_SNAPSHOT window to 4
- Add PostOrderAxis and LevelOrderAxis to spatial axes
- Add between-timestamps transaction example
* feat(io): Add page checksum verification with XXH3
- Add PageHasher utility class for fast XXH3 hashing (~15 GB/s) with
backward compatibility for SHA-256 hashes from legacy databases
- Add SirixCorruptionException for detailed corruption error reporting
- Add verifyChecksumsOnRead configuration option (default: false)
- Update all writers (FileChannel, File, IOUring, MMFile) to use XXH3
- Update all readers to verify checksums when enabled:
- Non-KVLP pages: verify on compressed bytes before decompression
- KVLP pages: verify on uncompressed bytes after decompression
- Ensure page fragment hashes are propagated for verification
- Add comprehensive unit tests for PageHasher, SirixCorruptionException,
and configuration
Hash algorithm is auto-detected by length (8 bytes = XXH3, 32 bytes = SHA-256)
for seamless backward compatibility with existing databases.
* perf: Replace ByteBuffer with zero-allocation bit manipulation for hashing
High-performance optimizations aligned with financial/HFT system best practices:
- HashAlgorithm enum now uses direct bit manipulation for longToBytes/bytesToLong
instead of ByteBuffer allocations (eliminates heap allocation in hot paths)
- Added zero-allocation long-based API (computeHashLong, verifyLong) as primary
interface for verification hot paths
- PageHasher now provides both:
- Default XXH3 convenience methods (compute(byte[]), computeLong(byte[]))
- Explicit algorithm methods for extensibility
- ResourceConfiguration now includes hashAlgorithm field (defaults to XXH3)
for future algorithm extensibility
- All writers/readers updated to use the new API
- Added HASH_LENGTH and DEFAULT_ALGORITHM constants for HFT-style clarity
Zero-copy design preserved: native MemorySegments still use direct address hashing.
Verification hot path uses primitive long comparison instead of Arrays.equals().
* fix: Use consistent compressed-data hashing for all page types
The checksum verification was failing because:
- KVLP pages computed hash on UNCOMPRESSED data
- Non-KVLP pages computed hash on COMPRESSED data
- Verification tried to detect KVLP from first byte of COMPRESSED data,
which doesn't work since LZ4 compressed data doesn't preserve the page type
Fix: All page types now consistently hash COMPRESSED data. This:
- Simplifies the verification logic (no KVLP special cases)
- Avoids the impossible task of detecting page type from compressed bytes
- Provides consistent behavior across all storage backends
Removed:
- KVLP-specific hash computation in PageKind.serializePage
- KVLP-specific verification methods in AbstractReader and FileReader
- KVLP detection from compressed data in verifyChecksumIfNeeded
* fix: Remove unused PageHasher import from PageKind
* fix: Remove broken RevisionIndex benchmark files
These files referenced non-existent io.sirix.io.RevisionIndex class
and used JMH annotations in the wrong source set (main instead of jmh).
* feat: Implement UpdatableJsonItem interface for sdb:select-item replace support
This commit implements support for using sdb:select-item as a target
in 'replace json value of' expressions in JSONiq.
Changes:
- JsonDBItem.java: Extend UpdatableJsonItem interface with default
replaceValue() implementation that navigates to parent and performs
the replacement
- JsonItemSequence.java: Add replaceValue() static method that handles
different node types (object values, array elements) for replacement
- libraries.gradle: Update Brackit dependency to 0.6-SNAPSHOT
This change requires the corresponding Brackit changes in the
feature/sdb-select-item-replace-support branch.
---------
Co-authored-by: Johannes Lichtenberger <johannes.lichtenberger@sirix.io>1 parent 3e5e111 commit f6a04fe
3 files changed
Lines changed: 136 additions & 5 deletions
File tree
- bundles/sirix-query/src/main/java/io/sirix/query/json
Lines changed: 21 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
| 4 | + | |
4 | 5 | | |
| 6 | + | |
5 | 7 | | |
6 | 8 | | |
7 | | - | |
| 9 | + | |
8 | 10 | | |
9 | 11 | | |
10 | 12 | | |
11 | 13 | | |
12 | 14 | | |
13 | 15 | | |
14 | 16 | | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
15 | 34 | | |
Lines changed: 113 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
4 | 14 | | |
5 | 15 | | |
| 16 | + | |
| 17 | + | |
6 | 18 | | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
7 | 25 | | |
| 26 | + | |
8 | 27 | | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
9 | 31 | | |
10 | 32 | | |
11 | 33 | | |
| |||
94 | 116 | | |
95 | 117 | | |
96 | 118 | | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
97 | 209 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
21 | | - | |
| 21 | + | |
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
| |||
56 | 56 | | |
57 | 57 | | |
58 | 58 | | |
59 | | - | |
| 59 | + | |
60 | 60 | | |
61 | 61 | | |
62 | 62 | | |
| |||
0 commit comments