Repository navigation
fix(#5712,#9074,#9169): unordered tagged hash buckets, NULL_STRATEGY ERROR on hash, new page size defaults - #9222
Conversation
…ATEGY ERROR on hash, 4KB/16KB default page size - hash bucket pages (file version 2) append entries and slots, with a 1-byte hash tag per slot scanned on lookup; version 1 files keep the sorted layout and still open - a rebuild moves a legacy index to the current layout and replaces its 64KB default page size - default page size 4KB (16KB for STRING/BINARY/DECIMAL keys) from the design-space benchmark - NULL_STRATEGY ERROR is enforced by hash indexes at commit, like LSM - lookups on an index with a damaged key type metadata keep reporting the actionable error
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configuration
📒 Files selected for processing (8)
Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 1 remain after this review. 📝 WalkthroughWalkthroughThe HASH index now uses an unordered, hash-tagged layout for new index files and continues to read the legacy sorted layout. Page-size defaults vary by key type. Immediate puts also check the configured null strategy. New tests cover layout behavior, null handling, and equality lookups. ChangesHASH index layout and validation
Priority: ➖ Normal Estimated code review effort: 4 (Complex) | ~45 minutes Change: Bug fix · Severity of issue fixed: Medium Suggested reviewers: Merge Risk: ⚪ Minimal · up to The examined lookup, deletion, and null-validation paths show no confirmed issue preventing merge after normal checks. Security Architecture ReviewSecurity architecture risk: 🟡 Moderate · up to The format change affects upgrade and rollback compatibility. Newly enforced null validation can also make rebuilding a legacy index fail after the original index has been removed, putting index availability and data-integrity enforcement continuity at risk. Retained concerns
Security review detailsSecurity Blast Radius
Security Findings and Attack Paths
Trust Boundaries and Controls
Resilience and Maintainability Implications
Hardening Proposals
🚥 Pre-merge checks | ✅ 2 | ❌ 3❌ Failed checks (3 warnings)
✅ Passed checks (2 passed)
Full details: Linked Issues checkExplanation The PR implements the unordered tagged layout and legacy-layout support in Full details: Out of Scope Changes checkExplanation The page-size default changes to 4 KB and 16 KB exceed the layout change proposed by
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
This pull request does not currently match the merge queue conditions, so it cannot be queued from here. The box comes back if it matches again. |
Not up to standards ⛔🔴 Issues
|
| Category | Results |
|---|---|
| Complexity | 1 medium |
🟢 Metrics 24 complexity
Metric Results Complexity 24
🟢 Coverage 95.10% diff coverage · -5.78% coverage variation
Metric Results Coverage variation ✅ -5.78% coverage variation Diff coverage ✅ 95.10% diff coverage Coverage variation details
Coverable lines Covered lines Coverage Common ancestor commit (1addb51) 212235 180550 85.07% Head commit (8653fbb) 244879 (+32644) 194174 (+13624) 79.29% (-5.78%) Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch:
<coverage of head commit> - <coverage of common ancestor commit>Diff coverage details
Coverable lines Covered lines Diff coverage Pull request (#9222) 102 97 95.10% Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified:
<covered lines added or modified>/<coverable lines added or modified> * 100%
NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.
|
Review I read the full diff and traced the page-level code paths by hand. I did not build or run the tests, so the 2477-test result in the description is taken from the author. Summary The change looks correct, and the layout-version split is cleanly done. The new bucket layout is unordered, appends entries and slots, and adds a 1-byte hash tag per slot. Version-1 files keep the sorted binary-search path. Checked and fine
Issues and suggestions
Overall this looks good to merge once the style nit (1) is addressed. The test additions in (3) would be nice to have. |
…ayout test, direct null put/remove, concurrent reads)
ReviewI read the diff and traced the bucket-page logic. The unordered/tagged layout looks correct, and the tests cover both layouts. I have two behavior questions and a few smaller points. What I checked and found correct
Concerns
Minor
TestsCoverage is good: both layouts run through insert, lookup, remove, reopen, rebuild and tiny pages (splits and overflow), plus null-strategy cases for the SQL and direct API paths. It would be worth adding one case where the tag byte collides (two different keys with the same low byte in one bucket) so the full-key comparison on a tag hit is exercised deliberately rather than by chance. Also one case that mixes remove and re-insert on the same page in the tagged layout, to exercise the last-slot swap with tags. Nothing here blocks the merge from a correctness view. Items 1 and 2 are the ones I would resolve or document before merging. |
…share the null check message with LSM; skewed non-unique benchmark
ReviewI read the full diff of the three engine files and traced the bucket-page paths. I did not build or run the tests. Two earlier reviews on this PR already covered the tag/compaction/swap-remove/split correctness points and I agree with them, so I only add what is new. Correctness: looks sound
Issues
PerformanceThe tag scan is O(entries per page) per probe, which is fine at 4 KB and is what the benchmark measures. The skewed VerdictNothing here is a correctness bug in the new layout. Item 1 is the one I would settle before merging (either relax |
…ady indexed under null stay deletable
Review of #9222 (unordered tagged hash buckets, NULL_STRATEGY ERROR, new page size defaults)I read the full diff and traced the new layout through put, get, remove, split, overflow and compaction. I did not run the tests. Overall this is a clean, well-scoped change and I found no blocking issues. What I checked and found correct
Suggestions (non-blocking)
VerdictLooks good to merge once the downgrade behaviour (point 4) is confirmed. The rest is polish. |
|
Review of #9222 (unordered tagged hash buckets, NULL_STRATEGY ERROR on hash, new page size defaults) I read the main-code diff in full and the new test code in part. I did not run the build or the tests. Overall this is a careful change and I found nothing blocking. What I checked and found correct
Points worth addressing
Style and conventions
Tests
Thanks for the thorough release-note section. The downgrade corruption warning is important, and it may be worth also putting it in the upgrade docs. |
…tead of reading it as the current one
|
Review of #9222 (unordered tagged hash buckets, NULL_STRATEGY ERROR on hash, new page size defaults) Overall this is a careful change. I read the diff and the surrounding HashIndexBucket code (split, compaction, overflow, remove paths) and found no correctness blocker. What I checked and found correct
Suggestions (non-blocking)
Verdict |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #9222 +/- ##
============================================
- Coverage 76.85% 76.85% -0.01%
- Complexity 3915 3919 +4
============================================
Files 2124 2125 +1
Lines 212397 212275 -122
Branches 45094 45052 -42
============================================
- Hits 163239 163137 -102
- Misses 31691 31697 +6
+ Partials 17467 17441 -26 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
… UNIQUE_HASH at the 26.10.1 re-pin (#181) Per the maintainers' answer on ArcadeData#9169 (PR ArcadeData#9222): the lines to change, what stays UNIQUE or LSM and why, the measured effect in the lane's own query patterns (OLTP columns for ArcadeDB, ingest columns against it on ascending keys), the page's condition sentence, and the re-measure on the bench host at the re-pin. Status pending. Claude-Session: https://claude.ai/code/session_01Ubz3m6QXHESerCkehC1qgi Co-authored-by: Claude Sonnet 5.5 <[email protected]>
…TION_INTERVAL for hourly time series (ArcadeData#9166), across docs, source, tests, examples (#178) * bindings: apply the maintainers' index and time-series best practices (UNIQUE_HASH for ids, COMPACTION_INTERVAL for hourly aggregates) An id that is only read, updated and deleted by equality gets UNIQUE_HASH (ArcadeData#9169, fixed in ArcadeData#9222, 26.10.1): docs snippets, examples 04 (Link.movieId), 21 and 26, and the create_index docstrings. UNIQUE stays where the key is also ordered (Movie.movieId in example 04). The queries guide gains an "Index choice for an id" paragraph with the maintainers' numbers and what we measured on 26.9.1 (old sorted hash layout, 2.5 to 6 times slower loads), and the schema API page follows it. Example 17 declares COMPACTION_INTERVAL 1 HOURS in both CREATE TIMESERIES TYPE statements, since every query it runs is an hourly bucket (ArcadeData#9166); the async executor page, the server guide and the example pages carry the pointer. New test: a UNIQUE_HASH id end to end (SQL and openCypher lookup, update and delete by id, EXPLAIN shows FETCH FROM INDEX, duplicate rejected). It passes on 26.9.1 and 26.10.1, so it has no version guard. The testing pages follow it. Co-Authored-By: Claude Sonnet 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Ubz3m6QXHESerCkehC1qgi * bindings docs: page cache share (ArcadeData#9168) and index default page size (ArcadeData#9175) in Memory Planning, now that PR ArcadeData#9250 merged Co-Authored-By: Claude Sonnet 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Ubz3m6QXHESerCkehC1qgi * bindings: UNIQUE_HASH rule is equality only and not bulk-loaded in key order, lookup_by_key is O(1) only for a hash index, hash NULL_STRATEGY ERROR is enforced from 26.10.1 Measured on 26.10.1 main (10 runs per arm on Temurin 21 and 25, 200,000 and 2,000,000 LONG ids, same answers): UNIQUE_HASH against UNIQUE answers SQL id = ? 1.5 to 2.3 times faster, an Index.get() hit 1.9 to 3.1 times, an UPDATE by id 1.04 to 1.13 times, a DELETE by id level, and inserts 1.14 to 1.23 times faster for shuffled ids but 9% to 16% slower for ascending ids. The known-issues sentence on hash indexes for identifiers now points at that rule. The hash null strategy note was checked on the 26.9.1 release (accepts null and missing keys) and on 3543960 (REBUILD INDEX over null rows fails and leaves the type without the index; deleting the rows first lets it rebuild). Co-Authored-By: Claude Sonnet 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Ubz3m6QXHESerCkehC1qgi --------- Co-authored-by: Claude Sonnet 5.5 <[email protected]>
Summary
UNIQUEorUNIQUE_HASHfor an id that is only looked up by equality? #9169: answered by the above. For an id only read, updated and deleted by equality, UNIQUE_HASH is now the better choice from SQL and openCypher (pinned by a test); theUNIQUEdefault is unchanged because it would drop range/order support.Test plan
Fixes #5712, fixes #9074, fixes #9169
Notes for the release notes
HashIndexSkewedNonUniqueBenchmark, 100k inserts: 10 keys 66 s (4 KB) vs 47 s (64 KB) vs 0.28 s (LSM); 200 keys 35 s (4 KB) vs 48 s (64 KB) vs 0.21 s (LSM); 5000 keys 1.4 s (4 KB) vs 6.1 s (64 KB) vs 0.18 s (LSM).